Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
[*] MO : Use UPS Negotiated Rates in upscarrier module if available
Browse files Browse the repository at this point in the history
  • Loading branch information
furnathan committed Jul 15, 2015
1 parent c474aa7 commit 46af8ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions upscarrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,12 @@ public function getUpsShippingCost($wsParams)

// Return results
if (isset ($resultTab['RATINGSERVICESELECTIONRESPONSE']['RESPONSE']['RESPONSESTATUSDESCRIPTION']) && $resultTab['RATINGSERVICESELECTIONRESPONSE']['RESPONSE']['RESPONSESTATUSDESCRIPTION'] == 'Success')
return array('connect' => true, 'cost' => $resultTab['RATINGSERVICESELECTIONRESPONSE']['RATEDSHIPMENT']['TOTALCHARGES']['MONETARYVALUE'] * $conversionRate);
{
if (isset($resultTab['RATINGSERVICESELECTIONRESPONSE']['RATEDSHIPMENT']['NEGOTIATEDRATES']))
return array('connect' => true, 'cost' => $resultTab['RATINGSERVICESELECTIONRESPONSE']['RATEDSHIPMENT']['NEGOTIATEDRATES']['NETSUMMARYCHARGES']['GRANDTOTAL']['MONETARYVALUE'] * $conversionRate);
else
return array('connect' => true, 'cost' => $resultTab['RATINGSERVICESELECTIONRESPONSE']['RATEDSHIPMENT']['TOTALCHARGES']['MONETARYVALUE'] * $conversionRate);
}

if (isset($resultTab['RATINGSERVICESELECTIONRESPONSE']['RESPONSE']['ERROR']['ERRORDESCRIPTION']))
$this->_webserviceError = $resultTab['RATINGSERVICESELECTIONRESPONSE']['RESPONSE']['ERROR']['ERRORDESCRIPTION'];
Expand All @@ -1758,7 +1763,7 @@ public function sendRequest($wsParams)
'content' => $xml,
'header' => 'Content-type: application/x-www-form-urlencoded',
'timeout' => 5,
)
)
);
$context = stream_context_create($opts);
$result = @file_get_contents('https://onlinetools.ups.com/ups.app/xml/Rate', false, $context);
Expand Down
3 changes: 3 additions & 0 deletions xml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
</PickupType>
<Shipment>
<Description>Rate Shopping - Domestic</Description>
<RateInformation>
<NegotiatedRatesIndicator />
</RateInformation>
<Shipper>
<ShipperNumber>[[ShipperNumber]]</ShipperNumber>
<Address>
Expand Down

0 comments on commit 46af8ba

Please sign in to comment.