Skip to content

Commit

Permalink
Merge branch 'ACP2E-3472' of https://github.com/adobe-commerce-tier-4…
Browse files Browse the repository at this point in the history
…/magento2ce into PR-Tier4-VK-2025-01-09
  • Loading branch information
vkolesny committed Jan 18, 2025
2 parents 6600201 + 83aaabc commit 408f3ed
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 58 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2014 Adobe
* All Rights Reserved.
*/

/**
Expand Down Expand Up @@ -84,6 +84,11 @@ define([
$.each(elements, function (index, field) {
uiRegistry.async(formPath + '.' + field)(self.doElementBinding.bind(self));
});
let regionId = uiRegistry.async(formPath + '.region_id');

if (regionId() !== undefined) {
this.bindHandler(regionId(), self.validateDelay);
}
},

/**
Expand Down
45 changes: 29 additions & 16 deletions app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2014 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento\Tax\Model\Sales\Total\Quote;

use Magento\Customer\Api\AccountManagementInterface as CustomerAccountManagement;
use Magento\Customer\Api\Data\AddressInterfaceFactory as CustomerAddressFactory;
use Magento\Customer\Api\Data\AddressInterface as CustomerAddress;
use Magento\Customer\Api\Data\RegionInterfaceFactory as CustomerAddressRegionFactory;
use Magento\Framework\DataObject;
use Magento\Quote\Model\Quote\Address as QuoteAddress;
use Magento\Quote\Model\Quote\Address\Total\AbstractTotal;
use Magento\Quote\Model\Quote\Item\AbstractItem;
use Magento\Store\Model\Store;
use Magento\Tax\Api\Data\QuoteDetailsInterfaceFactory;
use Magento\Tax\Api\Data\QuoteDetailsItemInterface;
use Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory;
use Magento\Tax\Api\Data\TaxClassKeyInterfaceFactory;
use Magento\Tax\Api\Data\TaxClassKeyInterface;
use Magento\Tax\Api\Data\TaxDetailsInterface;
use Magento\Tax\Api\Data\TaxDetailsItemInterface;
use Magento\Tax\Api\Data\QuoteDetailsInterface;
use Magento\Quote\Api\Data\ShippingAssignmentInterface;
use Magento\Tax\Api\TaxCalculationInterface;
use Magento\Tax\Helper\Data as TaxHelper;
use Magento\Framework\App\ObjectManager;
use Magento\Tax\Api\Data\QuoteDetailsItemExtensionInterface;
use Magento\Tax\Api\Data\QuoteDetailsItemExtensionInterfaceFactory;
use Magento\Tax\Model\Config;

/**
* Tax totals calculation model
Expand Down Expand Up @@ -155,11 +157,11 @@ class CommonTaxCollector extends AbstractTotal
/**
* Class constructor
*
* @param \Magento\Tax\Model\Config $taxConfig
* @param \Magento\Tax\Api\TaxCalculationInterface $taxCalculationService
* @param Config $taxConfig
* @param TaxCalculationInterface $taxCalculationService
* @param QuoteDetailsInterfaceFactory $quoteDetailsDataObjectFactory
* @param \Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory $quoteDetailsItemDataObjectFactory
* @param \Magento\Tax\Api\Data\TaxClassKeyInterfaceFactory $taxClassKeyDataObjectFactory
* @param QuoteDetailsItemInterfaceFactory $quoteDetailsItemDataObjectFactory
* @param TaxClassKeyInterfaceFactory $taxClassKeyDataObjectFactory
* @param CustomerAddressFactory $customerAddressFactory
* @param CustomerAddressRegionFactory $customerAddressRegionFactory
* @param TaxHelper|null $taxHelper
Expand Down Expand Up @@ -210,16 +212,27 @@ public function _resetState(): void
*/
public function mapAddress(QuoteAddress $address)
{
$customerAddress = $this->customerAddressFactory->create();
$customerAddress->setCountryId($address->getCountryId());
$customerAddress->setRegion(
$this->customerAddressRegionFactory->create()->setRegionId($address->getRegionId())
$region = $this->customerAddressRegionFactory->create(
[
'data' => [
'region_id' => $address->getRegionId(),
'region_code' => $address->getRegionCode(),
'region' => $address->getRegion()
]
]
);
$customerAddress->setPostcode($address->getPostcode());
$customerAddress->setCity($address->getCity());
$customerAddress->setStreet($address->getStreet());

return $customerAddress;
return $this->customerAddressFactory->create(
[
'data' => [
'country_id' => $address->getCountryId(),
'region' => $region,
'postcode' => $address->getPostcode(),
'city' => $address->getCity(),
'street' => $address->getStreet()
]
]
);
}

/**
Expand Down
Loading

0 comments on commit 408f3ed

Please sign in to comment.