UPS Rate Variation

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
corgalore
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 32
Joined: Thu Nov 08, 2012 2:57 pm

UPS Rate Variation

Post by corgalore » Wed Nov 22, 2017 8:42 am

We're seeing variations in the UPS rates displayed on the cart page. The available options will randomly drop by just changing the zip code. I'm trying to find a pattern, but it seems to be that the Ground option drops off.

For testing we're just sitting on the basket page and entering different Chicago suburb zip codes. Most of the time we get 3 out of the 4 UPS options we've configured, but sometimes the Ground option drops off.

We checked the log for those transactions and the API returned a slew of results; more than we even have configured, but just didn't display them all on the front-end.

https://www.tenpointcrossbows.com/shop/Basket.aspx

Any ideas?

meer2005
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Feb 09, 2005 2:00 pm

Re: UPS Rate Variation

Post by meer2005 » Wed Nov 22, 2017 11:54 am

Not sure if it's related, but when I tested your site it seems to not being showing ground rates at all intermittently. You may want to put a workaround in place going into Black Friday and Monday. For us, it was happening about 40% of the time. I'm sure you don't want any percentage of your customers not able to select ground rates.

See the thread here as I'm sure you'll see this error in your logs:
viewtopic.php?f=65&t=19160


To replicate this error, add something to your basket and then go to the shipping page on your checkout. If you see ground rates, refresh it a few times and you'll see ground go away. It's random and your customers are sure to be seeing this as well. Check your error logs and double check your abandoned baskets as well to monitor for any increase because of the UPS error.

BTW - Nice checkout flow!
Missing Ground Rates:
missing-ground2.JPG
Missing Ground
(33.78 KiB) Downloaded 4490 times
With Ground Rates
with-ground2.JPG
With Ground
(42.44 KiB) Downloaded 4492 times

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: UPS Rate Variation

Post by Katie » Thu Nov 23, 2017 2:07 am

You may want to put a workaround in place going into Black Friday and Monday
We are working on this now. Hopefully something soon...

Why we are only seeing this with UPS Ground is crazy! It doesn't make any sense.

Happy Thanksgiving
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

nadeem
Captain (CAPT)
Captain (CAPT)
Posts: 250
Joined: Tue Jul 31, 2012 7:23 pm

Re: UPS Rate Variation

Post by nadeem » Thu Nov 23, 2017 2:44 am

There is not an easy way to tackle this and this is really the gateway responsibility to provide consistent and reliable service. However, we can just try a work-around to re-attempt the gateway requests (if it fails) and you don't have any other option.

To make the updates open /Checkout/ShipMethod.ascx.cs file, locate the following line of code
ICollection<ShipRateQuote> rateQuotes = shippingCalculator.QuoteForShipment(shipment);
and replace with
IList<ShipGateway> UPSGateway = ShipGatewayDataSource.LoadForClassId(Misc.GetClassId(typeof(UPS)));
IList<ShipGateway> USPSgateway = ShipGatewayDataSource.LoadForClassId(Misc.GetClassId(typeof(CommerceBuilder.Shipping.Providers.USPS.USPS)));

int maxTries = 10;
bool serviceAvailable = false;
ICollection<ShipRateQuote> rateQuotes = null;
do
{
rateQuotes = shippingCalculator.QuoteForShipment(shipment);
serviceAvailable = rateQuotes.Any(s => s.Name.ToLowerInvariant().StartsWith("ups") || s.Name.ToLowerInvariant().StartsWith("usps"));
maxTries--;
}
while ((UPSGateway.Count > 0 || USPSgateway.Count > 0) && (rateQuotes.Count == 0 || maxTries > 0) && !serviceAvailable);
Also, note that it is not possible to cover all re-attempt scenarios from the front end code. You can update the maxTries flag to your desired value.

nadeem
Captain (CAPT)
Captain (CAPT)
Posts: 250
Joined: Tue Jul 31, 2012 7:23 pm

Re: UPS Rate Variation

Post by nadeem » Thu Nov 23, 2017 2:55 am

The above code need to be used only if you are not getting any of the shipping methods from UPS. If you want to retry even if there are some methods available but not all (e.g. UPS Ground in your case), then you just need to use the following code instead of the above:

Inside /Checkout/ShipMethod.ascx.cs file, Locate
ICollection<ShipRateQuote> rateQuotes = shippingCalculator.QuoteForShipment(shipment);
and replace with
IList<ShipGateway> UPSGateway = ShipGatewayDataSource.LoadForClassId(Misc.GetClassId(typeof(UPS)));

