public function testShippingForItem()
 {
     $result = ShippingCalculator::shippingForItem($this->makeShipping(), 1, 79, 'Standard Shipping');
     $this->assertEquals(50, $result);
 }
示例#2
0
 /**
  *
  */
 private function updateShippingAndTaxes()
 {
     $this->taxRate = TaxCalculator::calculateProductTaxRate($this->getProduct()->getTax(), $this->countryId);
     $this->shippingPrice = ShippingCalculator::shippingForItem($this->getProduct()->getShipping(), $this->getQuantity(), $this->countryId, $this->shippingType);
 }
示例#3
0
 /**
  * @return array
  */
 public function shippingBreakdown()
 {
     $itemShipping = [];
     foreach ($this->items as $item) {
         $itemShipping[] = ShippingCalculator::shippingForItem($item->getShipping(), $item->getQuantity(), $this->countryId, $this->shippingType);
     }
     // order shipping
     $shipping = ['order' => $this->orderShippingPrice, 'items' => $itemShipping];
     return $shipping;
 }