$discount =
new PromotionDiscountEntity();
$discount->
setId('D5'
);
$discount->
setType(PromotionDiscountEntity::TYPE_ABSOLUTE
);
$discount->
setValue(50
);
$discount->
setConsiderAdvancedRules(true
);
$discount->
setScope(PromotionDiscountEntity::SCOPE_CART
);
$currencyFactor = 0.3;
$ruleCollection =
new RuleCollection();
$discount->
setDiscountRules($ruleCollection);
$item =
$builder->
buildDiscountLineItem('my-Code-123',
$this->promotion,
$discount, 'C1',
$currencyFactor);
$expected =
[ 'promotionId' => 'PR-1',
'discountId' => 'D5',
'code' => 'my-Code-123',
'discountType' => 'absolute',
'value' => '50',
'maxValue' => '',
'discountScope' => 'cart',