setCartPriceTaxes example

$response->setDeliveryTaxes([
            $this->ids->get('delivery-1') => new CalculatedTaxCollection([
                new CalculatedTax(4.0, 4.0, 4.0),
            ]),
            $this->ids->get('delivery-2') => new CalculatedTaxCollection([
                new CalculatedTax(5.0, 5.0, 5.0),
                new CalculatedTax(6.0, 6.0, 6.0),
            ]),
        ]);

        $response->setCartPriceTaxes(new CalculatedTaxCollection([
            new CalculatedTax(7.0, 7.0, 7.0),
            new CalculatedTax(8.0, 8.0, 8.0),
        ]));

        static::assertNotNull($response->getLineItemTaxes());
        static::assertCount(2, $response->getLineItemTaxes());
        static::assertArrayHasKey($this->ids->get('line-item-1')$response->getLineItemTaxes());
        static::assertArrayHasKey($this->ids->get('line-item-2')$response->getLineItemTaxes());

        static::assertEquals(new CalculatedTax(1.0, 1.0, 1.0)$response->getLineItemTaxes()[$this->ids->get('line-item-1')]->getAt(0));
        static::assertEquals(new CalculatedTax(2.0, 2.0, 2.0)$response->getLineItemTaxes()[$this->ids->get('line-item-2')]->getAt(0));
        
Home | Imprint | This part of the site doesn't use cookies.