webdna / commerce-braintree

Braintree gateway for Craft Commerce
Other
2 stars 10 forks source link

Certain country names don't work #19

Closed zackspear closed 4 years ago

zackspear commented 4 years ago

Hi there,

We recently had a bug brought to our attention by a customer. They tried to purchase with the country set as "Slovak Republic". Which is the default naming convention in Craft Commerce, as well as the official name of the country, however it didn't work. Braintree return response is "Country name is not an accepted country." Braintree expects "Slovakia".

I confirmed this bug locally. And "fixed" the bug by changing the name in Craft Commerce to "Slovakia".

The same happens for places like South Korea. BT expects "Korea, South" but Craft uses "Korea (South). And I'm sure there are others.

I realize I could, and probably should, go through the BT docs for the country names they expect and then cross reference the differences in Craft Commerce, then update in Craft accordingly. However I still wanted to bring this to your attention. Because I'm sure other people using the plugin, whether current or future, will potentially run into this same issue.

Perhaps this could be avoided by using the "Alpha-2 code" instead of the full country name. But I'm not sure what a change like that would entail from the plugin POV and whether a change like that would break integrations that people currently have developed.

At the minimum it should be mentioned in the README / docs for the plugin that country names in Craft Commerce need to match what BT needs to prevent issues like this.

Thanks 🙏

EDIT:

I've created a Google Sheet to help find the mismatches between CC and BT.

EDIT 2:

Something to keep in mind, it seems like country names aren't part of the project config.

samuelbirch commented 4 years ago

i've removed the county name from the address so it now just uses the ISO2 code. I don't know why braintree doesn't just ignore the country name if the ISO2 code is passed as well?

fixed in 2.3.0