/** * {@inheritdoc} */ public function getZone() { if ($this->settings->has('default_tax_zone')) { return $this->settings->get('default_tax_zone'); } return null; }
/** * {@inheritdoc} */ public function isGranted($permissionCode) { if (null === $this->settings) { $this->settings = $this->settingsManager->loadSettings('sylius_security'); } if (false === $this->settings->get('enabled')) { return true; } return $this->authorizationChecker->isGranted($permissionCode); }
/** * {@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); }