int maxTries = 10;
int requiredMethods = 3; // TOTAL NUMBER OF METHODS THAT SHOULD APPEAR IN THE LIST
ICollection<ShipRateQuote> rateQuotes = null;
do
{
rateQuotes = shippingCalculator.QuoteForShipment(shipment);
maxTries--;
}
while (UPSGateway.Count > 0 && maxTries > 0 && rateQuotes.Count < requiredMethods);
Last edited by nadeem on Sun Nov 26, 2017 11:38 pm, edited 2 times in total.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5169
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: UPS Rate Variation

Post by AbleMods » Fri Nov 24, 2017 6:40 am

Not sure I'm following how the second code fix would help. Looks like it just loops 10 times. It doesn't seem to check rateQuotes.Count to see if any rates came back.

How is that beneficial??
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

nadeem
Captain (CAPT)
Captain (CAPT)
Posts: 250
Joined: Tue Jul 31, 2012 7:23 pm

Re: UPS Rate Variation

Post by nadeem » Sun Nov 26, 2017 11:50 pm

Thanks Joe for pointing that out. I didn't applied the count check because some methods may not be applicable to a shipment. So it will not be easy to determine number of methods to display in this case. The purpose was to re-attempt gateway requests so that everything is loaded if there was some problem at gateway end.

Any ways, I just updated the fix for the rateQuotes count. In the above code (int requiredMethods = 3), if we expect to show 3 methods and there are only 2 or less methods are showing then the loop will execute otherwise we don't need to re-attempt.

This requiredMethods value need to be changed to the total number of methods we want to be shown in the list. We can also restrict the re-attempt execution on the method name but again it is not simple to cover all the scenarios.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5169
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: UPS Rate Variation

Post by AbleMods » Mon Nov 27, 2017 2:15 am

So as a test this morning I have updated two affected clients to force TLS 1.2. The changes were:

Modified web.config to set targetFramework = "4.6" in two different places
Modified global.asax to force TLS 1.2 in the Application_Start() section.

My servers have TLS 1.0 disabled, but TLS 1.1 is still enabled. I'm (very) hesitant to change SSL encryption settings on Cyber Monday, so that's going to have to wait.

I've monitored both sites and no errors in the last 60 minutes. Should have seen one by now, but I'm reserving the celebration until the end of today.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: UPS Rate Variation

Post by jmestep » Mon Nov 27, 2017 2:32 am

EDIT:
This info about Braintree is incorrect. I just noticed that the errors were dated 11/21, not today after I put in the TLS 1.2, so the merchant must have been doing something back then.


I have forced TLS1.2 in the global.asax for 4 clients, various releases of Gold, and the one I did in 11/22 has shown one error since then. So far, the others have not shown any. I did have to take it off the global.asax for an R12 SR1 client because it caused an error with Braintree, even though the Braintree gateway has not been activated, so I don't know what is going on there.
Braintree errors:
Exception of type 'Braintree.Exceptions.AuthenticationException' was thrown.
Exception: Exception of type 'Braintree.Exceptions.AuthenticationException' was thrown. Stack Trace: at Braintree.BraintreeService.ThrowExceptionIfErrorStatusCode(HttpStatusCode httpStatusCode, String message) at Braintree.BraintreeService.GetXmlResponse(String URL, String method, Request requestBody) at Braintree.BraintreeService.Post(String URL, Request requestBody) at Braintree.ClientTokenGateway.generate(ClientTokenRequest request) at CommerceBuilder.Payments.Providers.PayPalBraintree.BraintreeProvider.GenerateClientToken(Int32 userId) at AbleCommerce.ConLib.Checkout.PaymentForms.CreditCardPaymentForm.IntializeBraintreeJS(PaymentGateway braintreeGateway)
The request was aborted: Could not create SSL/TLS secure channel.
Exception: The request was aborted: Could not create SSL/TLS secure channel. Stack Trace: at Braintree.BraintreeService.GetXmlResponse(String URL, String method, Request requestBody) at Braintree.BraintreeService.Post(String URL, Request requestBody) at Braintree.ClientTokenGateway.generate(ClientTokenRequest request) at CommerceBuilder.Payments.Providers.PayPalBraintree.BraintreeProvider.GenerateClientToken(Int32 userId) at AbleCommerce.ConLib.Checkout.PaymentForms.PayPalPaymentForm.IntializeBraintreeJS(PaymentGateway braintreeGateway)
Last edited by jmestep on Mon Nov 27, 2017 4:56 am, edited 1 time in total.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: UPS Rate Variation

Post by Katie » Mon Nov 27, 2017 3:14 am

I did have to take it off the global.asax for an R12 SR1 client because it caused an error with Braintree, even though the Braintree gateway has not been activated, so I don't know what is going on there.
Are you sure the client didn't activate the Braintree gateway? We recently advertised for Braintree, so I'm hoping this change isn't causing new issues. Seems kind of unlikely.

