Basically, if you set the USPS Package Type descriptions on your products it has no effect and no bearing on the quote returned.

This is due to the fact that the API sets the Service type to "ALL" or "ONLINE" instead of setting it to specific service types.

Which, if you look at the USPS API docs here:
http://www.usps.com/webtools/htm/Rate-Calculators-v2-3.htm#_Toc220743994

It shows the following:

<Service/> <FirstCl.../> <Size/> <Container/> <Machinable/> Dimensions <Girth/> <ShipDate/> Max. Weight
All & Online Ignored Regular Ignored Required Ignored Ignored Optional 70 lbs.
All & Online Ignored Large Rectangular Required Required Ignored Optional 70 lbs.
All & Online Ignored Oversize Ignored Required Ignored Ignored Optional 70 lbs.
All & Online Ignored Large Nonrectangular Required Required Required Optional 70 lbs.
All & Online Ignored Large Variable/Null Required Ignored Ignored Optional 70 lbs.
First Class Letter Ignored Ignored Required Ignored Ignored Ignored 3.5 oz.
First Class Flat Ignored Ignored Required Ignored Ignored Ignored 13 oz.
First Class Parcel Ignored Ignored Ignored Ignored Ignored Ignored 13 oz.
Priority Ignored Ignored Lg Flat Rate Box Ignored Ignored Ignored Ignored 70 lbs.
Priority Ignored Ignored Sm Flat Rate Box Ignored Ignored Ignored Ignored 70 lbs.
Priority Ignored Ignored Regular Flat Rate Box Ignored Ignored Ignored Ignored 70 lbs.
Priority Ignored Ignored Md Flat Rate Box Ignored Ignored Ignored Ignored 70 lbs.
Priority Ignored Ignored Flat Rate Env. Ignored Ignored Ignored Ignored 70 lbs.
Priority Ignored Large Rectangular Ignored Required Ignored Ignored 70 lbs.
Priority Ignored Large Nonrectangular Ignored Required Required Ignored 70 lbs.
Priority Ignored Regular Variable/Null Ignored Ignored Ignored Ignored 70 lbs.
Priority Commercial Ignored Ignored Lg Flat Rate Box Ignored Ignored Ignored Ignored 70 lbs.
Priority Commercial Ignored Ignored Sm Flat Rate Box Ignored Ignored Ignored Ignored 70 lbs.
Priority Commercial Ignored Ignored Regular Flat Rate Box Ignored Ignored Ignored Ignored 70 lbs.
Priority Commercial Ignored Ignored Md Flat Rate Box Ignored Ignored Ignored Ignored 70 lbs.
Priority Commercial Ignored Ignored Flat Rate Env. Ignored Ignored Ignored Ignored 70 lbs.
Priority Commercial Ignored Large Rectangular Ignored Required Ignored Ignored 70 lbs.
Priority Commercial Ignored Large Nonrectangular Ignored Required Required Ignored 70 lbs.
Priority Commercial Ignored Regular Variable/Null Ignored Ignored Ignored Ignored 70 lbs.
Express Ignored Ignored Flat Rate Env. Ignored Ignored Ignored Optional 70 lbs.
Express Ignored Regular/Large Variable/Null Ignored Ignored Ignored Optional 70 lbs.
Express SH Ignored Ignored Flat Rate Env. Ignored Ignored Ignored Optional 70 lbs.
Express SH Ignored Regular/Large Variable/Null Ignored Ignored Ignored Optional 70 lbs.
Express HFP Ignored Ignored Flat Rate Env. Ignored Ignored Ignored Optional 70 lbs.
Express HFP Ignored Regular/Large Variable/Null Ignored Ignored Ignored Optional 70 lbs.
Express Commercial Ignored Ignored Flat Rate Env. Ignored Ignored Ignored Optional 70 lbs.
Express Commercial Ignored Regular/Large Variable/Null Ignored Ignored Ignored Optional 70 lbs.
Express SH Commercial Ignored Ignored Flat Rate Env. Ignored Ignored Ignored Optional 70 lbs.
Express SH Commercial Ignored Regular/Large Variable/Null Ignored Ignored Ignored Optional 70 lbs.
Express HFP Commercial Ignored Ignored Flat Rate Env. Ignored Ignored Ignored Optional 70 lbs.
Express HFP Commercial Ignored Regular/Large Variable/Null Ignored Ignored Ignored Optional 70 lbs.
Parcel Post Ignored Regular Ignored Required Ignored Ignored Ignored 70 lbs.
Parcel Post Ignored Large Ignored Required Ignored Ignored Ignored 70 lbs.
Parcel Post Ignored Oversize Ignored Required Ignored Ignored Ignored 70 lbs.
BPM Ignored Regular/Large Ignored Ignored Ignored Ignored Ignored 15 lbs.
Media Mail Ignored Regular/Large Ignored Ignored Ignored Ignored Ignored 70 lbs.
Library Mail Ignored Regular/Large Ignored Ignored Ignored Ignored Ignored 70 lbs.

