Exemplo n.º 1
0
 /**
  * Helper function that sets up some default rules
  */
 private function setUpDefaultRules()
 {
     $this->taxClasses = $this->taxRuleFixtureFactory->createTaxClasses([['name' => 'DefaultCustomerClass', 'type' => ClassModel::TAX_CLASS_TYPE_CUSTOMER], ['name' => 'DefaultProductClass', 'type' => ClassModel::TAX_CLASS_TYPE_PRODUCT], ['name' => 'HigherProductClass', 'type' => ClassModel::TAX_CLASS_TYPE_PRODUCT]]);
     $this->taxRates = $this->taxRuleFixtureFactory->createTaxRates([['percentage' => 7.5, 'country' => 'US', 'region' => 42], ['percentage' => 7.5, 'country' => 'US', 'region' => 12]]);
     $higherRates = $this->taxRuleFixtureFactory->createTaxRates([['percentage' => 22, 'country' => 'US', 'region' => 42], ['percentage' => 10, 'country' => 'US', 'region' => 12]]);
     $this->taxRules = $this->taxRuleFixtureFactory->createTaxRules([['code' => 'Default Rule', 'customer_tax_class_ids' => [$this->taxClasses['DefaultCustomerClass'], 3], 'product_tax_class_ids' => [$this->taxClasses['DefaultProductClass']], 'tax_rate_ids' => array_values($this->taxRates), 'sort_order' => 0, 'priority' => 0], ['code' => 'Higher Rate Rule', 'customer_tax_class_ids' => [$this->taxClasses['DefaultCustomerClass'], 3], 'product_tax_class_ids' => [$this->taxClasses['HigherProductClass']], 'tax_rate_ids' => array_values($higherRates), 'sort_order' => 0, 'priority' => 0]]);
     // For cleanup
     $this->taxRates = array_merge($this->taxRates, $higherRates);
 }