Page 1 of 1

UPS ship gateway broken

Posted: Mon Jul 13, 2020 7:48 am
by AbleMods
As of 7-12-2020 5:06pm EST, all of my Able Gold installs have stopped calculating UPS shipping rates. Every Able Gold install I've checked can no longer calculate UPS rates.

The error reported in the error log is:
Exception: An item with the same key has already been added.Stack Trace: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at CommerceBuilder.Shipping.Providers.UPS.UPS.ParseProviderRateReponse(XmlDocument providerResponse, Package[] packages) at CommerceBuilder.Shipping.Providers.UPS.UPS.GetAllProviderShipRateQuotes(Warehouse origin, Address destination, IList`1 contents) at CommerceBuilder.Shipping.Providers.UPS.UPS.GetShipRateQuote(Warehouse origin, Address destination, IList`1 contents, String serviceCode) at CommerceBuilder.Shipping.Providers.ShippingProviderBase.GetShipRateQuote(IShipment shipment, String serviceCode) at CommerceBuilder.Shipping.ShipMethod.GetShipRateQuote(IShipment shipment)
I've traced the problem to how the API response is parsed from UPS. Normally UPS only returns one entry for each serviceCode (ship method) in the response. Suddenly now they're turning the 3-Day Select ship method (serviceCode=12) twice.

The Able code is built assuming every service code is unique. And for a very long time that has worked fine. There's no way to know how long before UPS reviews and resolves this issue. In the mean time, the fix is fairly simple if you have full source code access to the Able UPS provider:

Open the UPS.cs class file in the UPS project of the full source code.

Locate the ParseProviderRateResponse() method.

Within that method, find the code listed below and replace it with the suggested replacement.

Recompile the CommerceBuilder.UPS.Dll file in Visual Studio and deploy the updated DLL file to your live website /bin/ folder.

Restart your IIS application pool.

Here's the code to look for...

Code: Select all

                        availableServices.Add(serviceQuote.ServiceCode, serviceQuote);    
Replace with this:

Code: Select all

                    if (!availableServices.ContainsKey(serviceQuote.ServiceCode))
                    {
                        availableServices.Add(serviceQuote.ServiceCode, serviceQuote);    
                    }

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 8:26 am
by Naveed
Hi,

Thanks for reporting the issue.

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 9:18 am
by jguengerich
Thanks Joe! Not sure how long it would have taken me to figure that out.

I did a quick test (one fake order) after I applied your fix with logging turned on, and there was a slight difference in the two service code 12 responses. One (the second one) had a slightly higher TransportationCharges and a $4.00 ServiceOptionsCharges.

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 9:35 am
by AbleMods
jguengerich wrote:
Mon Jul 13, 2020 9:18 am
Thanks Joe! Not sure how long it would have taken me to figure that out.

I did a quick test (one fake order) after I applied your fix with logging turned on, and there was a slight difference in the two service code 12 responses. One (the second one) had a slightly higher TransportationCharges and a $4.00 ServiceOptionsCharges.
No problem.

I saw the same thing with the rates. Seemed to make more sense keeping the first one since it always seemed to be lower than the duplicate. Clearly a UPS issue, unless maybe they're doing something new for only 3-Day Select like a built-in service fee of some sort?

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 10:46 am
by rlopez
Is there another way to access the UPS.cs file without having the source code?

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 11:41 am
by AbleMods
I'm afraid not. Only AbleCommerce can provide a fix to the general public.

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 1:33 pm
by rlopez
That's a bummer. What is interesting when testing from the front end, it will give UPS rates in the state I reside but not in any other Contiguous sate in the USA when I try and use a different state and zip. Can Ablecommerce help with a temp fix? As a Note: This is also happening with Able9 if no one has complained yet.

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 1:44 pm
by jguengerich
I don't know that it matters, but when I look at UPS' Retail Rates guide, the only $4.00 add-on specific to 3 Day Select is Saturday Delivery. There is also a $4.00 UPS On-Call Pickup Area Surcharge (Residential) that applies to "certain ZIP codes".

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 1:54 pm
by mazhar
We are looking into it. We can surely get a temp fix for it that won't break the checkout but for a proper fix we need to understand the change that UPS made. We trying to contact them and get an explanation about duplicate rates returned.

AC 7.0.7 Patch
Download, extract and then Copy CommerceBuilder.UPS.dll into Website/bin folder. Please take backup of your existing file before replacing it with this one.

Gold R11-R12 Patch
Download, extract and then Copy CommerceBuilder.UPS.dll into Website/bin folder. Please take backup of your existing file before replacing it with this one.

Gold R9-R10 Patch
Download, extract and then Copy CommerceBuilder.UPS.dll into Website/bin folder. Please take backup of your existing file before replacing it with this one.

Gold R8 Patch
Download, extract and then Copy CommerceBuilder.UPS.dll into Website/bin folder. Please take backup of your existing file before replacing it with this one.

Gold R7 Patch
Download, extract and then Copy CommerceBuilder.UPS.dll into Website/bin folder. Please take backup of your existing file before replacing it with this one.

Gold R3-R6 Patch
Download, extract and then Copy CommerceBuilder.UPS.dll into Website/bin folder. Please take backup of your existing file before replacing it with this one.

AC9 Patch
Please download and put UPS.zip file into your Website/Plugins folder. Please take backup of existing UPS.zip file in Plugins folder before replacing it with this one. You will need to restart your website to make new updates effective.

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 2:10 pm
by rlopez
Mazhar, thank you!

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 3:11 pm
by mazhar
I just posted the temporary patches with Joe updates in my above post.

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 5:03 pm
by rlopez
I installed both patches for Gold12 and AC9. Both are now calculating UPS shipping again. As far as correct shipping cost, not going to worry as long as the customer can now checkout. We will wait for a complete fix down the road. Also, sorry for the AC9 info on this Forum.

Thanks again Mazhar for the quick fix.

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 6:13 pm
by laramp
Thank You, it worked great!

Re: UPS ship gateway broken

Posted: Mon Jul 13, 2020 6:24 pm
by laramp
Will this patch work for
AbleCommerce for ASP.NET
VERSION: 7.0.7.14600
CommerceBuilder.UPS: 7.0.10041.0

Re: UPS ship gateway broken

Posted: Tue Jul 14, 2020 5:34 am
by mazhar
I just updated the patch list with a patch for AC 7.0.7. Please give it a try and let me know if it works.

Re: UPS ship gateway broken

Posted: Tue Jul 14, 2020 8:57 am
by laramp
Thank You, I’ll give it a try!

Re: UPS ship gateway broken

Posted: Tue Jul 14, 2020 11:28 pm
by Shopping Cart Admin
Hello All,

We've received confirmation that UPS has corrected the issue!
Thank you for the information. We were notified there was an issue with the Rate and Ship API option and that was causing the double rates. The issue has been fixed. Please try again and let me know if you are still having the same issue.