Jump to content
Latest News: (loading..)
Supertex

upsxml randomly dropping insurance

Recommended Posts

Apologies...at first I thought this had to do with insurance, but now I'm not so sure.  I tried to edit the title but can't, so...

I've noticed a few lower than normal UPS quotes lately...one of which was about half what it should be - especially with insurance.  So I started digging through the request/response log, located the actual response for the transaction, and I find this:

		<RatedPackage>
			<TransportationCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>10.49</MonetaryValue>
			</TransportationCharges>
			<ServiceOptionsCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>6.30</MonetaryValue>
			</ServiceOptionsCharges>
			<TotalCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>16.79</MonetaryValue>
			</TotalCharges>
			<Weight>1.0</Weight>
			<BillingWeight>
				<UnitOfMeasurement>
					<Code>LBS</Code>
				</UnitOfMeasurement>
				<Weight>1.0</Weight>
			</BillingWeight>
		</RatedPackage>
		<NegotiatedRates>
			<NetSummaryCharges>
				<GrandTotal>
					<CurrencyCode>USD</CurrencyCode>
					<MonetaryValue>13.61</MonetaryValue>
				</GrandTotal>
			</NetSummaryCharges>
		</NegotiatedRates>

That says this quote "should" be $13.61 (per negotiated rate), and if I go to the site, and enter the customer's address info and weight, I do indeed see $13.61.  However, this customer was only charged $7.55. 

 

$7.55 Does not show up anywhere in the entire response...I've no idea where it got this figure.  I do know that this isn't the only time this has happened.  I've caught this same type of thing a few times over the last month or so, and I have ZERO idea what's causing it.

Any ideas where to start looking for this, or what it is I'm looking for?

Edited by Supertex

Share this post


Link to post
Share on other sites

I don't know of any way that any of the UPSXML modules could do that. Do you have some other module installed that could have given the customer a lower price?

 

It looks like you are using an older version of the UPS XML module -- this one might give better results.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Nope.  Nada.  I'm at a total loss here.  I wouldn't even have noticed it, except there were some suspicions that the API was returning commercial indicators for some addresses that World Ship had flagged as residential (which turned out to be true).  And as I dug through some suspect transactions, I found some 'low' API quotes that had NOT been returned as commercial, but were significantly lower than World Ship was quoting.  So I started looking closer, and I find two orders within the last 30 days where the price my site charged the customer was not only too low, but did not exist anywhere in the XML response...not even close.

 

With one address in particular, as I created an order and went through the checkout process, I'm pretty sure I saw correct quotes on the shipping page, but when I got to the confirmation, the price was wrong by 6-7 dollars.  I had a hunch that it might have had something to do with the fact that the billing address was international (vs. domestic shipping addy) so I changed the billing address to a domestic address, and the price was right when I went back to confirmation.  However, toggling between the two billing addresses did not toggle the price.  I saw it wrong only the one time.  Once it showed up correctly, I was unable to get it to screw up again.  I chalked it up to something that was then cached, and have yet to try and replicate from another browser/machine/ip/account.

 

I'll say this much though...on the event listed above, the timestamp on the response, vs the timestamp on the order itself is ~20 min off.  It appears that the customer 'sat' on the payment page for that long before confirmation was made.  I thoroughly checked the log...that was the last response that contained that shipping address that day.  I'm half wondering if there was some sort of hack, although it seems unlikely.

Share this post


Link to post
Share on other sites

I don't see anything in the code that would do what you describe. Sorry, but I'm as puzzled as you at this point.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

K...this just happened again, but this time with other oddities:  

1) There is no listed shipping address on the order details page - at all - it's blank.  Only the account address and billing address show up.

2) The customer was allowed to choose "UPS Ground"...even though that is not an option.  UPS Standard would have been the cheapest method @ $25.86.

3) Customer was charged $10.57

 

Here is the XML request/response, address and account data withheld:

