PAYONE-GmbH / magento-2

PAYONE Payment Extension for Magento 2
28 stars 56 forks source link

Missing handling of region-codes (Magento/ISO vs. Payone api) #480

Closed berwa closed 1 year ago

berwa commented 1 year ago

Hello Payone-Team, we recently ran into the following problem within one of our projects: The customer can not continue or complete the checkout, as his address from Argentina is rejected by the Payone server/api with the message Parameter {state} faulty or missing. The data transferred as state was AR-X, which is the same code that is used in Magento, and that is created during the Magento-installation: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Directory/Setup/Patch/Data/AddDataForArgentina.php#L72 From the information publicly available AR-X (and the other state/region-codes used by Magento for Argentina) are the proper ISO 3166-2 codes (https://www.iso.org/obp/ui/#iso:code:3166:AR), but the Payone api expects different ones (https://docs.payone.com/pages/releaseview.action?pageId=1213957#ISOSubdivisions(ISO31662)-AR-Subdivisions).

According to a quick check the same issue is also present for state/region-codes for China, Magento (https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Directory/Setup/Patch/Data/AddDataForChina.php#L63) and ISO 3166-2 (https://www.iso.org/obp/ui/#iso:code:3166:CN) use a CN-letter combination, whereas the Payone api expects a numeric code (https://docs.payone.com/pages/releaseview.action?pageId=1213957#ISOSubdivisions(ISO31662)-CN-Subdivisions).

In my opinion the Payone extension should make sure that the state/region-codes are transmitted to the Payone api/server as specified in the Payone documentation and thus convert the codes from Magento accordingly.

Best regards

janteuber commented 1 year ago

Hello @berwa ,

Thank you very much for your advise.

We will check that topic asap.