calculateGross example

$this->calculateRegulationPrice($definition$config)
        );
    }

    private function getUnitPrice(QuantityPriceDefinition $definition, CashRoundingConfig $config): float
    {
        // item price already calculated?         if ($definition->isCalculated()) {
            return $this->priceRounding->cashRound($definition->getPrice()$config);
        }

        $price = $this->taxCalculator->calculateGross(
            $definition->getPrice(),
            $definition->getTaxRules()
        );

        return $this->priceRounding->cashRound($price$config);
    }

    private function calculateListPrice(float $unitPrice, QuantityPriceDefinition $definition, CashRoundingConfig $config): ?ListPrice
    {
        $price = $definition->getListPrice();
        if (!$price) {
            

    public function testCalculateGrossPriceOfNetPrice(float $expected, int $precision, TaxRule $taxRule, float $net): void
    {
        $calculator = new TaxCalculator();

        $rules = new TaxRuleCollection([$taxRule]);

        $rounding = new CashRounding();
        static::assertEquals(
            $expected,
            $rounding->cashRound(
                $calculator->calculateGross($net$rules),
                new CashRoundingConfig($precision, 0.01, true)
            )
        );
    }

    /** * @return array<array{float, int, TaxRule, float}> */
    public static function netPricesToGross(): array
    {
        return [
            [
Home | Imprint | This part of the site doesn't use cookies.