Skip to content

Commit

Permalink
1.1.51 Release (#166)
Browse files Browse the repository at this point in the history
* 1.1.51 Release
  • Loading branch information
agorbivskyi authored Sep 12, 2024
1 parent d2e5320 commit fcff8bb
Show file tree
Hide file tree
Showing 19 changed files with 1,996 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/quality-patches",
"description": "Provides quality patches for AdobeCommerce & Magento OpenSource",
"type": "magento2-component",
"version": "1.1.50",
"version": "1.1.51",
"license": "proprietary",
"repositories": {
"repo": {
Expand Down
2 changes: 1 addition & 1 deletion patches-info.json

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions patches/commerce/ACSD-60326_2.4.6-p2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/vendor/magento/module-rma-graph-ql/etc/graphql/di.xml b/vendor/magento/module-rma-graph-ql/etc/graphql/di.xml
index 2a5dde8a5600..331192ac2f0f 100644
--- a/vendor/magento/module-rma-graph-ql/etc/graphql/di.xml
+++ b/vendor/magento/module-rma-graph-ql/etc/graphql/di.xml
@@ -25,7 +25,7 @@
<item name="rejected_on_item" xsi:type="string">partially_rejected</item>
<item name="denied" xsi:type="string">denied</item>
<item name="closed" xsi:type="string">closed</item>
- <item name="processed_closed" xsi:type="string">processed_closed</item>
+ <item name="processed_and_closed" xsi:type="string">processed_closed</item>
</item>
<item name="ReturnItemStatus" xsi:type="array">
<item name="pending" xsi:type="string">pending</item>
236 changes: 236 additions & 0 deletions patches/os/ACSD-57872_2.4.6-p1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
diff --git a/vendor/magento/module-checkout/Model/AddressComparator.php b/vendor/magento/module-checkout/Model/AddressComparator.php
index c285f15e4e40..f47bab2ba6a4 100644
--- a/vendor/magento/module-checkout/Model/AddressComparator.php
+++ b/vendor/magento/module-checkout/Model/AddressComparator.php
@@ -43,7 +43,7 @@ public function isEqual(?AddressInterface $address1, ?AddressInterface $address2
(int)$address2->getCustomerAddressId());
} else {
$addressKeys = array_intersect_key($address1->getData(), $address2->getData());
- $removeKeys = ['address_type', 'region_code', 'save_in_address_book'];
+ $removeKeys = ['address_type', 'region_code', 'save_in_address_book', 'customer_address_id'];
$addressKeys = array_diff_key($addressKeys, array_flip($removeKeys));

$address1Data = array_intersect_key($address1->getData(), $addressKeys);
diff --git a/vendor/magento/module-checkout/Model/PaymentInformationManagement.php b/vendor/magento/module-checkout/Model/PaymentInformationManagement.php
index 41867d3c8350..2913622e4abd 100644
--- a/vendor/magento/module-checkout/Model/PaymentInformationManagement.php
+++ b/vendor/magento/module-checkout/Model/PaymentInformationManagement.php
@@ -10,11 +10,15 @@
use Magento\Checkout\Api\PaymentProcessingRateLimiterInterface;
use Magento\Checkout\Api\PaymentSavingRateLimiterInterface;
use Magento\Customer\Api\AddressRepositoryInterface;
+use Magento\Customer\Api\Data\AddressInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Exception\LocalizedException;
use Magento\Quote\Api\CartRepositoryInterface;
+use Magento\Quote\Api\Data\AddressInterface as QuoteAddressInterface;
+use Magento\Quote\Api\Data\PaymentInterface;
use Magento\Quote\Model\Quote;
+use Magento\Quote\Model\Quote\Address;
use Psr\Log\LoggerInterface;

/**
@@ -137,8 +141,8 @@ public function __construct(
*/
public function savePaymentInformationAndPlaceOrder(
$cartId,
- \Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
- \Magento\Quote\Api\Data\AddressInterface $billingAddress = null
+ PaymentInterface $paymentMethod,
+ QuoteAddressInterface $billingAddress = null
) {
$this->paymentRateLimiter->limit();
try {
@@ -175,8 +179,8 @@ public function savePaymentInformationAndPlaceOrder(
*/
public function savePaymentInformation(
$cartId,
- \Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
- \Magento\Quote\Api\Data\AddressInterface $billingAddress = null
+ PaymentInterface $paymentMethod,
+ QuoteAddressInterface $billingAddress = null
) {
if (!$this->saveRateLimiterDisabled) {
try {
@@ -196,6 +200,7 @@ public function savePaymentInformation(
//It's necessary to verify the price rules with the customer data
$billingAddress->setCustomerId($customerId);
}
+ $this->updateCustomerBillingAddressId($quote, $billingAddress);
$quote->removeAddress($quote->getBillingAddress()->getId());
$quote->setBillingAddress($billingAddress);
$quote->setDataChanges(true);
@@ -240,18 +245,12 @@ private function processShippingAddress(Quote $quote): void
$shippingAddress->setSameAsBilling(1);
}
// Save new address in the customer address book and set it id for billing and shipping quote addresses.
- if ($shippingAddress->getSameAsBilling() && $shippingAddress->getSaveInAddressBook()) {
+ if ($shippingAddress->getSameAsBilling() &&
+ $shippingAddress->getSaveInAddressBook() &&
+ !$shippingAddress->getCustomerAddressId()
+ ) {
$shippingAddressData = $shippingAddress->exportCustomerAddress();
- $customer = $quote->getCustomer();
- $hasDefaultBilling = (bool)$customer->getDefaultBilling();
- $hasDefaultShipping = (bool)$customer->getDefaultShipping();
- if (!$hasDefaultShipping) {
- //Make provided address as default shipping address
- $shippingAddressData->setIsDefaultShipping(true);
- if (!$hasDefaultBilling && !$billingAddress->getSaveInAddressBook()) {
- $shippingAddressData->setIsDefaultBilling(true);
- }
- }
+ $this->saveAddressesAsDefault($quote, $shippingAddressData, $billingAddress);
$shippingAddressData->setCustomerId($quote->getCustomerId());
$this->addressRepository->save($shippingAddressData);
$quote->addCustomerAddress($shippingAddressData);
@@ -260,4 +259,47 @@ private function processShippingAddress(Quote $quote): void
$billingAddress->setCustomerAddressId($shippingAddressData->getId());
}
}
+
+ /**
+ * Update customer billing address ID if the address is the same as the quote billing address.
+ *
+ * @param Quote $quote
+ * @param QuoteAddressInterface $billingAddress
+ * @return void
+ */
+ private function updateCustomerBillingAddressId(Quote $quote, QuoteAddressInterface $billingAddress): void
+ {
+ $quoteBillingAddress = $quote->getBillingAddress();
+ if (!$billingAddress->getCustomerAddressId() &&
+ $quoteBillingAddress->getCustomerAddressId() &&
+ $this->addressComparator->isEqual($billingAddress, $quoteBillingAddress)
+ ) {
+ $billingAddress->setCustomerAddressId($quoteBillingAddress->getCustomerAddressId());
+ }
+ }
+
+ /**
+ * Save addresses as default shipping/ billing if they are not set yet.
+ *
+ * @param Quote $quote
+ * @param AddressInterface $shippingAddressData
+ * @param Address $billingAddress
+ * @return void
+ */
+ private function saveAddressesAsDefault(
+ Quote $quote,
+ AddressInterface $shippingAddressData,
+ Address $billingAddress
+ ): void {
+ $customer = $quote->getCustomer();
+ $hasDefaultBilling = (bool)$customer->getDefaultBilling();
+ $hasDefaultShipping = (bool)$customer->getDefaultShipping();
+ if (!$hasDefaultShipping) {
+ //Make provided address as default shipping address
+ $shippingAddressData->setIsDefaultShipping(true);
+ if (!$hasDefaultBilling && !$billingAddress->getSaveInAddressBook()) {
+ $shippingAddressData->setIsDefaultBilling(true);
+ }
+ }
+ }
}
diff --git a/vendor/magento/module-checkout/Model/ShippingInformationManagement.php b/vendor/magento/module-checkout/Model/ShippingInformationManagement.php
index f08c48c55efa..0bb025508aee 100644
--- a/vendor/magento/module-checkout/Model/ShippingInformationManagement.php
+++ b/vendor/magento/module-checkout/Model/ShippingInformationManagement.php
@@ -102,6 +102,11 @@ class ShippingInformationManagement implements ShippingInformationManagementInte
*/
private $shippingFactory;

+ /**
+ * @var AddressComparatorInterface
+ */
+ private $addressComparator;
+
/**
* @param PaymentMethodManagementInterface $paymentMethodManagement
* @param PaymentDetailsFactory $paymentDetailsFactory
@@ -115,6 +120,7 @@ class ShippingInformationManagement implements ShippingInformationManagementInte
* @param CartExtensionFactory|null $cartExtensionFactory
* @param ShippingAssignmentFactory|null $shippingAssignmentFactory
* @param ShippingFactory|null $shippingFactory
+ * @param AddressComparatorInterface|null $addressComparator
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
@@ -129,7 +135,8 @@ public function __construct(
TotalsCollector $totalsCollector,
CartExtensionFactory $cartExtensionFactory = null,
ShippingAssignmentFactory $shippingAssignmentFactory = null,
- ShippingFactory $shippingFactory = null
+ ShippingFactory $shippingFactory = null,
+ ?AddressComparatorInterface $addressComparator = null,
) {
$this->paymentMethodManagement = $paymentMethodManagement;
$this->paymentDetailsFactory = $paymentDetailsFactory;
@@ -146,6 +153,8 @@ public function __construct(
->get(ShippingAssignmentFactory::class);
$this->shippingFactory = $shippingFactory ?: ObjectManager::getInstance()
->get(ShippingFactory::class);
+ $this->addressComparator = $addressComparator
+ ?? ObjectManager::getInstance()->get(AddressComparatorInterface::class);
}

/**
@@ -168,7 +177,7 @@ public function saveAddressInformation(

$address = $addressInformation->getShippingAddress();
$this->validateAddress($address);
-
+ $this->updateCustomerShippingAddressId($quote, $address);
if (!$address->getCustomerAddressId()) {
$address->setCustomerAddressId(null);
}
@@ -176,6 +185,7 @@ public function saveAddressInformation(
try {
$billingAddress = $addressInformation->getBillingAddress();
if ($billingAddress) {
+ $this->updateCustomerBillingAddressId($quote, $billingAddress);
if (!$billingAddress->getCustomerAddressId()) {
$billingAddress->setCustomerAddressId(null);
}
@@ -293,4 +303,39 @@ private function prepareShippingAssignment(
$cartExtension->setShippingAssignments([$shippingAssignment]);
return $quote->setExtensionAttributes($cartExtension);
}
+
+ /**
+ * Update customer shipping address ID if the address is the same as the quote shipping address.
+ *
+ * @param Quote $quote
+ * @param AddressInterface $address
+ * @return void
+ */
+ private function updateCustomerShippingAddressId(Quote $quote, AddressInterface $address): void
+ {
+ $quoteShippingAddress = $quote->getShippingAddress();
+ if (!$address->getCustomerAddressId() &&
+ $quoteShippingAddress->getCustomerAddressId() &&
+ $this->addressComparator->isEqual($address, $quoteShippingAddress)
+ ) {
+ $address->setCustomerAddressId($quoteShippingAddress->getCustomerAddressId());
+ }
+ }
+
+ /**
+ * Update customer billing address ID if the address is the same as the quote billing address.
+ *
+ * @param Quote $quote
+ * @param AddressInterface $billingAddress
+ * @return void
+ */
+ private function updateCustomerBillingAddressId(Quote $quote, AddressInterface $billingAddress): void
+ {
+ $quoteBillingAddress = $quote->getBillingAddress();
+ if ($quoteBillingAddress->getCustomerAddressId() &&
+ $this->addressComparator->isEqual($billingAddress, $quoteBillingAddress)
+ ) {
+ $billingAddress->setCustomerAddressId($quoteBillingAddress->getCustomerAddressId());
+ }
+ }
}

17 changes: 17 additions & 0 deletions patches/os/ACSD-59786_2.4.6-p3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/vendor/magento/module-quote-graph-ql/Model/Resolver/MaskedCartId.php b/vendor/magento/module-quote-graph-ql/Model/Resolver/MaskedCartId.php
index c607c77659dc0..ffbcfe8db8e2e 100644
--- a/vendor/magento/module-quote-graph-ql/Model/Resolver/MaskedCartId.php
+++ b/vendor/magento/module-quote-graph-ql/Model/Resolver/MaskedCartId.php
@@ -95,11 +95,7 @@ private function getQuoteMaskId(int $quoteId): string
*/
private function ensureQuoteMaskExist(int $quoteId): string
{
- try {
- $maskedId = $this->quoteIdToMaskedQuoteId->execute($quoteId);
- } catch (NoSuchEntityException $e) {
- $maskedId = '';
- }
+ $maskedId = $this->quoteIdToMaskedQuoteId->execute($quoteId);
if ($maskedId === '') {
$quoteIdMask = $this->quoteIdMaskFactory->create();
$quoteIdMask->setQuoteId($quoteId);
39 changes: 39 additions & 0 deletions patches/os/ACSD-59967_2.4.4-p3.patch

Large diffs are not rendered by default.

Loading

0 comments on commit fcff8bb

Please sign in to comment.