/** @var AbsolutePriceDefinition|null $priceDefinition */
$priceDefinition =
$discount->
getPriceDefinition();
if (!
$priceDefinition instanceof AbsolutePriceDefinition
) { throw new InvalidPriceDefinitionException($discount->
getLabel(),
$discount->
getCode());
} $fixedTotalPrice =
abs($priceDefinition->
getPrice());
$affectedPrices =
$packages->
getAffectedPrices();
$discountDiff =
$this->
getTotalDiscountDiffSum($fixedTotalPrice,
$packages,
$affectedPrices);
// now calculate the correct price
// from our collected total discount price
$discountPrice =
$this->absolutePriceCalculator->
calculate( -
abs($discountDiff),
$affectedPrices,
$context );
$composition =
$this->
getCompositionItems( $discountPrice->
getTotalPrice(),