/** * Add taxes to the ship group for any tax records related to address * level gifting. * * @return self */ public function addGiftTaxesToPayload() { $giftTaxes = $this->_getAddressGiftTaxRecords(); if ($giftTaxes) { $taxContainer = $this->_getTaxContainer(); $taxIterable = $taxContainer->getTaxes(); foreach ($giftTaxes as $giftTax) { $taxPayload = $this->_payloadHelper->taxRecordToTaxPayload($giftTax, $taxIterable->getEmptyTax()); // Somewhat idiosyncratic way of adding to the iterable...required // due to the iterable currently being implemented as an SPLObjectStorage // which requires objects stored to be set as keys, not values. $taxIterable[$taxPayload] = null; } $taxContainer->setTaxes($taxIterable); } return $this; }
/** * Add a tax payload for each tax record to the container. * * @param EbayEnterprise_Tax_Model_Record[] * @param ITaxContainer * @return self */ protected function _addTaxRecordsToContainer(array $taxRecords, ITaxContainer $taxContainer) { $taxIterable = $taxContainer->getTaxes(); foreach ($taxRecords as $taxRecord) { $taxPayload = $this->_payloadHelper->taxRecordToTaxPayload($taxRecord, $taxIterable->getEmptyTax()); $taxIterable[$taxPayload] = null; } $taxContainer->getTaxes($taxIterable); return $this; }