Skip to content

Commit

Permalink
UPS Rest API: handling cases where a single service is returned by UPS (
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano committed Jun 20, 2024
1 parent dffcdb6 commit 365aece
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php
Original file line number Diff line number Diff line change
Expand Up @@ -2341,6 +2341,10 @@ protected function _parseRestResponse(string $rateResponse)
$rateResponseData = json_decode($rateResponse, true);
if (@$rateResponseData['RateResponse']['Response']['ResponseStatus']['Description'] === 'Success') {
$arr = $rateResponseData['RateResponse']['RatedShipment'] ?? [];
if (isset($arr['Service'])) {
// Handling cases where a single service is returned by UPS
$arr = [$arr];
}
$allowedMethods = explode(",", $this->getConfigData('allowed_methods') ?? '');
$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
foreach ($arr as $shipElement) {
Expand Down

0 comments on commit 365aece

Please # to comment.