Jump to content

Trouble with UPS module


cqpbert

Recommended Posts

It seems my UPS module quietly stopped working. I guess now I need to have some sort of app over at my UPS account. So I have done that I think. I have copied my Client ID and Client secret into the module. I have picked all the services and saved. Cleared the Cache.

Logged in as one of my Canadian customers, added something to the cart but at checkout it says no suitable shipping method.

Does anybody have experience with this newer module? It used to work great for USA and Canada.

Link to comment
Share on other sites

That helps some. The auth seems to work, but the rate request does not. I don't want to post the entire error here since it has addresses in it.

here is the error:

Response received (401 - Unauthorized) {"response":{"errors":[{"code":"250002","message":"Invalid Authentication Information."}]}}

 

Maybe I have too many apps in UPS? Am I supposed to only get the auth or am I supposed to get shipping as well?

 

seems it is the rate request. here is the heading of the error:

Request Sent (cURL) - https://wwwcie.ups.com/api/rating/v1/Shop

I tried adding the rating app and it says its approved.

 

Link to comment
Share on other sites

  • 3 weeks later...

I am still having issues with this. I am trying to upload a screen shot from my request log but that is not working. Maybe this will work:

"NumOfPieces":1,"Package":[{"PackagingType":{"Code":"00","Description":"Packaging"},"Dimensions":{"UnitOfMeasurement":{"Code":"IN","Description":"Inches"},"Length":"6.0000","Width":"20.0000","Height":"12.0000"},"PackageWeight":{"UnitOfMeasurement":{"Code":"LBS","Description":"Pounds"},"Weight":32}}]}}}
Response received (400 - Bad Request)
{"response":{"errors":[{"code":"110601","message":"Missing or invalid package weight for package 1."}]}} 

that is the end of the response code for the request, as well as the response. According to the response there is no package weight, but as you can see a weight has been passed to them.

I hope we can get this sorted out soon.

Link to comment
Share on other sites

  • 2 weeks later...

It seems that PHP is encoding the weight value as a numerical data type, whereas UPS requires a string data type.

In the UPS module, shipping.class.php, line 315, make this change:

From:

"Weight" => $item['product_weight']

To:

"Weight" => (string)$item['product_weight']

There are also the item's dimensions, but I think CubeCart handles those as strings anyway.

Link to comment
Share on other sites

Thanks as always Brian.

I think we are getting closer. Now the error is this:

"NumOfPieces":1,"Package":[{"PackagingType":{"Code":"00","Description":"Packaging"},"Dimensions":{"UnitOfMeasurement":{"Code":"IN","Description":"Inches"},"Length":"6.0000","Width":"20.0000","Height":"12.0000"},"PackageWeight":{"UnitOfMeasurement":{"Code":"LBS","Description":"Pounds"},"Weight":"32"}}]}}}
Response received (400 - Bad Request)
{"response":{"errors":[{"code":"110609","message":"All package dimensions are required and each must be greater than 0 for package 1."}]}} 

I added string in front of the dimensions as you did on the weight hoping it would help and that I had learned something. But it did not. BTW, to me it seems like this is an error with the UPS module?

Maybe the dimensions need to be numbers and not strings?

Link to comment
Share on other sites

The UPS API specs say that the dimensions are to be text strings -- 6 digits in length with 2 digits of significance after the decimal point.

How have you specified these weights in the UPS module? There is a choice to use individual item dimensions or a global set of dimensions.

Either way, check to see if the dimensions are stated as having four places after the decimal point. If so, make it to two places.

Link to comment
Share on other sites

Let's look at this another way. Instead of making sure the source data conforms to the needs of UPS, use a formatter in the module to make the passed in data be presented according to the needs of UPS.

So, for the code handling dimensions:

From:

        "Length" => $item['product_depth'],
        "Width" => $item['product_width'],
        "Height" => $item['product_height']

To:

        "Length" => sprintf("%01.2F",$item['product_depth']),
        "Width" => sprintf("%01.2F",$item['product_width']),
        "Height" => sprintf("%01.2F",$item['product_height'])

 

Link to comment
Share on other sites

YOU DID IT!!!!!!!!!!!!!!!

To be sure, I entered in 20,16,4 for the dimensions and cube cart has converted them to 20.000,16.000,4.000.

Thank You again.

Now to get my other stuff going - I see you gave it some thought.

where did you locate the UPS API specs so quickly? Seems like I should have been able to do that and not been such a PIA

Link to comment
Share on other sites

well actually it was a typo above, but not in the correct way. It should have been 4 places not three. here is a product where I did not fill in anything (which will be an issue for sure)

image.png.2a499579f357e3931687ba710d7936dd.png

Here is my numbers I have entered:

image.png.2798fbf1a9c2b8143d57913a5b006ef2.png

 

And here is after save and reload:

image.png.fecb2216880252b9ec3a94defbf2c172.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...