@@ -110,11 +110,11 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
110
110
protected $ _templateFilterFactory ;
111
111
112
112
/**
113
- * Tax class key builder
113
+ * Tax class key factory
114
114
*
115
- * @var \Magento\Tax\Api\Data\TaxClassKeyDataBuilder
115
+ * @var \Magento\Tax\Api\Data\TaxClassKeyInterfaceFactory
116
116
*/
117
- protected $ _taxClassKeyBuilder ;
117
+ protected $ _taxClassKeyFactory ;
118
118
119
119
/**
120
120
* Tax helper
@@ -124,18 +124,18 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
124
124
protected $ _taxConfig ;
125
125
126
126
/**
127
- * Quote details builder
127
+ * Quote details factory
128
128
*
129
- * @var \Magento\Tax\Api\Data\QuoteDetailsDataBuilder
129
+ * @var \Magento\Tax\Api\Data\QuoteDetailsInterfaceFactory
130
130
*/
131
- protected $ _quoteDetailsBuilder ;
131
+ protected $ _quoteDetailsFactory ;
132
132
133
133
/**
134
- * Quote details item builder
134
+ * Quote details item factory
135
135
*
136
- * @var \Magento\Tax\Api\Data\QuoteDetailsItemDataBuilder
136
+ * @var \Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory
137
137
*/
138
- protected $ _quoteDetailsItemBuilder ;
138
+ protected $ _quoteDetailsItemFactory ;
139
139
140
140
/**
141
141
* @var CustomerSession
@@ -177,10 +177,10 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
177
177
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
178
178
* @param \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory
179
179
* @param string $templateFilterModel
180
- * @param \Magento\Tax\Api\Data\TaxClassKeyDataBuilder $taxClassKeyBuilder
180
+ * @param \Magento\Tax\Api\Data\TaxClassKeyInterfaceFactory $taxClassKeyFactory
181
181
* @param Config $taxConfig
182
- * @param \Magento\Tax\Api\Data\QuoteDetailsDataBuilder $quoteDetailsBuilder
183
- * @param \Magento\Tax\Api\Data\QuoteDetailsItemDataBuilder $quoteDetailsItemBuilder
182
+ * @param \Magento\Tax\Api\Data\QuoteDetailsInterfaceFactory $quoteDetailsFactory
183
+ * @param \Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory $quoteDetailsItemFactory
184
184
* @param \Magento\Tax\Api\TaxCalculationInterface $taxCalculationService
185
185
* @param CustomerSession $customerSession
186
186
* @param PriceCurrencyInterface $priceCurrency
@@ -199,10 +199,10 @@ public function __construct(
199
199
\Magento \Framework \App \Config \ScopeConfigInterface $ scopeConfig ,
200
200
\Magento \Catalog \Model \Template \Filter \Factory $ templateFilterFactory ,
201
201
$ templateFilterModel ,
202
- \Magento \Tax \Api \Data \TaxClassKeyDataBuilder $ taxClassKeyBuilder ,
202
+ \Magento \Tax \Api \Data \TaxClassKeyInterfaceFactory $ taxClassKeyFactory ,
203
203
\Magento \Tax \Model \Config $ taxConfig ,
204
- \Magento \Tax \Api \Data \QuoteDetailsDataBuilder $ quoteDetailsBuilder ,
205
- \Magento \Tax \Api \Data \QuoteDetailsItemDataBuilder $ quoteDetailsItemBuilder ,
204
+ \Magento \Tax \Api \Data \QuoteDetailsInterfaceFactory $ quoteDetailsFactory ,
205
+ \Magento \Tax \Api \Data \QuoteDetailsItemInterfaceFactory $ quoteDetailsItemFactory ,
206
206
\Magento \Tax \Api \TaxCalculationInterface $ taxCalculationService ,
207
207
CustomerSession $ customerSession ,
208
208
PriceCurrencyInterface $ priceCurrency ,
@@ -218,10 +218,10 @@ public function __construct(
218
218
$ this ->_scopeConfig = $ scopeConfig ;
219
219
$ this ->_coreRegistry = $ coreRegistry ;
220
220
$ this ->_templateFilterModel = $ templateFilterModel ;
221
- $ this ->_taxClassKeyBuilder = $ taxClassKeyBuilder ;
221
+ $ this ->_taxClassKeyFactory = $ taxClassKeyFactory ;
222
222
$ this ->_taxConfig = $ taxConfig ;
223
- $ this ->_quoteDetailsBuilder = $ quoteDetailsBuilder ;
224
- $ this ->_quoteDetailsItemBuilder = $ quoteDetailsItemBuilder ;
223
+ $ this ->_quoteDetailsFactory = $ quoteDetailsFactory ;
224
+ $ this ->_quoteDetailsItemFactory = $ quoteDetailsItemFactory ;
225
225
$ this ->_taxCalculationService = $ taxCalculationService ;
226
226
$ this ->_customerSession = $ customerSession ;
227
227
$ this ->priceCurrency = $ priceCurrency ;
@@ -501,27 +501,29 @@ public function getTaxPrice(
501
501
$ billingAddressDataObject = $ billingAddress ->getDataModel ();
502
502
}
503
503
504
- $ item = $ this ->_quoteDetailsItemBuilder ->setQuantity (1 )
504
+ $ taxClassKey = $ this ->_taxClassKeyFactory ->create ();
505
+ $ taxClassKey ->setType (TaxClassKeyInterface::TYPE_ID )
506
+ ->setValue ($ product ->getTaxClassId ());
507
+
508
+ $ customerTaxClassKey = $ this ->_taxClassKeyFactory ->create ();
509
+ $ customerTaxClassKey ->setType (TaxClassKeyInterface::TYPE_ID )
510
+ ->setValue ($ ctc );
511
+
512
+ $ item = $ this ->_quoteDetailsItemFactory ->create ();
513
+ $ item ->setQuantity (1 )
505
514
->setCode ($ product ->getSku ())
506
515
->setShortDescription ($ product ->getShortDescription ())
507
- ->setTaxClassKey (
508
- $ this ->_taxClassKeyBuilder ->setType (TaxClassKeyInterface::TYPE_ID )
509
- ->setValue ($ product ->getTaxClassId ())
510
- ->create ()
511
- )->setTaxIncluded ($ priceIncludesTax )
516
+ ->setTaxClassKey ($ taxClassKey )
517
+ ->setIsTaxIncluded ($ priceIncludesTax )
512
518
->setType ('product ' )
513
- ->setUnitPrice ($ price )
514
- -> create ();
515
- $ quoteDetails = $ this ->_quoteDetailsBuilder
516
- ->setShippingAddress ($ shippingAddressDataObject )
519
+ ->setUnitPrice ($ price );
520
+
521
+ $ quoteDetails = $ this ->_quoteDetailsFactory -> create ();
522
+ $ quoteDetails ->setShippingAddress ($ shippingAddressDataObject )
517
523
->setBillingAddress ($ billingAddressDataObject )
518
- ->setCustomerTaxClassKey (
519
- $ this ->_taxClassKeyBuilder ->setType (TaxClassKeyInterface::TYPE_ID )
520
- ->setValue ($ ctc )
521
- ->create ()
522
- )->setItems ([$ item ])
523
- ->setCustomerId ($ this ->_customerSession ->getCustomerId ())
524
- ->create ();
524
+ ->setCustomerTaxClassKey ($ customerTaxClassKey )
525
+ ->setItems ([$ item ])
526
+ ->setCustomerId ($ this ->_customerSession ->getCustomerId ());
525
527
526
528
$ storeId = null ;
527
529
if ($ store ) {
0 commit comments