/** * Imports a single tax type. * * @param \CommerceGuys\Tax\Model\TaxTypeInterface $taxType * The tax type. */ protected function importTaxType(ExternalTaxTypeInterface $taxType) { if ($this->taxTypeStorage->load($taxType->getId())) { return; } $values = ['id' => $taxType->getId(), 'name' => $this->t($taxType->getName()), 'compound' => $taxType->isCompound(), 'displayInclusive' => $taxType->isDisplayInclusive(), 'roundingMode' => $taxType->getRoundingMode(), 'tag' => $taxType->getTag(), 'rates' => array_keys($taxType->getRates())]; return $this->taxTypeStorage->create($values); }
/** * {@inheritdoc} */ public function resolve(TaxTypeInterface $taxType, TaxableInterface $taxable, Context $context) { foreach ($taxType->getRates() as $rate) { if ($rate->isDefault()) { return $rate; } } }