I understand what you're saying, and agree. But you should be telling PayPal that. See comments below for further clarification.
Well, your renamed countries will certainly be a partial cause of problems, and would require your posted code alteration to accommodate that renaming of countries. It's naturally much safer to use official names (ie: "United Kingdom"), not renaming them to something inaccurate like a principality (ie: "Wales").
Zen Cart is simply doing a lookup based on a match of either the ISO code or the country name, in order to accommodate the fact that PayPal sends the data back in multiple ways (ie: PayPal sometimes sends an ISO code, and sometimes sends an (official ISO) country name.) PayPal sends back their responses in different ways depending on which "engine" they're using (US vs UK vs CA/AU, rest of world, etc) and which "product" they're using (Std, EC, Pro, Payflow, etc). The bit of code you quoted is part of a section of lookup code that's attempting those matches.
That said, you've indirectly pointed out an inconsistency in the lookup activity which we'll address in a future version. This may or may not resolve your unique problem of renamed countries.
In looking at your proposed "fix", I can see how it would provide relief for your specific symptoms, especially if you don't have a "United Kingdom" country in your store to match up with PayPal's response.
While one of the others reporting the same error message has stated that they're using a British postcode addon, several are US merchants who are much less likely to have edited the country name "United States" to say something else. So, I would be very surprised if your proposed "fix" would solve their problem at all.
Further, when reviewing wizer's logs I discovered a problem with the $order object's contents which was occurring way before the section of code your proposed "fix" would even fire, so that's not the magic answer either.
A proper complete solution needs to address all these other cases, not just your renamed-country case. That said, if you have eyes to spot the actual real root cause, the input is welcome.
Remember also that an incorrectly defined Zone Definition applied to the payment module will specifically trigger the "geographic area" error, since that's the specific intended purpose of that feature: if the customer's address falls outside the selected zone's definition, the module prevents itself from being used.
Bookmarks