3
3
* Copyright 2014 Adobe
4
4
* All Rights Reserved.
5
5
*/
6
-
7
6
namespace Magento \Tax \Model \Sales \Total \Quote ;
8
7
9
8
use Magento \Customer \Api \AccountManagementInterface as CustomerAccountManagement ;
10
9
use Magento \Customer \Api \Data \AddressInterfaceFactory as CustomerAddressFactory ;
11
10
use Magento \Customer \Api \Data \AddressInterface as CustomerAddress ;
12
- use Magento \Customer \Api \Data \RegionInterfaceFactory ;
13
11
use Magento \Customer \Api \Data \RegionInterfaceFactory as CustomerAddressRegionFactory ;
14
12
use Magento \Quote \Model \Quote \Address as QuoteAddress ;
15
13
use Magento \Quote \Model \Quote \Address \Total \AbstractTotal ;
27
25
use Magento \Tax \Api \TaxCalculationInterface ;
28
26
use Magento \Tax \Helper \Data as TaxHelper ;
29
27
use Magento \Framework \App \ObjectManager ;
30
- use Magento \Tax \Api \Data \QuoteDetailsItemExtensionInterface ;
31
28
use Magento \Tax \Api \Data \QuoteDetailsItemExtensionInterfaceFactory ;
32
29
use Magento \Tax \Model \Config ;
33
30
@@ -130,11 +127,6 @@ class CommonTaxCollector extends AbstractTotal
130
127
*/
131
128
protected $ customerAddressRegionFactory ;
132
129
133
- /**
134
- * @var RegionInterfaceFactory
135
- */
136
- private RegionInterfaceFactory $ regionFactory ;
137
-
138
130
/**
139
131
* @var \Magento\Tax\Api\Data\TaxClassKeyInterfaceFactory
140
132
*/
@@ -170,7 +162,6 @@ class CommonTaxCollector extends AbstractTotal
170
162
* @param TaxClassKeyInterfaceFactory $taxClassKeyDataObjectFactory
171
163
* @param CustomerAddressFactory $customerAddressFactory
172
164
* @param CustomerAddressRegionFactory $customerAddressRegionFactory
173
- * @param RegionInterfaceFactory $regionInterfaceFactory
174
165
* @param TaxHelper|null $taxHelper
175
166
* @param QuoteDetailsItemExtensionInterfaceFactory|null $quoteDetailsItemExtensionInterfaceFactory
176
167
* @param CustomerAccountManagement|null $customerAccountManagement
@@ -184,7 +175,6 @@ public function __construct(
184
175
\Magento \Tax \Api \Data \TaxClassKeyInterfaceFactory $ taxClassKeyDataObjectFactory ,
185
176
CustomerAddressFactory $ customerAddressFactory ,
186
177
CustomerAddressRegionFactory $ customerAddressRegionFactory ,
187
- RegionInterfaceFactory $ regionInterfaceFactory ,
188
178
TaxHelper $ taxHelper = null ,
189
179
QuoteDetailsItemExtensionInterfaceFactory $ quoteDetailsItemExtensionInterfaceFactory = null ,
190
180
?CustomerAccountManagement $ customerAccountManagement = null
@@ -196,7 +186,6 @@ public function __construct(
196
186
$ this ->quoteDetailsItemDataObjectFactory = $ quoteDetailsItemDataObjectFactory ;
197
187
$ this ->customerAddressFactory = $ customerAddressFactory ;
198
188
$ this ->customerAddressRegionFactory = $ customerAddressRegionFactory ;
199
- $ this ->regionFactory = $ regionInterfaceFactory ;
200
189
$ this ->taxHelper = $ taxHelper ?: ObjectManager::getInstance ()->get (TaxHelper::class);
201
190
$ this ->quoteDetailsItemExtensionFactory = $ quoteDetailsItemExtensionInterfaceFactory ?:
202
191
ObjectManager::getInstance ()->get (QuoteDetailsItemExtensionInterfaceFactory::class);
@@ -223,11 +212,16 @@ public function mapAddress(QuoteAddress $address)
223
212
{
224
213
$ customerAddress = $ this ->customerAddressFactory ->create ();
225
214
$ customerAddress ->setCountryId ($ address ->getCountryId ());
226
- $ customerAddress ->setRegion (
227
- $ this ->customerAddressRegionFactory ->create ()->setRegionId ($ address ->getRegionId ())
215
+ $ region = $ this ->customerAddressRegionFactory ->create (
216
+ [
217
+ 'data ' =>
218
+ [
219
+ 'region_id ' => $ address ->getRegionId (),
220
+ 'region_code ' => $ address ->getRegionCode (),
221
+ 'region ' => $ address ->getRegion ()
222
+ ]
223
+ ]
228
224
);
229
- $ region = $ this ->regionFactory ->create ()->setRegionCode ($ address ->getRegionCode ());
230
- $ region ->setRegion ($ address ->getRegion ());
231
225
$ customerAddress ->setRegion ($ region );
232
226
$ customerAddress ->setPostcode ($ address ->getPostcode ());
233
227
$ customerAddress ->setCity ($ address ->getCity ());
0 commit comments