If the bike is in warranty, take it back to the dealer. Or call the phone number.
Getting any repair part to match anything else is a ****shoot. I've been rolling sevens recently. There are 2 varieties of brake switch, 3 varieties of brake connector, and displays there are hundreds or thousands of different ones. Almost every software revision obsoletes everything previous. There are 2 or 3 varieties of throttle connector and also PAS connectors. Motors come with 2 or 3 connector types, a bit easier.
A new geared hub motor kit from ebikeling is ~$379 +tax +freight. WIth battery $679. That includes one of everything. It all will match. He is out of 26" rear today but check again in a week or three. He has 26" front today. I like my front hub motor, but I have significant weight on my front tire. Don't buy a front hub motor if you climb unpaved hills or mountains frequently. Front are okay on pavement & gravel, but not on slick ice, wet steel, wet rock, or muddy or wet wood bridges. Use torque arm. Front hub motors are not for aluminum, suspension, or carbon front forks.