77
88namespace Magento \QuoteGraphQl \Model \Resolver ;
99
10- use Magento \Framework \App \ObjectManager ;
1110use Magento \Framework \Exception \LocalizedException ;
1211use Magento \Framework \GraphQl \Config \Element \Field ;
1312use Magento \Framework \GraphQl \Exception \GraphQlInputException ;
1716use Magento \QuoteGraphQl \Model \Cart \GetCartForCheckout ;
1817use Magento \GraphQl \Model \Query \ContextInterface ;
1918use Magento \QuoteGraphQl \Model \Cart \PlaceOrder as PlaceOrderModel ;
20- use Magento \QuoteGraphQl \Model \Cart \PlaceOrderMutexInterface ;
2119use Magento \Sales \Api \OrderRepositoryInterface ;
2220
2321/**
@@ -45,30 +43,22 @@ class PlaceOrder implements ResolverInterface
4543 */
4644 private $ errorMessageFormatter ;
4745
48- /**
49- * @var PlaceOrderMutexInterface
50- */
51- private $ placeOrderMutex ;
52-
5346 /**
5447 * @param GetCartForCheckout $getCartForCheckout
5548 * @param PlaceOrderModel $placeOrder
5649 * @param OrderRepositoryInterface $orderRepository
5750 * @param AggregateExceptionMessageFormatter $errorMessageFormatter
58- * @param PlaceOrderMutexInterface|null $placeOrderMutex
5951 */
6052 public function __construct (
6153 GetCartForCheckout $ getCartForCheckout ,
6254 PlaceOrderModel $ placeOrder ,
6355 OrderRepositoryInterface $ orderRepository ,
64- AggregateExceptionMessageFormatter $ errorMessageFormatter ,
65- ?PlaceOrderMutexInterface $ placeOrderMutex = null
56+ AggregateExceptionMessageFormatter $ errorMessageFormatter
6657 ) {
6758 $ this ->getCartForCheckout = $ getCartForCheckout ;
6859 $ this ->placeOrder = $ placeOrder ;
6960 $ this ->orderRepository = $ orderRepository ;
7061 $ this ->errorMessageFormatter = $ errorMessageFormatter ;
71- $ this ->placeOrderMutex = $ placeOrderMutex ?: ObjectManager::getInstance ()->get (PlaceOrderMutexInterface::class);
7262 }
7363
7464 /**
@@ -80,25 +70,6 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
8070 throw new GraphQlInputException (__ ('Required parameter "cart_id" is missing ' ));
8171 }
8272
83- return $ this ->placeOrderMutex ->execute (
84- $ args ['input ' ]['cart_id ' ],
85- \Closure::fromCallable ([$ this , 'run ' ]),
86- [$ field , $ context , $ info , $ args ]
87- );
88- }
89-
90- /**
91- * Run the resolver.
92- *
93- * @param Field $field
94- * @param ContextInterface $context
95- * @param ResolveInfo $info
96- * @param array|null $args
97- * @return array[]
98- * @SuppressWarnings(PHPMD.UnusedPrivateMethod)
99- */
100- private function run (Field $ field , ContextInterface $ context , ResolveInfo $ info , ?array $ args ): array
101- {
10273 $ maskedCartId = $ args ['input ' ]['cart_id ' ];
10374 $ userId = (int )$ context ->getUserId ();
10475 $ storeId = (int )$ context ->getExtensionAttributes ()->getStore ()->getId ();
0 commit comments