Skip to content

Commit 83d1113

Browse files
authored
Merge pull request #718 from adobe-commerce-tier-4/PR_2026_03_18_flowers
[Support Tier-4 flowers] 03-18-2026 Regular delivery of bugfixes and improvements
2 parents d65157c + bd2cea4 commit 83d1113

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

InventorySales/Plugin/Quote/CartManagementPlugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function aroundPlaceOrder(
117117

118118
try {
119119
foreach ($skus as $sku) {
120-
if (!$this->acquireInventoryLock->execute($sku, $stockId)) {
120+
if (!$this->acquireInventoryLock->execute((string) $sku, $stockId)) {
121121
throw new LocalizedException(
122122
__('Could not acquire inventory lock for SKU: %1. Please try again.', $sku)
123123
);
@@ -128,7 +128,7 @@ public function aroundPlaceOrder(
128128
return $proceed($cartId, $paymentMethod);
129129
} finally {
130130
foreach (array_keys($locksAcquired) as $sku) {
131-
$this->acquireInventoryLock->release($sku, $stockId);
131+
$this->acquireInventoryLock->release((string) $sku, $stockId);
132132
}
133133
}
134134
}

InventorySales/Test/GraphQl/PreventOversellingDuringConcurrentOrdersTest.php renamed to InventorySales/Test/GraphQl/OrderPlacementTest.php

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Catalog\Test\Fixture\Product as ProductFixture;
1111
use Magento\Checkout\Test\Fixture\SetBillingAddress as SetBillingAddressFixture;
1212
use Magento\Checkout\Test\Fixture\SetDeliveryMethod as SetDeliveryMethodFixture;
13+
use Magento\Checkout\Test\Fixture\SetGuestEmail as SetGuestEmailFixture;
1314
use Magento\Checkout\Test\Fixture\SetPaymentMethod as SetPaymentMethodFixture;
1415
use Magento\Checkout\Test\Fixture\SetShippingAddress as SetShippingAddressFixture;
1516
use Magento\Customer\Test\Fixture\Customer as CustomerFixture;
@@ -22,6 +23,7 @@
2223
use Magento\InventorySalesApi\Test\Fixture\StockSalesChannels as StockSalesChannelsFixture;
2324
use Magento\Quote\Test\Fixture\AddProductToCart as AddProductToCartFixture;
2425
use Magento\Quote\Test\Fixture\CustomerCart as CustomerCartFixture;
26+
use Magento\Quote\Test\Fixture\GuestCart as GuestCartFixture;
2527
use Magento\Quote\Test\Fixture\QuoteIdMask;
2628
use Magento\TestFramework\Fixture\DataFixture;
2729
use Magento\TestFramework\Fixture\DataFixtureStorage;
@@ -34,7 +36,7 @@
3436
*
3537
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3638
*/
37-
class PreventOversellingDuringConcurrentOrdersTest extends GraphQlAbstract
39+
class OrderPlacementTest extends GraphQlAbstract
3840
{
3941
/**
4042
* @var DataFixtureStorage
@@ -251,14 +253,34 @@ public function testMultipleOrdersSucceedWithSufficientQuantity(): void
251253
$this->assertArrayHasKey('order_number', $response2['placeOrder']['order']);
252254
}
253255

256+
#[
257+
DataFixture(ProductFixture::class, ['sku' => '4669'], as: 'product'),
258+
DataFixture(GuestCartFixture::class, as: 'cart'),
259+
DataFixture(QuoteIdMask::class, ['cart_id' => '$cart.id$'], as: 'cartMask'),
260+
DataFixture(AddProductToCartFixture::class, ['cart_id' => '$cart.id$', 'product_id' => '$product.id$']),
261+
DataFixture(SetBillingAddressFixture::class, ['cart_id' => '$cart.id$']),
262+
DataFixture(SetShippingAddressFixture::class, ['cart_id' => '$cart.id$']),
263+
DataFixture(SetDeliveryMethodFixture::class, ['cart_id' => '$cart.id$']),
264+
DataFixture(SetGuestEmailFixture::class, ['cart_id' => '$cart.id$']),
265+
DataFixture(SetPaymentMethodFixture::class, ['cart_id' => '$cart.id$']),
266+
]
267+
public function testPlaceOrderWithNumericSku(): void
268+
{
269+
$response = $this->placeOrder($this->fixtures->get('cartMask')->getMaskedId());
270+
$this->assertArrayHasKey('placeOrder', $response);
271+
$this->assertArrayHasKey('order', $response['placeOrder']);
272+
$this->assertArrayHasKey('order_number', $response['placeOrder']['order']);
273+
$this->assertNotEmpty($response['placeOrder']['order']['order_number']);
274+
}
275+
254276
/**
255277
* Place order via GraphQL mutation
256278
*
257279
* @param string $maskedCartId
258-
* @param string $customerToken
280+
* @param string|null $customerToken
259281
* @return array
260282
*/
261-
private function placeOrder(string $maskedCartId, string $customerToken): array
283+
private function placeOrder(string $maskedCartId, ?string $customerToken = null): array
262284
{
263285
$query = <<<QUERY
264286
mutation {
@@ -274,7 +296,7 @@ private function placeOrder(string $maskedCartId, string $customerToken): array
274296
$query,
275297
[],
276298
'',
277-
['Authorization' => 'Bearer ' . $customerToken]
299+
$customerToken ? ['Authorization' => 'Bearer ' . $customerToken] : []
278300
);
279301
}
280302
}

0 commit comments

Comments
 (0)