Skip to content

Commit f4ba3b0

Browse files
committed
AC-1271: Add rate limiting for payment information endpoint and mutation
1 parent a432c27 commit f4ba3b0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/code/Magento/Checkout/Model/Backpressure/WebapiRequestTypeExtractor.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
use Magento\Quote\Model\Backpressure\OrderLimitConfigManager;
1313

1414
/**
15-
* Identifies which checkout related functionality needs backpressure management.
15+
* Identifies which checkout related functionality needs backpressure management
1616
*/
1717
class WebapiRequestTypeExtractor implements BackpressureRequestTypeExtractorInterface
1818
{
19+
private const METHOD = 'savePaymentInformationAndPlaceOrder';
20+
1921
/**
2022
* @var OrderLimitConfigManager
2123
*/
@@ -34,10 +36,8 @@ public function __construct(OrderLimitConfigManager $config)
3436
*/
3537
public function extract(string $service, string $method, string $endpoint): ?string
3638
{
37-
if ($method === 'savePaymentInformationAndPlaceOrder' && $this->config->isEnforcementEnabled()) {
38-
return OrderLimitConfigManager::REQUEST_TYPE_ID;
39-
}
40-
41-
return null;
39+
return self::METHOD === $method && $this->config->isEnforcementEnabled()
40+
? OrderLimitConfigManager::REQUEST_TYPE_ID
41+
: null;
4242
}
4343
}

0 commit comments

Comments
 (0)