/**
* @internal
*/
public function __construct( private readonly QuantityPriceCalculator
$priceCalculator,
private readonly PercentageTaxRuleBuilder
$percentageTaxRuleBuilder ) { } public function calculate(PriceCollection
$price, CalculatedPriceCollection
$prices, SalesChannelContext
$context, int
$quantity = 1
): CalculatedPrice
{ $currency =
$price->
getCurrencyPrice($context->
getCurrencyId());
if (!
$currency) { throw CartException::
invalidPriceDefinition();
} $value =
$context->
getTaxState() === CartPrice::TAX_STATE_GROSS ?
$currency->
getGross() :
$currency->
getNet();
if ($currency->
getCurrencyId() !==
$context->
getCurrencyId()) { $value *=
$context->
getCurrency()->
getFactor();
}