public function testShippingForItem() { $result = ShippingCalculator::shippingForItem($this->makeShipping(), 1, 79, 'Standard Shipping'); $this->assertEquals(50, $result); }
/** * */ 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); }
/** * @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; }