Skip to content

Commit a68324b

Browse files
authored
Merge pull request #9621 from magento-gl/spartans_pr_25022025
[Spartans] BugFixes Delivery
2 parents 0ec7742 + 1da9ba6 commit a68324b

File tree

14 files changed

+409
-61
lines changed

14 files changed

+409
-61
lines changed

app/code/Magento/Customer/Model/Address.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2011 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Customer\Model;
77

@@ -371,7 +371,9 @@ public function reindex()
371371
{
372372
/** @var \Magento\Framework\Indexer\IndexerInterface $indexer */
373373
$indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID);
374-
$indexer->reindexRow($this->getCustomerId());
374+
if (!$indexer->isScheduled()) {
375+
$indexer->reindexRow($this->getCustomerId());
376+
}
375377
}
376378

377379
/**

app/code/Magento/Customer/Model/Customer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,9 @@ public function afterDeleteCommit()
11261126
*/
11271127
public function reindex()
11281128
{
1129-
$this->getIndexer()->reindexRow($this->getId());
1129+
if (!$this->getIndexer()->isScheduled()) {
1130+
$this->getIndexer()->reindexRow($this->getId());
1131+
}
11301132
}
11311133

11321134
/**

app/code/Magento/Customer/etc/di.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2013 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
@@ -593,4 +593,9 @@
593593
type="Magento\Customer\Plugin\AsyncRequestCustomerGroupAuthorization"
594594
/>
595595
</type>
596+
<virtualType name="Magento\Customer\Model\MviewAction" type="\Magento\Framework\Mview\View\BaseAction">
597+
<arguments>
598+
<argument name="indexerId" xsi:type="string">customer_grid</argument>
599+
</arguments>
600+
</virtualType>
596601
</config>
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2015 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Mview/etc/mview.xsd">
9-
<view id="customer_dummy" class="Magento\Framework\Indexer\Action\Dummy" group="indexer"/>
9+
<view id="customer_dummy" class="Magento\Customer\Model\MviewAction" group="indexer">
10+
<subscriptions>
11+
<table name="customer_entity" entity_column="entity_id" />
12+
<table name="customer_entity_datetime" entity_column="entity_id" />
13+
<table name="customer_entity_decimal" entity_column="entity_id" />
14+
<table name="customer_entity_int" entity_column="entity_id" />
15+
<table name="customer_address_entity" entity_column="parent_id" />
16+
</subscriptions>
17+
</view>
1018
</config>

app/code/Magento/GiftMessageGraphQl/Model/Resolver/Product/GiftMessage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function resolve(
3333
Field $field,
3434
$context,
3535
ResolveInfo $info,
36-
array $value = null,
37-
array $args = null
36+
?array $value = null,
37+
?array $args = null
3838
): bool {
3939
if (!isset($value['model']) || !$value['model'] instanceof ProductInterface) {
4040
throw new LocalizedException(__('The product model is not available.'));

app/code/Magento/Paypal/Controller/Express/AbstractExpress.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Paypal\Controller\Express;
77

@@ -151,6 +151,9 @@ public function __construct(
151151
protected function _initCheckout(?CartInterface $quoteObject = null)
152152
{
153153
$quote = $quoteObject ? $quoteObject : $this->_getQuote();
154+
if ($quote->getId()) {
155+
$this->_getCheckoutSession()->setPayPalQuoteId($quote->getId());
156+
}
154157
if (!$quote->hasItems() || $quote->getHasError()) {
155158
$this->getResponse()->setStatusHeader(403, '1.1', 'Forbidden');
156159
throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t initialize Express Checkout.'));
@@ -248,6 +251,9 @@ protected function _getQuote()
248251
$this->_getCheckoutSession()->replaceQuote($this->_quote);
249252
} else {
250253
$this->_quote = $this->_getCheckoutSession()->getQuote();
254+
if (!$this->_quote->getId() && $this->_getCheckoutSession()->getPayPalQuoteId()) {
255+
$this->_quote = $this->quoteRepository->get($this->_getCheckoutSession()->getPayPalQuoteId());
256+
}
251257
}
252258
}
253259
return $this->_quote;
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All rights reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Paypal\Plugin;
9+
10+
use Magento\Framework\App\RequestInterface;
11+
use Magento\Paypal\Controller\Payflow\ReturnUrl as Subject;
12+
use Magento\Paypal\Model\PayflowlinkFactory;
13+
use Magento\Sales\Model\Order;
14+
use Magento\Sales\Model\OrderFactory;
15+
use Psr\Log\LoggerInterface;
16+
17+
class PayflowSilentPost
18+
{
19+
/**
20+
* @var array
21+
*/
22+
protected array $allowedOrderStates = [
23+
Order::STATE_PROCESSING,
24+
Order::STATE_COMPLETE,
25+
Order::STATE_PAYMENT_REVIEW
26+
];
27+
28+
/**
29+
* @param RequestInterface $request
30+
* @param OrderFactory $orderFactory
31+
* @param PayflowlinkFactory $payflowlinkFactory
32+
* @param LoggerInterface $logger
33+
*/
34+
public function __construct(
35+
private readonly RequestInterface $request,
36+
private readonly OrderFactory $orderFactory,
37+
private readonly PayflowlinkFactory $payflowlinkFactory,
38+
private readonly LoggerInterface $logger,
39+
) {
40+
}
41+
42+
/**
43+
* Process payment if not already done via silent post
44+
*
45+
* @param Subject $subject
46+
* @return void
47+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
48+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
49+
*/
50+
public function beforeExecute(Subject $subject): void
51+
{
52+
$data = $this->request->getParams();
53+
if (!array_key_exists('INVNUM', $data)
54+
|| !array_key_exists('RESPMSG', $data)
55+
|| !array_key_exists('RESULT', $data)) {
56+
return;
57+
}
58+
59+
$orderId = (string)$data['INVNUM'];
60+
if (!$orderId) {
61+
return;
62+
}
63+
64+
$order = $this->orderFactory->create()->loadByIncrementId($orderId);
65+
$payment = $order->getPayment();
66+
if (in_array($order->getState(), $this->allowedOrderStates) || $payment->getLastTransId()
67+
|| trim((string)$data['RESPMSG']) !== 'Approved' || (int)$data['RESULT'] !== 0) {
68+
return;
69+
}
70+
71+
$paymentModel = $this->payflowlinkFactory->create();
72+
try {
73+
$paymentModel->process($data);
74+
} catch (\Exception $e) {
75+
$this->logger->critical($e);
76+
}
77+
}
78+
}