------------------------------------------
DATE AND TIME: 2017-01-03 13:29:18
UPS URL: https://onlinetools.UPS.com:443/ups.app/xml/Rate
UPS REQUEST: 
<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
	<AccessLicenseNumber>xxxxxxxxxx</AccessLicenseNumber>
	<UserId>xxxxxxxxxx</UserId>
	<Password>xxxxxxxxxxx</Password>
</AccessRequest>
<?xml version="1.0"?>
<RatingServiceSelectionRequest xml:lang="en-US">
	<Request>
		<TransactionReference>
			<CustomerContext>Rating and Service</CustomerContext>
			<XpciVersion>1.0001</XpciVersion>
		</TransactionReference>
		<RequestAction>Rate</RequestAction>
		<RequestOption>shop</RequestOption>
	</Request>
	<PickupType>
		<Code>01</Code>
	</PickupType>
	<Shipment>
		<Shipper>
			<ShipperNumber>12XX34</ShipperNumber>
			<Address>
				<City>My City</City>
				<StateProvinceCode>My State</StateProvinceCode>
				<CountryCode>US</CountryCode>
				<PostalCode>My ZIP</PostalCode>
			</Address>
		</Shipper>
		<ShipTo>
			<Address>
				<AddressLine1>Customer Street</AddressLine1>
				<City>Customer City</City>
				<StateProvinceCode>BC</StateProvinceCode>
				<CountryCode>CA</CountryCode>
				<PostalCode>Customer Post Code</PostalCode>
				<ResidentialAddressIndicator/>
			</Address>
		</ShipTo>
		<Package>
			<PackagingType>
				<Code>02</Code>
			</PackagingType>
			<PackageWeight>
				<UnitOfMeasurement>
					<Code>LBS</Code>
				</UnitOfMeasurement>
				<Weight>1</Weight>
			</PackageWeight>
			<PackageServiceOptions>
				<InsuredValue>
					<CurrencyCode>USD</CurrencyCode>
					<MonetaryValue>37.00</MonetaryValue>
				</InsuredValue>
			</PackageServiceOptions>
		</Package>
		<RateInformation>
			<NegotiatedRatesIndicator/>
		</RateInformation>
	</Shipment>
	<CustomerClassification>
		<Code>04</Code>
	</CustomerClassification>
</RatingServiceSelectionRequest>

