/**
  * Total all taxes associated with the current order.
  *
  * @return float
  */
 protected function totalTaxAmount()
 {
     $records = array_reduce($this->taxCollector->getTaxRecords(), function ($total, $item) {
         return $total + $item->getCalculatedTax();
     }, 0.0);
     $duties = array_reduce($this->taxCollector->getTaxDuties(), function ($total, $item) {
         return $total + $item->getAmount();
     }, 0.0);
     $fees = array_reduce($this->taxCollector->getTaxFees(), function ($total, $item) {
         return $total + $item->getAmount();
     }, 0.0);
     return $records + $duties + $fees;
 }
 /**
  * Getting tax records must always return an array, even if there are not
  * tax records to return.
  */
 public function testGetTaxRecordsAlwaysReturnsArray()
 {
     // Simulate session having no records set - returns null.
     $this->_taxSession->expects($this->any())->method('getTaxRecords')->will($this->returnValue(null));
     // When no tax records are in the session, mult still return an array.
     $this->assertSame([], $this->_taxCollector->getTaxRecords());
 }
 /**
  * Get all tax records for this address that should were applied to
  * address level gifting prices.
  *
  * @return EbayEnterprise_Tax_Model_Record[]
  */
 protected function _getAddressGiftTaxRecords()
 {
     $addressId = $this->_address->getQuoteAddressId();
     // Filter down the list of tax records to only those with a matching
     // quote address id, with a source indicating they apply to address level
     // gifting, and do not indicate a calculation error for the record.
     return array_filter($this->_taxCollector->getTaxRecords(), function ($record) use($addressId) {
         return $record->getAddressId() === $addressId && $record->getTaxSource() === EbayEnterprise_Tax_Model_Record::SOURCE_ADDRESS_GIFTING;
     });
 }