taxIdParameterIsMissing example

private readonly GrossPriceCalculator $grossCalculator
    ) {
    }

    #[Route(path: 'api/_action/calculate-price', name: 'api.action.calculate-price', methods: ['POST'])]     public function calculate(Request $request, Context $context): JsonResponse
    {
        if (!$request->request->has('price')) {
            throw CartException::priceParameterIsMissing();
        }
        if (!$request->request->has('taxId')) {
            throw CartException::taxIdParameterIsMissing();
        }

        $taxId = (string) $request->request->get('taxId');
        $price = (float) $request->request->get('price');
        $quantity = $request->request->getInt('quantity', 1);
        $output = (string) $request->request->get('output', 'gross');
        $preCalculated = $request->request->getBoolean('calculated', true);

        $taxes = $this->taxRepository->search(new Criteria([$taxId])$context);
        $tax = $taxes->get($taxId);
        if (!$tax instanceof TaxEntity) {
            
Home | Imprint | This part of the site doesn't use cookies.