UPS RESPONSE: 
<?xml version="1.0"?>
<RatingServiceSelectionResponse>
	<Response>
		<TransactionReference>
			<CustomerContext>Rating and Service</CustomerContext>
			<XpciVersion>1.0001</XpciVersion>
		</TransactionReference>
		<ResponseStatusCode>1</ResponseStatusCode>
		<ResponseStatusDescription>Success</ResponseStatusDescription>
	</Response>
	<RatedShipment>
		<Service>
			<Code>07</Code>
		</Service>
		<RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
		<BillingWeight>
			<UnitOfMeasurement>
				<Code>LBS</Code>
			</UnitOfMeasurement>
			<Weight>1.0</Weight>
		</BillingWeight>
		<TransportationCharges>
			<CurrencyCode>USD</CurrencyCode>
			<MonetaryValue>89.20</MonetaryValue>
		</TransportationCharges>
		<ServiceOptionsCharges>
			<CurrencyCode>USD</CurrencyCode>
			<MonetaryValue>0.00</MonetaryValue>
		</ServiceOptionsCharges>
		<TotalCharges>
			<CurrencyCode>USD</CurrencyCode>
			<MonetaryValue>89.20</MonetaryValue>
		</TotalCharges>
		<GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery>
		<ScheduledDeliveryTime>12:00 Noon</ScheduledDeliveryTime>
		<RatedPackage>
			<TransportationCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>0.00</MonetaryValue>
			</TransportationCharges>
			<ServiceOptionsCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>0.00</MonetaryValue>
			</ServiceOptionsCharges>
			<TotalCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>0.00</MonetaryValue>
			</TotalCharges>
			<Weight>1.0</Weight>
			<BillingWeight>
				<UnitOfMeasurement>
					<Code>LBS</Code>
				</UnitOfMeasurement>
				<Weight>1.0</Weight>
			</BillingWeight>
		</RatedPackage>
		<NegotiatedRates>
			<NetSummaryCharges>
				<GrandTotal>
					<CurrencyCode>USD</CurrencyCode>
					<MonetaryValue>54.57</MonetaryValue>
				</GrandTotal>
			</NetSummaryCharges>
		</NegotiatedRates>
	</RatedShipment>
	<RatedShipment>
		<Service>
			<Code>08</Code>
		</Service>
		<RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
		<BillingWeight>
			<UnitOfMeasurement>
				<Code>LBS</Code>
			</UnitOfMeasurement>
			<Weight>1.0</Weight>
		</BillingWeight>
		<TransportationCharges>
			<CurrencyCode>USD</CurrencyCode>
			<MonetaryValue>80.90</MonetaryValue>
		</TransportationCharges>
		<ServiceOptionsCharges>
			<CurrencyCode>USD</CurrencyCode>
			<MonetaryValue>0.00</MonetaryValue>
		</ServiceOptionsCharges>
		<TotalCharges>
			<CurrencyCode>USD</CurrencyCode>
			<MonetaryValue>80.90</MonetaryValue>
		</TotalCharges>
		<GuaranteedDaysToDelivery/>
		<ScheduledDeliveryTime/>
		<RatedPackage>
			<TransportationCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>0.00</MonetaryValue>
			</TransportationCharges>
			<ServiceOptionsCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>0.00</MonetaryValue>
			</ServiceOptionsCharges>
			<TotalCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>0.00</MonetaryValue>
			</TotalCharges>
			<Weight>1.0</Weight>
			<BillingWeight>
				<UnitOfMeasurement>
					<Code>LBS</Code>
				</UnitOfMeasurement>
				<Weight>1.0</Weight>
			</BillingWeight>
		</RatedPackage>
		<NegotiatedRates>
			<NetSummaryCharges>
				<GrandTotal>
					<CurrencyCode>USD</CurrencyCode>
					<MonetaryValue>50.98</MonetaryValue>
				</GrandTotal>
			</NetSummaryCharges>
		</NegotiatedRates>
	</RatedShipment>
	<RatedShipment>
		<Service>
			<Code>65</Code>
		</Service>
		<RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
		<BillingWeight>
			<UnitOfMeasurement>
				<Code>LBS</Code>
			</UnitOfMeasurement>
			<Weight>1.0</Weight>
		</BillingWeight>
		<TransportationCharges>
			<CurrencyCode>USD</CurrencyCode>
			<MonetaryValue>87.80</MonetaryValue>
		</TransportationCharges>
		<ServiceOptionsCharges>
			<CurrencyCode>USD</CurrencyCode>
			<MonetaryValue>0.00</MonetaryValue>
		</ServiceOptionsCharges>
		<TotalCharges>
			<CurrencyCode>USD</CurrencyCode>
			<MonetaryValue>87.80</MonetaryValue>
		</TotalCharges>
		<GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery>
		<ScheduledDeliveryTime/>
		<RatedPackage>
			<TransportationCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>0.00</MonetaryValue>
			</TransportationCharges>
			<ServiceOptionsCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>0.00</MonetaryValue>
			</ServiceOptionsCharges>
			<TotalCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>0.00</MonetaryValue>
			</TotalCharges>
			<Weight>1.0</Weight>
			<BillingWeight>
				<UnitOfMeasurement>
					<Code>LBS</Code>
				</UnitOfMeasurement>
				<Weight>1.0</Weight>
			</BillingWeight>
		</RatedPackage>
		<NegotiatedRates>
			<NetSummaryCharges>
				<GrandTotal>
					<CurrencyCode>USD</CurrencyCode>
					<MonetaryValue>55.29</MonetaryValue>
				</GrandTotal>
			</NetSummaryCharges>
		</NegotiatedRates>
	</RatedShipment>
	<RatedShipment>
		<Service>
			<Code>11</Code>
		</Service>
		<RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
		<BillingWeight>
			<UnitOfMeasurement>
				<Code>LBS</Code>
			</UnitOfMeasurement>
			<Weight>1.0</Weight>
		</BillingWeight>
		<TransportationCharges>
			<CurrencyCode>USD</CurrencyCode>
			<MonetaryValue>25.41</MonetaryValue>
		</TransportationCharges>
		<ServiceOptionsCharges>
			<CurrencyCode>USD</CurrencyCode>
			<MonetaryValue>0.00</MonetaryValue>
		</ServiceOptionsCharges>
		<TotalCharges>
			<CurrencyCode>USD</CurrencyCode>
			<MonetaryValue>25.41</MonetaryValue>
		</TotalCharges>
		<GuaranteedDaysToDelivery/>
		<ScheduledDeliveryTime/>
		<RatedPackage>
			<TransportationCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>0.00</MonetaryValue>
			</TransportationCharges>
			<ServiceOptionsCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>0.00</MonetaryValue>
			</ServiceOptionsCharges>
			<TotalCharges>
				<CurrencyCode>USD</CurrencyCode>
				<MonetaryValue>0.00</MonetaryValue>
			</TotalCharges>
			<Weight>1.0</Weight>
			<BillingWeight>
				<UnitOfMeasurement>
					<Code>LBS</Code>
				</UnitOfMeasurement>
				<Weight>1.0</Weight>
			</BillingWeight>
		</RatedPackage>
		<NegotiatedRates>
			<NetSummaryCharges>
				<GrandTotal>
					<CurrencyCode>USD</CurrencyCode>
					<MonetaryValue>25.03</MonetaryValue>
				</GrandTotal>
			</NetSummaryCharges>
		</NegotiatedRates>
	</RatedShipment>
