Paypal API (GetExpressCheckoutDetails) is returning the zone value of SHIPTOSTATE in different formats for different countries.
For US addresses it is zone code (e.g. 'CA') but for UK addresses it is zone name (e.g. 'West Midlands'). At least the sandbox API is returning this.
On top of that many zones/states in different countries uses the same zone codes.

The DB query at EC review stage should take this into account when saving the delivery zone for order, otherwise the wrong zone_id is saved.

Here's the patch that solves this by slightly optimized SQL query.

Comments

lop’s picture

StatusFileSize
new1014 bytes
Island Usurper’s picture

Status: Needs review » Needs work

I don't think running check_plain() on the response is a good idea here. Any &s in the name would be htmlencoded, and they wouldn't match anything in the database. db_query() with the %s automatically makes sure that the input won't harm the query or allow SQL injection.

Otherwise, I think this looks like a good idea.

Island Usurper’s picture

Issue tags: +Release blocker
Island Usurper’s picture

Status: Needs work » Needs review

Here's the patch without check_plain(). Somebody who has a PayPal sandbox set up, please review this.

Island Usurper’s picture

StatusFileSize
new1.14 KB

Rather, here.

rszrama’s picture

Status: Needs review » Fixed

Committed w/ minor tweak of $country_state -> $zone and initializing the $zone_id variable.

Status: Fixed » Closed (fixed)
Issue tags: -Release blocker

Automatically closed -- issue fixed for 2 weeks with no activity.