Esempio n. 1
0
 /**
  * @param Basket $basket
  *
  * @return Money
  */
 public function generate(Basket $basket)
 {
     $total = new Money(0, $basket->currency());
     foreach ($basket->products() as $product) {
         $total = $total->add($this->reconciler->delivery($product));
     }
     return $total;
 }
Esempio n. 2
0
 /**
  * @param Basket $basket
  *
  * @return array
  */
 public function products(Basket $basket)
 {
     $products = [];
     foreach ($basket->products() as $product) {
         $products[] = ['sku' => $product->sku, 'name' => $product->name, 'price' => $product->price, 'rate' => $product->rate, 'quantity' => $product->quantity, 'freebie' => $product->freebie, 'taxable' => $product->taxable, 'delivery' => $product->delivery, 'coupons' => $product->coupons, 'tags' => $product->tags, 'discounts' => $product->discounts, 'category' => $product->category, 'total_value' => $this->reconciler->value($product), 'total_discount' => $this->reconciler->discount($product), 'total_delivery' => $this->reconciler->delivery($product), 'total_tax' => $this->reconciler->tax($product), 'subtotal' => $this->reconciler->subtotal($product), 'total' => $this->reconciler->total($product)];
     }
     return $products;
 }