Example #1
0
 public function getRates()
 {
     $rates = $this->getAllRates();
     if ($rates instanceof ShippingRateSet) {
         $result = new ShippingRateSet();
         $result->setRawResponse($rates->getRawResponse());
         foreach ($rates as $rate) {
             if (substr($rate->getServiceName(), 0, strlen($this->service)) == $this->service) {
                 $result->add($rate);
             }
         }
     } else {
         $result = $rates;
     }
     return $result;
 }
Example #2
0
 public function getRates()
 {
     $result = new ShippingRateSet();
     foreach ($this->getConfigValue('enabledServices', array()) as $key => $value) {
         $res = $this->getRate($key);
         if ($res) {
             $r = new ShippingRateResult();
             $r->setServiceName(self::$names[$key]);
             $r->setCost($res['MONETARYVALUE'], 'USD', $res['CURRENCYCODE']);
             $r->setClassName(get_class($this));
             $r->setProviderName($this->getProviderName());
             $result->add($r);
         }
     }
     $result->setRawResponse(null);
     return $result;
 }