So what this tells me is that for any regular sized package, the 'container' type is totally ignored. If we select the USPS "all in one box" option, it is automatically set to "Rectangular" so it's ignored in that case as well. The only case where the container type has any effect whatsoever is if it happens to be "Large" and also happens to be Rectangular,Non-Rectangular, or Variable (In other words the options Flat Rate Box, Large Flat Rate Box, and Flat Rate Envelope do absolutely nothing to the quote as they are totally ignored).

What should probably happen is to ditch the "container type" setting on products entirely and replace it with specific allowable quote types and package sizes at a class and product level - as opposed to the systemwide quote type settings. (not to mention it should be updated to include all the box types like MD, and Sm, and not just Flat Rate, and Large Flat Rate).

Perhaps even the "shipping types" of package and envelope could be altered to include the various box sizes so that if products are marked as only being able to be shipped in a md flat rate box, and its combined with a flat rate envelope item, it combines them and only requests a quote for the md flat rate box.

Anyhow, I think the way the usps module currently works leaves a lot to be desired, and kinda sorta works if your use case happens to be fairly simple, but for most cases it could be vastly improved. Im hoping to fire up a discussion about how this can be improved so we can move it in that direction.

Also: see this for another reference describing this issue: http://www.ubercart.org/forum/bug_reports/14561/ubercart_incorrectly_int...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

longwave’s picture

Mixologic’s picture

How about more fuel for the USPS fire: I just got an email from the USPS saying they are depricating their V3Rate request and IntlRate:

o Rate, RateV2, RateV3 and IntlRate will be retired in May 2011, requiring all integrators to migrate to the latest versions

Here's the whole email.

Dear Webtools Integrator, 
On January 2, 2011, USPS will update domestic shipping services and international pricing and product features. For detailed information on prices and new product features, please reference the Federal Register Notice at http://pe.usps.com/FederalRegisterNotices.asp#Jan_2011_Prices <http://pe.usps.com/FederalRegisterNotices.asp>.

For a list of the new prices, please reference the Postal Explorer website at http://pe.usps.com/. The information is on the left hand side under "NEW* Jan. 2, 2011 Pricing Information"

Price Change updates will be available in the Web Tools testing environment for integrator access on or around December 13. The test environment can be accessed, using your production UserID, via the following URL scheme, host and path:

Secure APIs: https://stg-secure.shippingapis.com/ShippingApi.dll 
Non-secure APIs: http://stg-production.shippingapis.com/ShippingApi.dll 
Please note that the changes below are intended to be backwards compatible, however, may not be depending on how individual programs are integrated with the APIs. Technical guides, inclusive of the changes below, can be obtained from the USPS Internet Customer Care Center (1-800-344-7779 or icustomercare@usps.com <mailto:icustomercare@usps.com>).

Web Tools APIs will be affected in the following manner: 
§ All Web Tools APIs with postage prices incorporated will be updated to reflect the price changes 
§ All Rate Calculator API integrators are encouraged to migrate to the latest API versions (RateV4, IntlRateV2): 
o RateV4 and IntlRateV2 will be the only Rate Calculator API versions to offer the full range of new products and functionality

o Rate, RateV2, RateV3 and IntlRate will be retired in May 2011, requiring all integrators to migrate to the latest versions

§ Domestic Rate Calculator API Changes 
o New <Container> request enumerations will be added to RateV4 to support the USPS product offerings and prices listed in the Federal Register Notice

o New response nodes in Rate, RateV2, RateV3 and RateV4 to support the USPS product offerings and prices listed in the Federal Register Notice

o New optional request values in RateV4 to support USPS extra services offerings and prices 
o New optional response nodes in RateV4 to support USPS extra services offerings and prices 
§ International Rate Calculator API 
o New response nodes in IntlRate and IntlRateV2 to support the USPS product offerings and prices listed in the Federal Register Notice

