case PromotionDiscountEntity::TYPE_PERCENTAGE:
if (!
$originalPriceDefinition instanceof PercentagePriceDefinition
) { throw new InvalidPriceDefinitionException((string) $discountLineItem->
getLabel(),
$discountLineItem->
getReferencedId());
} $discountMaxValue = '';
if ($discountLineItem->
hasPayloadValue('maxValue'
)) { $discountMaxValue =
$discountLineItem->
getPayloadValue('maxValue'
);
} $discountAdded =
$this->
calculatePercentage($deliveries,
$originalPriceDefinition,
$context,
$discountMaxValue);
break;
case PromotionDiscountEntity::TYPE_FIXED_UNIT:
if (!
$originalPriceDefinition instanceof AbsolutePriceDefinition
) { throw new InvalidPriceDefinitionException((string) $discountLineItem->
getLabel(),
$discountLineItem->
getReferencedId());
} $discountAdded =
$this->
calculateFixedDiscount($deliveries,
$originalPriceDefinition,
$context,
$notDiscountedShippingCosts);
break;
}