Exemplo n.º 1
0
 /**
  * Convert a rate model to a TaxRate data object
  *
  * @param TaxRuleModel $ruleModel
  * @return TaxRuleDataObject
  */
 public function createTaxRuleDataObjectFromModel(TaxRuleModel $ruleModel)
 {
     if (!is_null($ruleModel->getId())) {
         $this->taxRuleDataObjectBuilder->setId($ruleModel->getId());
     }
     if (!is_null($ruleModel->getCode())) {
         $this->taxRuleDataObjectBuilder->setCode($ruleModel->getCode());
     }
     if (!is_null($ruleModel->getCustomerTaxClasses())) {
         $this->taxRuleDataObjectBuilder->setCustomerTaxClassIds($this->_getUniqueValues($ruleModel->getCustomerTaxClasses()));
     }
     if (!is_null($ruleModel->getProductTaxClasses())) {
         $this->taxRuleDataObjectBuilder->setProductTaxClassIds($this->_getUniqueValues($ruleModel->getProductTaxClasses()));
     }
     if (!is_null($ruleModel->getRates())) {
         $this->taxRuleDataObjectBuilder->setTaxRateIds($this->_getUniqueValues($ruleModel->getRates()));
     }
     if (!is_null($ruleModel->getPriority())) {
         $this->taxRuleDataObjectBuilder->setPriority($ruleModel->getPriority());
     }
     if (!is_null($ruleModel->getPosition())) {
         $this->taxRuleDataObjectBuilder->setSortOrder($ruleModel->getPosition());
     }
     if (!is_null($ruleModel->getCalculateSubtotal())) {
         $this->taxRuleDataObjectBuilder->setCalculateSubtotal($ruleModel->getCalculateSubtotal());
     }
     return $this->taxRuleDataObjectBuilder->create();
 }
Exemplo n.º 2
0
 /**
  * Registers TaxRule Model to registry
  *
  * @param TaxRuleModel $taxRuleModel
  * @return void
  */
 public function registerTaxRule(TaxRuleModel $taxRuleModel)
 {
     $this->registry[$taxRuleModel->getId()] = $taxRuleModel;
 }