Exemplo n.º 1
0
 public function getBackupCarrierRates($rawRequest, $backupCarrierDetails)
 {
     $carrierCode = $this->retrieveBackupCarrier($backupCarrierDetails);
     if (!$carrierCode) {
         return false;
     }
     $storeId = $rawRequest->getStoreId();
     $tempEnabledCarrier = $this->tempSetCarrierEnabled($carrierCode, true, $storeId);
     $carrier = $this->shipperDataHelper->getCarrierByCode($carrierCode, $storeId);
     if (!$carrier) {
         $this->tempSetCarrierEnabled($carrierCode, false, $storeId);
         $this->shipperLogger->postInfo('Shipperhq_Shipper', 'Unable to activate backup carrier', $carrierCode);
         return false;
     }
     $result = $carrier->collectRates($rawRequest);
     $this->shipperLogger->postInfo('Shipperhq_Shipper', 'Backup carrier result: ', 'returned ' . count($result) . ' results');
     if ($tempEnabledCarrier) {
         $this->tempSetCarrierEnabled($carrierCode, false, $storeId);
     }
     return $result;
 }