|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * Copyright © Magento, Inc. All rights reserved. |
4 | | - * See COPYING.txt for license details. |
| 3 | + * Copyright 2014 Adobe |
| 4 | + * All Rights Reserved. |
5 | 5 | */ |
| 6 | +declare(strict_types=1); |
6 | 7 |
|
7 | 8 | namespace Magento\Tax\Model\Sales\Total\Quote; |
8 | 9 |
|
9 | 10 | use Magento\Customer\Api\AccountManagementInterface as CustomerAccountManagement; |
10 | 11 | use Magento\Customer\Api\Data\AddressInterfaceFactory as CustomerAddressFactory; |
11 | 12 | use Magento\Customer\Api\Data\AddressInterface as CustomerAddress; |
12 | 13 | use Magento\Customer\Api\Data\RegionInterfaceFactory as CustomerAddressRegionFactory; |
13 | | -use Magento\Framework\DataObject; |
14 | 14 | use Magento\Quote\Model\Quote\Address as QuoteAddress; |
15 | 15 | use Magento\Quote\Model\Quote\Address\Total\AbstractTotal; |
16 | 16 | use Magento\Quote\Model\Quote\Item\AbstractItem; |
17 | 17 | use Magento\Store\Model\Store; |
18 | 18 | use Magento\Tax\Api\Data\QuoteDetailsInterfaceFactory; |
19 | 19 | use Magento\Tax\Api\Data\QuoteDetailsItemInterface; |
| 20 | +use Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory; |
20 | 21 | use Magento\Tax\Api\Data\TaxClassKeyInterfaceFactory; |
21 | 22 | use Magento\Tax\Api\Data\TaxClassKeyInterface; |
22 | 23 | use Magento\Tax\Api\Data\TaxDetailsInterface; |
23 | 24 | use Magento\Tax\Api\Data\TaxDetailsItemInterface; |
24 | 25 | use Magento\Tax\Api\Data\QuoteDetailsInterface; |
25 | 26 | use Magento\Quote\Api\Data\ShippingAssignmentInterface; |
| 27 | +use Magento\Tax\Api\TaxCalculationInterface; |
26 | 28 | use Magento\Tax\Helper\Data as TaxHelper; |
27 | 29 | use Magento\Framework\App\ObjectManager; |
28 | | -use Magento\Tax\Api\Data\QuoteDetailsItemExtensionInterface; |
29 | 30 | use Magento\Tax\Api\Data\QuoteDetailsItemExtensionInterfaceFactory; |
| 31 | +use Magento\Tax\Model\Config; |
30 | 32 |
|
31 | 33 | /** |
32 | 34 | * Tax totals calculation model |
@@ -155,11 +157,11 @@ class CommonTaxCollector extends AbstractTotal |
155 | 157 | /** |
156 | 158 | * Class constructor |
157 | 159 | * |
158 | | - * @param \Magento\Tax\Model\Config $taxConfig |
159 | | - * @param \Magento\Tax\Api\TaxCalculationInterface $taxCalculationService |
| 160 | + * @param Config $taxConfig |
| 161 | + * @param TaxCalculationInterface $taxCalculationService |
160 | 162 | * @param QuoteDetailsInterfaceFactory $quoteDetailsDataObjectFactory |
161 | | - * @param \Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory $quoteDetailsItemDataObjectFactory |
162 | | - * @param \Magento\Tax\Api\Data\TaxClassKeyInterfaceFactory $taxClassKeyDataObjectFactory |
| 163 | + * @param QuoteDetailsItemInterfaceFactory $quoteDetailsItemDataObjectFactory |
| 164 | + * @param TaxClassKeyInterfaceFactory $taxClassKeyDataObjectFactory |
163 | 165 | * @param CustomerAddressFactory $customerAddressFactory |
164 | 166 | * @param CustomerAddressRegionFactory $customerAddressRegionFactory |
165 | 167 | * @param TaxHelper|null $taxHelper |
@@ -210,16 +212,27 @@ public function _resetState(): void |
210 | 212 | */ |
211 | 213 | public function mapAddress(QuoteAddress $address) |
212 | 214 | { |
213 | | - $customerAddress = $this->customerAddressFactory->create(); |
214 | | - $customerAddress->setCountryId($address->getCountryId()); |
215 | | - $customerAddress->setRegion( |
216 | | - $this->customerAddressRegionFactory->create()->setRegionId($address->getRegionId()) |
| 215 | + $region = $this->customerAddressRegionFactory->create( |
| 216 | + [ |
| 217 | + 'data' => [ |
| 218 | + 'region_id' => $address->getRegionId(), |
| 219 | + 'region_code' => $address->getRegionCode(), |
| 220 | + 'region' => $address->getRegion() |
| 221 | + ] |
| 222 | + ] |
217 | 223 | ); |
218 | | - $customerAddress->setPostcode($address->getPostcode()); |
219 | | - $customerAddress->setCity($address->getCity()); |
220 | | - $customerAddress->setStreet($address->getStreet()); |
221 | 224 |
|
222 | | - return $customerAddress; |
| 225 | + return $this->customerAddressFactory->create( |
| 226 | + [ |
| 227 | + 'data' => [ |
| 228 | + 'country_id' => $address->getCountryId(), |
| 229 | + 'region' => $region, |
| 230 | + 'postcode' => $address->getPostcode(), |
| 231 | + 'city' => $address->getCity(), |
| 232 | + 'street' => $address->getStreet() |
| 233 | + ] |
| 234 | + ] |
| 235 | + ); |
223 | 236 | } |
224 | 237 |
|
225 | 238 | /** |
|
0 commit comments