public function __construct( private readonly CashRounding
$rounding,
private readonly PercentageTaxRuleBuilder
$taxRuleBuilder,
private readonly TaxCalculator
$taxCalculator ) { } public function calculate(PriceCollection
$prices, PriceCollection
$shippingCosts, SalesChannelContext
$context): CartPrice
{ if ($context->
getTaxState() === CartPrice::TAX_STATE_FREE
) { return $this->
calculateNetDeliveryAmount($prices,
$shippingCosts);
} if ($context->
getTaxState() === CartPrice::TAX_STATE_GROSS
) { return $this->
calculateGrossAmount($prices,
$shippingCosts,
$context);
} return $this->
calculateNetAmount($prices,
$shippingCosts,
$context);
} /**
* Calculates the amount for a new delivery.
* `CalculatedPrice::price` and `CalculatedPrice::netPrice` are equals and taxes are empty.
*/