public function setUp() { // Create a mock tax collector to provide tax duties and overall // tax request success. Constructor disabled to prevent needing // to provide dependencies. $this->_taxCollector = $this->getModelMockBuilder('ebayenterprise_tax/collector')->disableOriginalConstructor()->setMethods(['getTaxDuties', 'getTaxRequestSuccess'])->getMock(); // Valid record should not return a value for the calculation error. // Constructor disabled to prevent needing to provide dependencies. $this->_validTaxRecord = $this->getModelMockBuilder('ebayenterprise_tax/record')->disableOriginalConstructor()->setMethods(['getCalculationError'])->getMock(); // Error record should return some value for the calculation error. // Constructor disabled to prevent needing to provide dependencies. $this->_errorTaxRecord = $this->getModelMockBuilder('ebayenterprise_tax/record')->disableOriginalConstructor()->setMethods(['getCalculationError'])->getMock(); $this->_errorTaxRecord->expects($this->any())->method('getCalculationError')->will($this->returnValue('Calculation Error')); $this->_order = Mage::getModel('sales/order'); $this->_orderCreateRequest = $this->getMockForAbstractClass('eBayEnterprise\\RetailOrderManagement\\Payload\\Order\\IOrderCreateRequest', ['setTaxHasErrors']); $this->_orderCreateHandler = Mage::getModel('ebayenterprise_tax/order_create_order', ['tax_collector' => $this->_taxCollector, 'order' => $this->_order, 'order_create_request' => $this->_orderCreateRequest]); }
/** * Tnransfer data from a tax record model to a tax payload. * * @param EbayEnterprise_Tax_Model_Records * @param ITax * @return ITax */ public function taxRecordToTaxPayload(EbayEnterprise_Tax_Model_Record $taxRecord, ITax $taxPayload) { return $taxPayload->setType($taxRecord->getType())->setTaxability($taxRecord->getTaxability())->setSitus($taxRecord->getSitus())->setJurisdiction($taxRecord->getJurisdiction())->setJurisdictionLevel($taxRecord->getJurisdictionLevel())->setJurisdictionId($taxRecord->getJurisdictionId())->setImposition($taxRecord->getImposition())->setImpositionType($taxRecord->getImpositionType())->setEffectiveRate($taxRecord->getEffectiveRate())->setTaxableAmount($taxRecord->getTaxableAmount())->setCalculatedTax($taxRecord->getCalculatedTax())->setSellerRegistrationId($taxRecord->getSellerRegistrationId()); }