USPS Error For nopCommerce 1.30 UK Customers

I was using nopCommerce 1.30 and eventually having problem in finding the Shipping Cost for international destinations.

Being unable to upgrade, I have employed the code from 1.50 to 1.30. It was working fine except for the customers in UK. They could see the “Invalid Country” error message. At much of my surprise, when I changed country name “United Kingdom” to “Great Britain” it worked!

Since I think this problem is within the USPS Web Service itself, there is nothing wrong with the nopCommerce Code.

I am not sure about my solution that if it is the only way but it worked for me. I am providing here the code I have changed in USPSComputationMethod.cs [#region international request]:

Original Code:

sb.AppendFormat(“<Country>{0}</Country>”, ShipmentPackage.ShippingAddress.Country.Name);
sb.Append(“</Package>”);

My Changes:

if( ShipmentPackage.ShippingAddress.Country.Name == “United Kingdom”)
sb.AppendFormat(“<Country>Great Britain</Country>”);
else
sb.AppendFormat(“<Country>{0}</Country>”, ShipmentPackage.ShippingAddress.Country.Name);
sb.Append(“</Package>”);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s