@@ -24,6 +24,7 @@ fn cart_lines_discounts_generate_run(
2424 let has_order_discount_class = input
2525 . discount
2626 . discount_classes
27+ <<<<<<< HEAD
2728 . contains( & input:: DiscountClass :: ORDER ) ;
2829 let has_product_discount_class = input
2930 . discount
@@ -32,23 +33,46 @@ fn cart_lines_discounts_generate_run(
3233
3334 if !has_order_discount_class && !has_product_discount_class {
3435 return Ok ( output:: CartLinesDiscountsGenerateRunResult { operations : vec ! [ ] } ) ;
36+ =======
37+ . contains ( & DiscountClass :: ORDER ) ;
38+ let has_product_discount_class = input
39+ . discount
40+ . discount_classes
41+ . contains ( & DiscountClass :: PRODUCT ) ;
42+
43+ if !has_order_discount_class && !has_product_discount_class {
44+ return Ok ( CartLinesDiscountsGenerateRunResult { operations : vec ! [ ] } ) ;
45+ >>>>>>> c85625f ( Update file names)
3546 }
3647
3748 let mut operations = vec ! [ ] ;
3849
3950 // Check if the discount has the ORDER class
4051 if has_order_discount_class {
52+ <<<<<<< HEAD
4153 operations. push( output:: CartOperation :: OrderDiscountsAdd (
4254 output:: OrderDiscountsAddOperation {
4355 selection_strategy : output:: OrderDiscountSelectionStrategy :: FIRST ,
4456 candidates: vec![ output:: OrderDiscountCandidate {
4557 targets: vec![ output:: OrderDiscountCandidateTarget :: OrderSubtotal (
4658 output:: OrderSubtotalTarget {
59+ =======
60+ operations. push( CartOperation :: OrderDiscountsAdd (
61+ OrderDiscountsAddOperation {
62+ selection_strategy: OrderDiscountSelectionStrategy :: FIRST ,
63+ candidates: vec![ OrderDiscountCandidate {
64+ targets: vec![ OrderDiscountCandidateTarget :: OrderSubtotal (
65+ OrderSubtotalTarget {
66+ >>>>>>> c85625f ( Update file names)
4767 excluded_cart_line_ids: vec![ ] ,
4868 } ,
4969 ) ] ,
5070 message: Some ( "10% OFF ORDER" . to_string( ) ) ,
71+ <<<<<<< HEAD
5172 value: output:: OrderDiscountCandidateValue :: Percentage ( output:: Percentage {
73+ =======
74+ value: OrderDiscountCandidateValue :: Percentage ( Percentage {
75+ >>>>>>> c85625f ( Update file names)
5276 value: Decimal ( 10.0 ) ,
5377 } ) ,
5478 conditions: None ,
@@ -60,6 +84,7 @@ fn cart_lines_discounts_generate_run(
6084
6185 // Check if the discount has the PRODUCT class
6286 if has_product_discount_class {
87+ <<<<<<< HEAD
6388 operations. push( output:: CartOperation :: ProductDiscountsAdd (
6489 output:: ProductDiscountsAddOperation {
6590 selection_strategy: output:: ProductDiscountSelectionStrategy :: FIRST ,
@@ -72,6 +97,18 @@ fn cart_lines_discounts_generate_run(
7297 ) ] ,
7398 message: Some ( "20% OFF PRODUCT" . to_string( ) ) ,
7499 value: output:: ProductDiscountCandidateValue :: Percentage ( output:: Percentage {
100+ =======
101+ operations. push( CartOperation :: ProductDiscountsAdd (
102+ ProductDiscountsAddOperation {
103+ selection_strategy: ProductDiscountSelectionStrategy :: FIRST ,
104+ candidates: vec![ ProductDiscountCandidate {
105+ targets: vec![ ProductDiscountCandidateTarget :: CartLine ( CartLineTarget {
106+ id: max_cart_line. id. clone( ) ,
107+ quantity: None ,
108+ } ) ] ,
109+ message: Some ( "20% OFF PRODUCT" . to_string( ) ) ,
110+ value: ProductDiscountCandidateValue :: Percentage ( Percentage {
111+ >>>>>>> c85625f ( Update file names)
75112 value: Decimal ( 20.0 ) ,
76113 } ) ,
77114 associated_discount_code: None ,
@@ -80,5 +117,9 @@ fn cart_lines_discounts_generate_run(
80117 ) ) ;
81118 }
82119
120+ <<<<<<< HEAD
83121 Ok ( output:: CartLinesDiscountsGenerateRunResult { operations } )
122+ =======
123+ Ok ( CartLinesDiscountsGenerateRunResult { operations } )
124+ >>>>>>> c85625f ( Update file names)
84125}
0 commit comments