app/code/Magento/Paypal/etc/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,4 +291,7 @@
291291
</argument>
292292
</arguments>
293293
</type>
294+
<type name="Magento\Paypal\Controller\Payflow\ReturnUrl">
295+
<plugin name="payflow_silentpost" type="Magento\Paypal\Plugin\PayflowSilentPost"/>
296+
</type>
294297
</config>

app/design/adminhtml/Magento/backend/Magento_Customer/web/css/source/_module.less

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// /**
2-
// * Copyright © Magento, Inc. All rights reserved.
3-
// * See COPYING.txt for license details.
4-
// */
1+
/**
2+
* Copyright 2014 Adobe
3+
* All Rights Reserved.
4+
*/
55

66
.customer_form_areas_address_address_customer_address_update_modal_update_customer_address_form_loader {
77
.admin__field {
@@ -89,3 +89,26 @@
8989
}
9090
}
9191
}
92+
93+
& when (@media-target = 'all') {
94+
95+
@media all and (min-width: @screen__l) {
96+
.customer-index-edit {
97+
.page-actions-buttons {
98+
button {
99+
font-size: 1rem;
100+
}
101+
}
102+
}
103+
}
104+
105+
@media all and (min-width: @screen__xl) {
106+
.customer-index-edit {
107+
.page-actions-buttons {
108+
button {
109+
font-size: 1.6rem;
110+
}
111+
}
112+
}
113+
}
114+
}

dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionTest.php

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66

77
namespace Magento\Customer\Model\ResourceModel\Grid;
88

