Closed natea closed 10 years ago
This is a pesky shortcoming of the PayPal API. Since PayPal can be used in lots of countries other than the US, we can't use a US state dropdown by default. Individual projects can do this if they only ship to the US.
In https://github.com/tangentlabs/django-oscar-paypal/commit/849b577cd357adb583d9199052df1692417d30f9, I've added a snippet that attempts to use short versions of state names using the localflavor package. This handles the example here and should be an improvement overall.
Could we have the U.S. State field appear conditionally if the user selects U.S. as the country? Or are you saying that the State field is used by other countries, to mean Province in Canada for example?
Thanks for adding the localflavor fix. I think that might be sufficient for now, but eventually we may want to replace it with a dropdown just to be extra safe.
Could we have the U.S. State field appear conditionally if the user selects U.S. as the country? Or are you saying that the State field is used by other countries, to mean Province in Canada for example?
The state field is used by other countries, so you would need to use javascript to dynamically change the widget when the US country is selected. A bit fiddly.
I was using the sandbox site that ships with django-oscar-paypal, and when I clicked on the PayPal Express button on the payment details page, I was getting the message "An error occurred communicating with PayPal"
I looked in the log and saw this error (note: i've replaced the sensitive values with 'xxxxx')
Once I put in the form for the State field "MA" instead of "Massachusetts", then PayPal accepted the transaction and didn't report an error.
So I think it would be best to modify the payment details form to have a dropdown field instead of a freeform text field for the US State, to avoid this error if the user inadvertently types in the full state name, rather than the two letter abbreviation.