コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function getZone()
 {
     if ($this->settings->has('default_tax_zone')) {
         return $this->settings->get('default_tax_zone');
     }
     return null;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function applyTaxes(OrderInterface $order)
 {
     // Remove all tax adjustments, we recalculate everything from scratch.
     $order->removeAdjustments(AdjustmentInterface::TAX_ADJUSTMENT);
     if ($order->getItems()->isEmpty()) {
         return;
     }
     $zone = null;
     if (null !== $order->getShippingAddress()) {
         // Match the tax zone.
         $zone = $this->zoneMatcher->match($order->getShippingAddress());
     }
     if ($this->settings->has('default_tax_zone')) {
         // If address does not match any zone, use the default one.
         $zone = $zone ?: $this->settings->get('default_tax_zone');
     }
     if (null === $zone) {
         return;
     }
     $taxes = $this->processTaxes($order, $zone);
     $this->addAdjustments($taxes, $order);
 }