</RatingServiceSelectionResponse>
------------------------------------------

Again, the customer was charged $10.57.  My handling fee is 3.3%.  None of these quotes are anywhere near what he was charged.  However...I did notice that the first USPS method listed below the UPS options (First Class Package International) was 10.50...

 

After seeing that, I looked back at the order in my original post, and found the same similarity:  He was charged $7.55 - when his lowest UPS quote would have been 13.61...and the USPS Priority Mail was $7.30.

 

Could there be a bug with the method selection screen that allows the first UPS name with the first USPS price?  I know I'm grasping at straws here and the figures aren't exact, but so far that's the only thing I have to look at.

 

I don't suppose there's a way to log all variables at or just before checkout?

Share this post


Link to post
Share on other sites

I would suspect a problem with the shipping modules if the USPS cost was exactly what the customer was charged, but it's only close. I don't see a way to get those numbers from the quotes.

 

Were the orders paid through Paypal, with default shipping costs set up in Paypal? I've seen that before.

 

There is no stock code to log the variables in osCommerce. You would have to insert some code to log or mail you the values. You could use something like this:

      $error_message = var_export( $_SESSION, true );
      $to_email_address = STORE_OWNER_EMAIL_ADDRESS;
      $to_name = STORE_NAME . " Admin";
      $email_subject = "*** Session Log *** for " . STORE_NAME;
      $from_email_name = "Admin";
      $from_email_address = STORE_OWNER_EMAIL_ADDRESS;
    
      tep_mail ( $to_name, $to_email_address, $email_subject, $error_message, $from_email_name, $from_email_address );

I would add that to the top of checkout_payment, just after

  $total_count = $cart->count_contents();

or somewhere around there. That should give you lots of information about the order, including what the customer selected for shipping and the cost.

 

As usual, that was untested code, so I would try it on a test site before borking the live site.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

@@kymation

 

I figured out at least one way this is occurring.  Keep in mind 2 things: 1) It's known (and stated) that all my UPS shipments are insured.  The module is set to include insurance.  2)UPS is insured up to $100 as a base.

 

