Esempio n. 1
0
 /**
  * @param string $code
  * @param float $amount
  * @param string $storedCode
  * @dataProvider setBaseTotalAmountDataProvider
  */
 public function testSetBaseTotalAmount($code, $amount, $storedCode)
 {
     $result = $this->model->setBaseTotalAmount($code, $amount);
     $this->assertArrayHasKey($storedCode, $result);
     $this->assertEquals($result[$storedCode], $amount);
     $this->assertEquals($this->model->getAllBaseTotalAmounts()[$code], $amount);
     $this->assertSame($this->model, $result);
 }
Esempio n. 2
0
 /**
  * Collect grand total address amount
  *
  * @param \Magento\Quote\Model\Quote $quote
  * @param \Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment
  * @param \Magento\Quote\Model\Quote\Address\Total $total
  * @return $this
  */
 public function collect(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment, \Magento\Quote\Model\Quote\Address\Total $total)
 {
     $totals = array_sum($total->getAllTotalAmounts());
     $baseTotals = array_sum($total->getAllBaseTotalAmounts());
     $total->setGrandTotal($totals);
     $total->setBaseGrandTotal($baseTotals);
     return $this;
 }