99
use Magento\Customer\Api\CustomerRepositoryInterface;
10-
use Magento\Customer\Api\Data\CustomerInterface;
1110
use Magento\Customer\Model\Customer;
1211
use Magento\Framework\Indexer\IndexerRegistry;
1312
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
@@ -19,59 +18,53 @@
1918
*/
2019
class CollectionTest extends TestCase
2120
{
21+
/** @var CustomerRepositoryInterface */
22+
private $customerRepository;
2223

23-
public static function setUpBeforeClass(): void
24-
{
25-
$db = Bootstrap::getInstance()
26-
->getBootstrap()
27-
->getApplication()
28-
->getDbInstance();
29-
if (!$db->isDbDumpExists()) {
30-
throw new \LogicException('DB dump does not exist.');
31-
}
32-
$db->restoreFromDbDump();
24+
/** @var \Magento\Framework\ObjectManagerInterface */
25+
private $objectManager;
3326

34-
$indexerRegistry = Bootstrap::getObjectManager()->create(IndexerRegistry::class);
35-
$indexer = $indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID);
36-
$indexer->reindexAll();
37-
parent::setUpBeforeClass();
27+
/** @var IndexerRegistry */
28+
private $indexerRegistry;
29+
30+
/** @var \Magento\Customer\Model\ResourceModel\Grid\Collection */
31+
private $targetObject;
32+
33+
protected function setUp(): void
34+
{
35+
$this->objectManager = Bootstrap::getObjectManager();
36+
$this->indexerRegistry = $this->objectManager->create(IndexerRegistry::class);
37+
$this->targetObject = $this->objectManager
38+
->create(\Magento\Customer\Model\ResourceModel\Grid\Collection::class);
39+
$this->customerRepository = $this->objectManager->create(CustomerRepositoryInterface::class);
3840
}
3941

4042
/**
41-
* Test updated data for customer grid indexer during save/update customer data(including address data)
43+
* Test updated data for customer grid indexer
4244
* in 'Update on Schedule' mode.
43-
*
44-
* Customer Grid Indexer can't work in 'Update on Schedule' mode. All data for indexer must be updated in realtime
45-
* during save/update customer data(including address data).
46-
*
47-
* @magentoDataFixture Magento/Customer/_files/customer_grid_indexer_enabled_update_on_schedule.php
4845
* @magentoDataFixture Magento/Customer/_files/customer_sample.php
4946
* @magentoAppIsolation enabled
5047
* @magentoDbIsolation disabled
5148
*/
5249
public function testGetItemByIdForUpdateOnSchedule()
5350
{
54-
$targetObject = Bootstrap::getObjectManager()
55-
->create(Collection::class);
56-
$customerRepository = Bootstrap::getObjectManager()
57-
->create(CustomerRepositoryInterface::class);
58-
/** Verify after first save */
59-
60-
/** @var CustomerInterface $newCustomer */
61-
$newCustomer = $customerRepository->get('[email protected]');
62-
/** @var CustomerInterface $item */
63-
$item = $targetObject->getItemById($newCustomer->getId());
51+
$indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID);
52+
$indexer->reindexAll();
53+
$newCustomer = $this->customerRepository->get('[email protected]');
54+
$item = $this->targetObject->getItemById($newCustomer->getId());
6455
$this->assertNotEmpty($item);
6556
$this->assertSame($newCustomer->getEmail(), $item->getEmail());
6657
$this->assertSame('test street test city Armed Forces Middle East 01001', $item->getBillingFull());
6758

68-
/** Verify after update */
59+
/** set customer grid indexer on schedule' mode */
60+
$indexer->setScheduled(true);
6961

62+
/** Verify after update */
7063
$newCustomer->setEmail('[email protected]');
71-
$customerRepository->save($newCustomer);
72-
$targetObject->clear();
73-
$item = $targetObject->getItemById($newCustomer->getId());
74-
$this->assertSame($newCustomer->getEmail(), $item->getEmail());
64+
$this->customerRepository->save($newCustomer);
65+
$this->targetObject->clear();
66+
$item = $this->targetObject->getItemById($newCustomer->getId());
67+
$this->assertNotEquals('[email protected]', $item->getEmail());
7568
}
7669

7770
/**

dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66

77
/**
@@ -478,7 +478,8 @@ public function testDifferentOptions(): void
478478
/**
479479
* Test customer indexer gets invalidated after import when Update on Schedule mode is set
480480
*
481-
* @magentoDbIsolation enabled
481+
* @magentoAppIsolation enabled
482+
* @magentoDbIsolation disabled
482483
*/
483484
public function testCustomerIndexer(): void
484485
{

dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66

77
namespace Magento\CustomerImportExport\Model\Import;
@@ -495,7 +495,8 @@ public function testUpdateExistingCustomers(): void
495495
/**
496496
* Test customer indexer gets invalidated after import when Update on Schedule mode is set
497497
*
498-
* @magentoDbIsolation enabled
498+
* @magentoAppIsolation enabled
499+
* @magentoDbIsolation disabled
499500
* @return void
500501
*/
501502
public function testCustomerIndexer(): void

0 commit comments

Comments
 (0)