o New optional request values in IntlRateV2 to support USPS extra services offerings and prices 
o New optional response nodes in IntlRateV2 to support USPS extra services offerings and prices 
o New <AdditionalRestrictions> response value in IntlRate and IntlRateV2 
§ Express Mail Label and Hold For Pickup Express API 
o New <Revision> and <Container> request data tags to support the Legal Flat Rate Box 
o New <Size>, <Length>, <Width>, <Height> and <Girth> request data tags 
§ Delivery Confirmation and Signature Confirmation 
o New <Revision> and <Container> request data tags to support the USPS product offering and prices listed in the Federal Register Notice

§ International Label APIs 
o New <Container> request enumerations will be added to support the USPS product offerings and prices listed in the Federal Register Notice

o New <Revision>, <Size>, <Length>, <Width>, <Height> and <Girth> request data tags 
o New <AdditionalRestrictions> response value 
§ Customs Forms CN22 and CP72 
o New <AdditionalRestrictions> response value 
Please contact the USPS Internet Customer Care Center with any questions or concerns at 1-800-344-7779 or icustomercare@usps.com <mailto:icustomercare@usps.com>.

- Web Tools Program Office
torgosPizza’s picture

Title: USPS Package Type Descriptions Have No Effect Due to API implementation » Move USPS Module out of core

Got that email today too. Seems like we have a deadline of May, at the very least, to make sure the API in Ubercart works with the new USPS API RateV4.

TR’s picture

Title: Move USPS Module out of core » Migrate USPS module to RateV4
Category: feature » task

So where is this mythical RateV4 API? The documentation on the USPS web site is still all about RateV3. Sounds to me like V4 doesn't exist yet. (Actually, I just called USPS and found out that RateV4 is *not* released yet, and won't be available until January 2nd ! I did manage to get them to send me a pre-release copy of the documentation though ... contact me directly if you want it.) Upgrading the USPS module to the new API shouldn't be a big deal, but it can't be done yet because there is no API available yet.

RateV3 has been the "current" version for more than three years, and has been the only version used by Ubercart so far - I'm surprised that V2 is still accepted and hasn't been phased out, and I'm curious to know why V3 is going to be turned off in May when users haven't even seen RateV4 yet - January to May gives users only 4 months of overlap to port, test and migrate to the new API. Users of the old RateV2 are going to be in even worse shape.

USPS has badly mismanaged their APIs in the past. Specifically, they have over the years made major changes in the XML request and response for RateV3 *without* changing the version - so what used to be a valid V3 request isn't any more, and the elements present in the response have changed so code that used to properly parse the response doesn't work correctly any more. That should never happen - it defeats the whole purpose of versioning the APIs. Another example is the grid presented by Mixologic in the original post - that is a change from what RateV3 used to return. Another example is the online pricing, where the XML response format was changed over the summer sometime, without notice. See #924716: USPS Shipping Rates Quoted at Offline Prices, even though Online Pricing is Selected

As for moving USPS out of core, I think in general it's a good idea to move these carrier-specific modules like USPS and UPS out of core. Anyone willing to adopt the USPS module? A separate thread should probably be opened for a discussion of what should be in core in Ubercart 3.x and what should be spun off.

Mixologic’s picture

And.. USPS dorked their API.

Shipping quotes are now coming back with this crap in them:

 Priority Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Flat Rate Envelope: $6.25
 Priority Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt;: $7.33
 Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Flat Rate Envelope: $18.90
 Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt;: $26.47
 Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Sunday/Holiday Delivery Flat Rate Envelope: $31.40
 Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Sunday/Holiday Delivery: $38.97
torgosPizza’s picture

And today is January 2nd. I wonder if this change is part of the V4 rollout as TR mentioned in #4, or perhaps it's an unintended consequence and something they need to fix. ..

Mixologic’s picture

FYI I posted a patch to clean their output here: http://drupal.org/node/1012520

Fabianx’s picture

subscribe

swortis’s picture

I'm sort of confused. Hoping someone can clarify.

RateV4 is now in effect no? Current Ubercart shopping carts are all showing incorrect USPS shipping rates? Or is there a fix to continue use the RateV3 API until it's completely dropped by USPS?

TR’s picture

@swortis: The USPS web server currently accepts RateV2, RateV3, and RateV4 requests. In May, everything but RateV4 will be turned off.

The returned Rates are correct no matter what version you use. There are some new features that may be used in RateV4 that aren't available in previous versions.

swortis’s picture

Odd.. Perhaps I'm just baffled by the rates themselves then.. (Seeing $7 for a 3 oz package standard mail)

torgosPizza’s picture