Btw - the change to global.asax only applies to Asp.Net 4.5 with AbleCommerce Gold R8 to Gold R12 SR1 and older versions. If they are using Asp.Net 4.6, then you only need to change the web.config.

Thanks
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: UPS Rate Variation

Post by jmestep » Mon Nov 27, 2017 4:57 am

Katie,
I was mistaken. I just noticed the dates on the Braintree errors were 11/21, before I applied the TLS entry to the global.asax this morning. Sorry for the confusion.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5169
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: UPS Rate Variation

Post by AbleMods » Mon Nov 27, 2017 9:28 am

End of day report: Both sites have a single UPS error. No other errors reported the entire day.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

ChipWV
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 87
Joined: Tue Feb 03, 2009 12:51 pm

Re: UPS Rate Variation

Post by ChipWV » Mon Nov 27, 2017 9:55 am

We have seen intermittent errors on UPS rating too. I seem to recall our customer service people saying it started at least Wednesday of last week. I'm thinking this is a UPS connectivity issue.

Hope this info helps with debugging.

Thanks
Chip

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: UPS Rate Variation

Post by Katie » Mon Nov 27, 2017 11:06 pm

We are fairly certain this is UPS making changes on their end with TLS. That means all versions of AbleCommerce Gold (except R12 SR2) will need to be updated to support TLS 1.2. Please see this doc at our help site -

http://help.ablecommerce.com/index.htm# ... LS_1.2.htm

Here is the announcement from UPS again -
UPS is committed to ensuring the most current security requirements are used with our customers when shipment data is transmitted. To help ensure your shipping data remains encrypted, the security communication protocol for interactions with web-based applications must be upgraded to TLS 1.1 or 1.2.
UPS will be making changes beginning September 1, 2017 through December 31, 2017 to support enhancing our security. During this time, you may see intermittent failures for transactions using TLS1.0 or earlier.
The code work-arounds posted above were for emergency use, because this all started happening days before the biggest online shopping event of the year...

Thanks for the updates everyone!
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5169
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: UPS Rate Variation

Post by AbleMods » Mon Nov 27, 2017 11:16 pm

Interesting to note...
Katie wrote:must be upgraded to TLS 1.1 or 1.2
I would argue UPS's claim that they support TLS 1.1. All of my servers supported only TLS 1.1/1.2. And I have TLS 1.0 completely turned off in all respects. Yet I could not resolve the issue without forcing TLS 1.2 in global.asax.

So don't make the mistake I made and assume TLS will auto-negotiate based on what's enabled on your server. I had to explicitly make the app use TLS 1.2. Letting it use TLS 1.1 by default did not resolve the issue.

UPS needs to get their announcements to match their implementation.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: UPS Rate Variation

Post by Katie » Tue Nov 28, 2017 1:21 am

I was just about to close down the UPS System Status page, when I noticed this bit of info -
Note - To ensure stability with connectivity, please be sure your implementation is directed to the following URL: https://onlinetools.ups.com
It occurred to me that the API endpoint URL seemed different... so, I checked our default value and it is different!

We point to: https://www.ups.com/ups.app/xml/

And it apparently changed, at some point in time, to: https://onlinetools.ups.com/ups.app/xml/

Now, UPS will work with either endpoint, but if UPS says the new one is going to more reliable, then this needs to be updated on the UPS config screen.

Thanks
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
calvis
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 708
Joined: Tue Jan 27, 2004 3:57 pm
Location: Redmond, WA

Re: UPS Rate Variation

Post by calvis » Tue Nov 28, 2017 6:04 am

While I am not having some of the severe issues like others have had, but our url is pointing to the old one.

I would be interested in hearing other's feedback after making the change.
Able Customer Since 1999 Currently Running on GOLD R12 SR1 and PCI Certified.

corgalore
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 32
Joined: Thu Nov 08, 2012 2:57 pm

Re: UPS Rate Variation

Post by corgalore » Wed Nov 29, 2017 2:54 am

Well, we updated the UPS API url as suggested and now the rates have stabilized. This seems to be the solution.

Thank you!

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5169
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: UPS Rate Variation

Post by AbleMods » Wed Nov 29, 2017 3:40 am

Good to know. I've updated two of my clients this morning, will post results tomorrow.

They haven't had any errors since yesterday morning using the TLS 1.2 fix. So I'm not sure my tests will be entirely valid in this situation.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: UPS Rate Variation

Post by Katie » Thu Nov 30, 2017 1:49 am

We posted this yesterday to the help site and Dashboard feed -
http://help.ablecommerce.com/index.htm# ... r_2017.htm

Thanks everyone for contributing!

Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

Post Reply