getCashRounding example

if ($request->attributes->has(PlatformRequest::ATTRIBUTE_CONTEXT_OBJECT)) {
            return;
        }

        if (!$this->isRequestScoped($request, ApiContextRouteScopeDependant::class)) {
            return;
        }

        $params = $this->getContextParameters($request);
        $languageIdChain = $this->getLanguageIdChain($params);

        $rounding = $this->getCashRounding($params['currencyId']);

        $context = new Context(
            $this->resolveContextSource($request),
            [],
            $params['currencyId'],
            $languageIdChain,
            $params['versionId'] ?? Defaults::LIVE_VERSION,
            $params['currencyFactory'],
            $params['considerInheritance'],
            CartPrice::TAX_STATE_GROSS,
            $rounding
        );
$customerGroup = $customerGroups->get($groupId);

        // loads tax rules based on active customer and delivery address         $taxRules = $this->getTaxRules($context);

        // detect active payment method, first check if checkout defined other payment method, otherwise validate if customer logged in, at least use shop default         $payment = $this->getPaymentMethod($options$context$salesChannel);

        // detect active delivery method, at first checkout scope, at least shop default method         $shippingMethod = $this->getShippingMethod($options$context$salesChannel);

        [$itemRounding$totalRounding] = $this->getCashRounding($currency$shippingLocation$context);

        $context = new Context(
            $context->getSource(),
            [],
            $currency->getId(),
            $context->getLanguageIdChain(),
            $context->getVersionId(),
            $currency->getFactor(),
            true,
            CartPrice::TAX_STATE_GROSS,
            $itemRounding
        );
$criteria->setTitle('context-factory::customer-group');
            /** @var CustomerGroupEntity $customerGroup */
            $customerGroup = $this->customerGroupRepository->search($criteria$base->getContext())->first() ?? $customerGroup;
        }

        // loads tax rules based on active customer and delivery address         $taxRules = $this->getTaxRules($base$customer$shippingLocation);

        // detect active payment method, first check if checkout defined other payment method, otherwise validate if customer logged in, at least use shop default         $payment = $this->getPaymentMethod($options$base$customer);

        [$itemRounding$totalRounding] = $this->getCashRounding($base$shippingLocation);

        $context = new Context(
            $base->getContext()->getSource(),
            [],
            $base->getCurrencyId(),
            $base->getContext()->getLanguageIdChain(),
            $base->getContext()->getVersionId(),
            $base->getCurrency()->getFactor(),
            true,
            CartPrice::TAX_STATE_GROSS,
            $itemRounding
        );
Home | Imprint | This part of the site doesn't use cookies.