Are you sure it's not priority? Where is it shipping to? You can check the rate accuracy by going to http://www.usps.com/tools/calculatepostage/welcome.htm

The USPS module simply returns the request from the website, so if you're having issues with the price, it's probably a configuration problem.

swortis’s picture

Well, for a 4 oz item (a CD) we're getting the following prices:

USPS Logo Priority Mail: $14.20
USPS Logo First-Class Mail Large Envelope: $14.92
USPS Logo Express Mail®: $30.50

Seems a little nuts

longwave’s picture

mcaden’s picture

subscribe

TR’s picture

Re: #14

No, that particular problem isn't present in USPS. I verified by printing out the $product object, and it correctly contains a weight_units property. Google checkout is a payment module while USPS is a shipping module, which is why there doesn't seem to be any common code and/or shared errors between the two.

I won't swear there are no problems with the weight conversion in USPS; I know I spent a long time getting that right and testing in my uc_fedex module to make sure orders that contain products with a mixture of weight units were all being properly converted to one standard unit before the web service was called, but I haven't done similar testing for USPS.

I agree with torgosPizza that the rate anomaly seen by @swortis is almost certainly a configuration problem. My bet is on a wrong value for package quantity. This can be quickly determined by turning on and looking at the XML debug output. Regardless, my USPS quotes are showing up with the correct rates so I don't think there's something fundamentally wrong.

torgosPizza’s picture

#13: Are you getting these prices in Ubercart? What are the prices you're getting from the USPS site? Are they the same, or not? If they're not, are you running any multipliers? Debug info might be helpful to diagnose it but if there is an actual bug, it doesn't belong in this thread. You'll have to start a new Issue.

shineshadow’s picture

subscribe

swortis’s picture

FileSize
72.68 KB
64.32 KB
58.56 KB

Getting those prices in Ubercart, yes. No multipliers. Actually, going back and looking now I see that there are no options except USPS Express Mail, despite allowing USPS First Class and UPS..

(Have attached some screen shots

torgosPizza’s picture

What do you mean "no options except USPS Express Mail?" In your "What the customer sees" screengrab, I see Express, along with First Class and two (2) Priority Mail options. Not sure I follow, everything looks right to me.

Not having UPS might be another issue altogether. Do you have your product's dimensions setup? Perhaps UPS isn't receiving them correctly, but since that's a separate module I'd recommend opening a new issue for that.

TR’s picture

@swortis: As torgosPizza said in #17, please open a separate support issue if you want to pursue this. This current thread is supposed to be about switching the USPS API from RateV3 to RateV4.

swortis’s picture

Ok - will pursue elsewhere. Thanks, all

carwin’s picture

Subscribe

hondaman900’s picture

My issue is that customers are being quoted/offered USPS shipping via cheaper flat rate boxes when the dimensions of my items will not allow it to fit into a flat rate box. There seems to be a disconnect between item dimensions and its effect on the shipping options. My international customers can choose a flat rate USPS shipping amount that is less than half of my actual cost to ship via USPS in the correct container/method.

Anyone have a solution/workaround for this yet?

TR’s picture

@hondaman900 : That's not the topic of this issue. Please pursue your problem in that other thread where you posted the same information.

TR’s picture

Status: Active » Patch (to be ported)

I've implemented RateV4 in Ubercart 7.x-3.x. Now need to backport to 6.x-2.x.

TR’s picture

Status: Patch (to be ported) » Needs review

Here's the patch for Ubercart 6.x-2.x-dev. These are the minimal changes needed to make the uc_usps module work with the RateV4 API. None of the new API features have been implemented.

Please test.

TR’s picture

FileSize
3.97 KB

Umm, forgot the patch...

imrubio22’s picture

Has anyone patched for IntlRateV2? I'm not able to get international rates to Canada. However, domestic rates are working fine.

thanks!

TR’s picture

Yes, if you look at the patch you will see it uses IntlRateV2. Since this issue is about the D6 version of Ubercart, I assume you're using Ubercart 2.x. In which case there are no known issues getting international quotes with IntlRate or with IntlRateV2. I suggest you turn on the shipping quote debug and look at the output. Also, check your conditional actions - if you have modified them you might have broken the conditions.

imrubio22’s picture

Thanks for the patch TR. I applied it but I'm still receiving errors international shipping. I'll keep searching.

TR’s picture

Status: Needs review » Fixed

OK, no objections, so I'm going to go ahead and commit this for Ubercart 6.x-2.x.

Status: Fixed » Closed (fixed)

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