If a guy was to create a cart, move through checkout, and land on the confirmation page with a $90 order, figures out that he needs a larger quantity (or has figured out how this works and wants to get an insured shipment but only pay base shipping)...

 

If you either click the products section 'edit', or 'View Cart', change the quantity, and then hit the BACK button instead of the 'checkout' button...you get a browser timeout...click resubmit, and boom.  You have the increased quantity, which drove the cart price over the base-insured value of $100, but because there was no landing on the shipping page, no new quote was pulled.

 

In a nutshell, the cart quantities can be edited without limit, without any update to shipping.  This has the potential to amount to a very large disparity in shipping charged vs. shipping cost.

  

What can be done to avoid this?

Share this post


Link to post
Share on other sites

If this consistently works, this is actually a bug in osCommerce. I would raise the issue with Harald, noting the version of osC that you are using.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

@@Supertex It looks like the following high-severity fix for v2.3.3 (August 2012) is related:

 

https://library.oscommerce.com/Online&en&oscom_2_3&release_notes&v2_3_3#upg23

 

The normal behaviour is the reload of the checkout confirmation page redirects the customer to the start of the checkout procedure again at the checkout shipping page, due to the cart ID being changed.

 

This is the bug report:

 

http://forums.oscommerce.com/tracker/issue-473-improve-shopping-cart-id-detection/


:heart:, osCommerce

Share this post


Link to post
Share on other sites

@@John W

 

What version are you running?  I'm 2.3.1 and even with the fixes @@Harald Ponce de Leon noted, I get the same result:

 

After logging in...

 

1) Create basket with subtotal under $100.

2) Begin checkout

3) Select "UPS Ground" & continue

4) Choose payment method & continue

5) Click "view cart" or "edit" (in products section of checkout confirmation)

6) Increase quantity to surpass $100 & update

7) Hit browser 'back' button twice & 'confirm resubmission'...refresh page.

 

This lands me back on Order Confirmation page - quantities updated, but shipping remains consistent with previous quantity.

 

In fact...  after going through the steps above, I can clear the cart completely, log out, log back in, create an entirely new cart, and then instead of clicking 'checkout', I can modify the url to point to checkout_payment.php, hit enter, and it skips right over checkout shipping, and takes me to payment.  I can select payment, and move ahead to checkout confirmation and checkout with the prior cart's shipping price.

 

Seems like I need to have something that clears the shipping variables entirely whenever the "update quantity" button is hit, or anytime a new product is added.  

Share this post


Link to post
Share on other sites

I've added:

 

tep_session_unregister ('shipping');

 

to the start of shopping_cart.php, and that seems to have fixed the problem, except now I can still add products from the list, instead of the product page, and do the same thing.

 

Is there a way to monitor quantities or product count, and clear 'shipping' if either changes?

Edited by Supertex

Share this post


Link to post
Share on other sites

Try adding your

tep_session_unregister ('shipping');

to the action processing part of application_top.php. Add that line to the 'update_product', 'add_product', 'remove_product', 'buy_now', and 'cust_order' cases, just before the redirect. That should cover all the ways of adding or changing products. I think.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Try adding your

tep_session_unregister ('shipping');

to the action processing part of application_top.php. Add that line to the 'update_product', 'add_product', 'remove_product', 'buy_now', and 'cust_order' cases, just before the redirect. That should cover all the ways of adding or changing products. I think.

 

Regards

Jim

 

This seems to have fixed the problem entirely.  Thank you Jim...yet again.

Share this post


Link to post
Share on other sites

Glad to hear that worked. Another bit of code to add to my bag of tricks.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Still having issues with UPS dropping insurance, and this time it's not a customer playing around with navigation...at least not that I can find.

 I've combed over the UPSXML.log and at least part of this appears to be a hiccup at UPS.  I've got log entries for the same customer, 9 seconds apart, that ONLY differ in the negotiated rates price for the various services.  Everything else - account info, delivery address, cart value, service options charges, transportation charges, etc., is the exact same.  It's just that one quote has insurance added, and one does not.

Any thoughts on this?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×