Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 05-09-2014 13:39:23

Blitzen
Member
From: USA
Registered: 01-01-2005
Posts: 936

Countries and USPS

There seems to be a change or problem with the countries for USPS.

Client is trying to ship to Russia and USPS returns an "invalid country" error.
THIS IS NOT THE ONLY COUNTRY WITH AN ERROR.

This is the returned USPS error
<?xml version="1.0" encoding="UTF-8"?>
<IntlRateResponse><Package ID="0">
<Error>
<Number>-2147218046</Number>
<Source>IntlPostage;clsIntlPostage.GetCountryAndRestirctedServiceId;clsIntlPostage.CalcAllPostageDimensionsXML;IntlRate.ProcessRequest</Source>
<Description>Invalid Country Name</Description>
<HelpFile/><HelpContext>1000440</HelpContext>
</Error>


This is part of what was sent

<IntlRateRequest USERID="notDisclosedOnForum">
<Package ID="0"><Pounds>3</Pounds><Ounces>10</Ounces><MailType>Package</MailType>
<Country>Russian Federation</Country>
</Package></IntlRateRequest>

Can you list all the countries and codes for USPS so that we can check that the db is correct.

Offline

 

#2 05-12-2014 10:22:48

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Countries and USPS

I found this:  According to the Universal Postal Union, Russian Federation is the official Country name.

The USPS API does not always conform to the preferred address format of the postal service in the receiver's country. That's a USPS bug, not the application that interfaces with their api. What tech support gave you is a workaround for the USPS api.


Nick Hendler

Offline

 

#3 05-12-2014 13:47:49

Blitzen
Member
From: USA
Registered: 01-01-2005
Posts: 936

Re: Countries and USPS

Tech support gave me nothing. That was the XML return code from USPS when your database country name was wrong.

CCP DATA ARE WRONG - NOT USPS
This client has been loosing money because the default rates were used when the CCP db was wrong.
I finally tracked it down to errors in the country database.

USPS is not wrong - it is not a bug. They are the ones who define what countries they use for their api.
E.g., Look at what USPS uses for the UK countries.

Your database is wrong and should comply with what each carrier uses regardless of the official name of the country.
Is our official name "United States" or "United States of America" or "The United States of America"? What is in your db? The official name?
(The official name for the Andromeda solar system is Andromeda. What is the official name of our solar system?)

You should use the country what the carriers use OTHERWISE CCP USERS WILL GET ERRORS and the default rate will be used, not the Real-Time Rate.

Thus, your shipping logic needs to have the country names that each carrier uses - not what you want them to use otherwise CCP users will not be getting the Real-Time Rates all the time.

Offline

 

#4 05-13-2014 13:45:40

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Countries and USPS

The proper name for the country Russia is Russian Federation.  This is the name commonly used to identify that country across all platforms which use a name and not an abbreviation.  If USPS uses some other name for Russia, I would recommend you add that as an entry in the countries table and delete the Russian Federation entry.

Most services use abbreviations (like US, GB, etc.) to identify countries because those abbreviations are standardized.  Unfortunately USPS doesn't do that.


Nick Hendler

Offline

 

#5 05-15-2014 11:26:17

Blitzen
Member
From: USA
Registered: 01-01-2005
Posts: 936

Re: Countries and USPS

Then your software doesn't work.
Do you plan to fix it?

Offline

 

#6 05-15-2014 17:26:46

Blitzen
Member
From: USA
Registered: 01-01-2005
Posts: 936

Re: Countries and USPS

And, apparently you recognized the country issue because in usps.php you corrected for UK and Ireland.
How about the other countries? Russia is not the only one.


     if ($dest_country == 'United Kingdom')     {$dest_country = 'Great Britain and Northern Ireland';}
     if ($dest_country == 'Ireland')            {$dest_country = 'Great Britain and Northern Ireland';}
     if (preg_match('/^UK \- /',$dest_country)) {$dest_country = 'Great Britain and Northern Ireland';}

Offline

 

#7 05-19-2014 10:06:27

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Countries and USPS

You have yet to produce any documentation as to what country name should be passed to USPS for Russia.  I have seen no such documentation on the USPS website or in this thread.  If the country name in fact cannot be 'Russian Federation' you would modify usps.php adding:

Code:

if ($dest_country == 'Russian Federation') {$dest_country = 'Russian Federation USPS Name';}

That's what we would do with a software update, if and when anyone can tell us what USPS wants 'Russian Federation' passed as.


Nick Hendler

Offline

 

#8 05-19-2014 13:08:39

Iceit88
Member
From: Fairview, PA
Registered: 11-19-2003
Posts: 549
Website

Re: Countries and USPS

USPS does need "Russia" passed as the country name.   I simply changed 'Russian Federation" to "Russia" in the country list and now it returns real-time rates for USPS.

I do remember this happening with one other country also and USPS not returning real-time rates.  Unfortunately, I can't recall the country.  I think I added the country to the countries list or did a name change again to get it working.


Bryan

Hat Trick Sports, LLC

Offline

 

#9 05-22-2014 17:35:09

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Countries and USPS

Thanks.  We'll be changing the country name in the next update to 'Russia'.  All other APIs use the abbreviation and will be unaffected.


Nick Hendler

Offline

 

#10 05-22-2014 22:54:01

Iceit88
Member
From: Fairview, PA
Registered: 11-19-2003
Posts: 549
Website

Re: Countries and USPS

Montenegro is not on the list and needs added.


Bryan

Hat Trick Sports, LLC

Offline

 

#11 05-23-2014 09:44:16

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Countries and USPS

Will do.  I have a good friend from Montenegro.  I hear it's beautiful.


Nick Hendler

Offline

 

#12 05-23-2014 12:50:53

Blitzen
Member
From: USA
Registered: 01-01-2005
Posts: 936

Re: Countries and USPS

As stated in my initial post, "THIS IS NOT THE ONLY COUNTRY WITH AN ERROR."

How about providing a complete list for editing. I am certain we are not the only ones with this issue. Those seeing this may not know how to troubleshoot, especially when it is not every shipping rate for a method.

Offline

 

#13 05-27-2014 09:12:31

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Countries and USPS

If you would like to edit and/or view a list of countries, access System > Locations > Countries.


Nick Hendler

Offline

 

#14 06-12-2014 13:26:02

Iceit88
Member
From: Fairview, PA
Registered: 11-19-2003
Posts: 549
Website

Re: Countries and USPS

Here is another I found today:
Change Trinidad & Tobago to Trinidad and Tobago


Bryan

Hat Trick Sports, LLC

Offline

 

Board footer