Skip to content

Commit e6f90ad

Browse files
committed
ACPT-1191: Fix Quote related issues on Application Server
1 parent a74f840 commit e6f90ad

File tree

15 files changed

+64
-13
lines changed

15 files changed

+64
-13
lines changed

app/code/Magento/Config/Model/ResourceModel/Config.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Config\Model\ResourceModel;
77

88
use Magento\Framework\App\Config\ScopeConfigInterface;
9+
use Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface;
910

1011
/**
1112
* Core Resource Resource Model
@@ -17,14 +18,23 @@
1718
class Config extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb implements
1819
\Magento\Framework\App\Config\ConfigResource\ConfigInterface
1920
{
21+
/**
22+
* @var PoisonPillPutInterface
23+
*/
24+
private $pillPut;
25+
2026
/**
2127
* Define main table
22-
*
28+
* @param PoisonPillPutInterface|null $pillPut
2329
* @return void
2430
*/
25-
protected function _construct()
31+
protected function _construct(
32+
PoisonPillPutInterface $pillPut = null
33+
)
2634
{
2735
$this->_init('core_config_data', 'config_id');
36+
$this->pillPut = $pillPut ?: \Magento\Framework\App\ObjectManager::getInstance()
37+
->get(PoisonPillPutInterface::class);
2838
}
2939

3040
/**
@@ -61,6 +71,7 @@ public function saveConfig($path, $value, $scope = ScopeConfigInterface::SCOPE_T
6171
} else {
6272
$connection->insert($this->getMainTable(), $newData);
6373
}
74+
$this->pillPut->put();
6475
return $this;
6576
}
6677

@@ -83,6 +94,7 @@ public function deleteConfig($path, $scope = ScopeConfigInterface::SCOPE_TYPE_DE
8394
$connection->quoteInto('scope_id = ?', $scopeId)
8495
]
8596
);
97+
$this->pillPut->put();
8698
return $this;
8799
}
88100
}

app/code/Magento/Eav/Model/Config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,5 +990,6 @@ public function _resetState(): void
990990
{
991991
$this->attributesPerSet = [];
992992
$this->_attributeData = [];
993+
$this->attributes = [];
993994
}
994995
}

app/code/Magento/Quote/Model/QuoteManagement.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Magento\Framework\HTTP\PhpEnvironment\RemoteAddress;
2727
use Magento\Framework\Lock\LockManagerInterface;
2828
use Magento\Framework\Model\AbstractExtensibleModel;
29+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
2930
use Magento\Framework\Validator\Exception as ValidatorException;
3031
use Magento\Payment\Model\Method\AbstractMethod;
3132
use Magento\Quote\Api\CartManagementInterface;
@@ -41,6 +42,7 @@
4142
use Magento\Sales\Api\Data\OrderInterface;
4243
use Magento\Sales\Api\Data\OrderInterfaceFactory as OrderFactory;
4344
use Magento\Sales\Api\OrderManagementInterface as OrderManagement;
45+
use Magento\Store\Model\StoreManager;
4446
use Magento\Store\Model\StoreManagerInterface;
4547

4648
/**
@@ -50,7 +52,7 @@
5052
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
5153
* @SuppressWarnings(PHPMD.TooManyFields)
5254
*/
53-
class QuoteManagement implements CartManagementInterface
55+
class QuoteManagement implements CartManagementInterface, ResetAfterRequestInterface
5456
{
5557
private const LOCK_PREFIX = 'PLACE_ORDER_';
5658

@@ -774,4 +776,12 @@ private function rollbackAddresses(
774776
throw new \Exception($message, 0, $e);
775777
}
776778
}
779+
780+
/**
781+
* @inheritDoc
782+
*/
783+
public function _resetState(): void
784+
{
785+
$this->storeManager = ObjectManager::getInstance()->get(StoreManager::class);
786+
}
777787
}

