3
3
4
4
namespace Bold \Checkout \Model \Quote \Result \Builder ;
5
5
6
+ use Bold \Checkout \Model \Quote \Result \Builder \ExtractCartTotals \UpdateProductOptionValues ;
6
7
use Magento \Framework \Api \DataObjectHelper ;
7
8
use Magento \Framework \Api \ExtensibleDataInterface ;
8
9
use Magento \Framework \Exception \NoSuchEntityException ;
@@ -43,25 +44,33 @@ class ExtractCartTotals
43
44
*/
44
45
private $ totalsConverter ;
45
46
47
+ /**
48
+ * @var UpdateProductOptionValues
49
+ */
50
+ private $ updateProductOptionValues ;
51
+
46
52
/**
47
53
* @param TotalsInterfaceFactory $totalsFactory
48
54
* @param DataObjectHelper $dataObjectHelper
49
55
* @param ItemConverter $itemConverter
50
56
* @param CouponManagementInterface $couponService
51
57
* @param TotalsConverter $totalsConverter
58
+ * @param UpdateProductOptionValues $updateProductOptionValues
52
59
*/
53
60
public function __construct (
54
61
TotalsInterfaceFactory $ totalsFactory ,
55
62
DataObjectHelper $ dataObjectHelper ,
56
63
ItemConverter $ itemConverter ,
57
64
CouponManagementInterface $ couponService ,
58
- TotalsConverter $ totalsConverter
65
+ TotalsConverter $ totalsConverter ,
66
+ UpdateProductOptionValues $ updateProductOptionValues
59
67
) {
60
68
$ this ->totalsFactory = $ totalsFactory ;
61
69
$ this ->dataObjectHelper = $ dataObjectHelper ;
62
70
$ this ->itemConverter = $ itemConverter ;
63
71
$ this ->couponService = $ couponService ;
64
72
$ this ->totalsConverter = $ totalsConverter ;
73
+ $ this ->updateProductOptionValues = $ updateProductOptionValues ;
65
74
}
66
75
67
76
/**
@@ -83,6 +92,7 @@ public function extract(CartInterface $quote): TotalsInterface
83
92
TotalsInterface::class
84
93
);
85
94
$ items = array_map ([$ this ->itemConverter , 'modelToDataObject ' ], $ quote ->getAllVisibleItems ());
95
+ $ this ->updateProductOptionValues ->updateValues ($ items );
86
96
$ calculatedTotals = $ this ->totalsConverter ->process ($ addressTotals );
87
97
$ quoteTotals ->setTotalSegments ($ calculatedTotals );
88
98
$ amount = $ quoteTotals ->getGrandTotal () - $ quoteTotals ->getTaxAmount ();
0 commit comments