app/code/Magento/QuoteGraphQl/Model/Cart/TotalsCollector.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ public function __construct(QuoteTotalsCollector $quoteTotalsCollector)
5151
*/
5252
public function _resetState(): void
5353
{
54-
$this->quoteTotals = [];
55-
$this->addressTotals = [];
54+
$this->clearTotals();
5655
}
5756

5857
/**

app/code/Magento/Tax/Model/Calculation.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Framework\Api\FilterBuilder;
1616
use Magento\Framework\Api\SearchCriteriaBuilder;
1717
use Magento\Framework\Exception\NoSuchEntityException;
18+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1819
use Magento\Framework\Pricing\PriceCurrencyInterface;
1920
use Magento\Store\Model\Store;
2021
use Magento\Tax\Api\TaxClassRepositoryInterface;
@@ -24,7 +25,7 @@
2425
* @SuppressWarnings(PHPMD.TooManyFields)
2526
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2627
*/
27-
class Calculation extends \Magento\Framework\Model\AbstractModel
28+
class Calculation extends \Magento\Framework\Model\AbstractModel implements ResetAfterRequestInterface
2829
{
2930
/**
3031
* Identifier constant for Tax calculation before discount excluding TAX
@@ -720,4 +721,13 @@ public function getTaxRates($billingAddress, $shippingAddress, $customerTaxClass
720721
}
721722
return $productRates;
722723
}
724+
725+
/**
726+
* @inheritDoc
727+
*/
728+
public function _resetState(): void
729+
{
730+
$this->_rateCache = [];
731+
$this->_rateCalculationProcess = [];
732+
}
723733
}

app/code/Magento/Tax/Model/ResourceModel/Calculation.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
*/
1010
namespace Magento\Tax\Model\ResourceModel;
1111

12-
class Calculation extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
12+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
13+
14+
class Calculation extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb implements ResetAfterRequestInterface
1315
{
1416
/**
1517
* Store ISO 3166-1 alpha-2 USA country code
@@ -473,4 +475,12 @@ public function getRateIds($request)
473475

474476
return $result;
475477
}
478+
479+
/**
480+
* @inheritDoc
481+
*/
482+
public function _resetState(): void
483+
{
484+
$this->_ratesCache = [];
485+
}
476486
}

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/CartPromotionsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ public function testCartPromotionsMultipleCartRules()
198198
* Tax rate = 7.5%
199199
* Cart rule to apply 50% for products assigned to a specific category
200200
*
201+
* @magentoConfigFixture default_store tax/calculation/discount_tax 1
201202
* @magentoApiDataFixture Magento/Catalog/_files/multiple_products.php
202203
* @magentoApiDataFixture Magento/GraphQl/Tax/_files/tax_rule_for_region_1.php
203204
* @magentoApiDataFixture Magento/GraphQl/Tax/_files/tax_calculation_price_and_cart_display_settings.php

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSelectedShippingMethodTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ protected function setUp(): void
3939
}
4040

4141
/**
42+
* @magentoConfigFixture default_store tax/calculation/price_includes_tax 1
4243
* @magentoConfigFixture default_store tax/calculation/shipping_includes_tax 1
4344
* @magentoConfigFixture default_store tax/cart_display/shipping 2
4445
* @magentoConfigFixture default_store tax/classes/shipping_tax_class 2

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPurchaseOrderPaymentMethodOnCartTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ public function testSetPurchaseOrderPaymentMethodOnCartWithoutPurchaseOrderNumbe
133133
}
134134

135135
/**
136+
* @magentoConfigFixture default_store payment/purchaseorder/active 0
136137
* @magentoApiDataFixture Magento/Customer/_files/customer.php
137138
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
138139
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingMethodsOnCartTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ public function testReSetShippingMethod()
138138
}
139139

140140
/**
141+
* @magentoConfigFixture default_store carriers/freeshipping/active 0
141142
* @magentoApiDataFixture Magento/Customer/_files/customer.php
142143
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
143144
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php

0 commit comments

Comments
 (0)