7
7
8
8
namespace Magento \QuoteGraphQl \Model \Resolver ;
9
9
10
- use Magento \Framework \App \ObjectManager ;
11
10
use Magento \Framework \Exception \LocalizedException ;
12
11
use Magento \Framework \GraphQl \Config \Element \Field ;
13
12
use Magento \Framework \GraphQl \Exception \GraphQlInputException ;
17
16
use Magento \QuoteGraphQl \Model \Cart \GetCartForCheckout ;
18
17
use Magento \GraphQl \Model \Query \ContextInterface ;
19
18
use Magento \QuoteGraphQl \Model \Cart \PlaceOrder as PlaceOrderModel ;
20
- use Magento \QuoteGraphQl \Model \Cart \PlaceOrderMutexInterface ;
21
19
use Magento \Sales \Api \OrderRepositoryInterface ;
22
20
23
21
/**
@@ -45,30 +43,22 @@ class PlaceOrder implements ResolverInterface
45
43
*/
46
44
private $ errorMessageFormatter ;
47
45
48
- /**
49
- * @var PlaceOrderMutexInterface
50
- */
51
- private $ placeOrderMutex ;
52
-
53
46
/**
54
47
* @param GetCartForCheckout $getCartForCheckout
55
48
* @param PlaceOrderModel $placeOrder
56
49
* @param OrderRepositoryInterface $orderRepository
57
50
* @param AggregateExceptionMessageFormatter $errorMessageFormatter
58
- * @param PlaceOrderMutexInterface|null $placeOrderMutex
59
51
*/
60
52
public function __construct (
61
53
GetCartForCheckout $ getCartForCheckout ,
62
54
PlaceOrderModel $ placeOrder ,
63
55
OrderRepositoryInterface $ orderRepository ,
64
- AggregateExceptionMessageFormatter $ errorMessageFormatter ,
65
- ?PlaceOrderMutexInterface $ placeOrderMutex = null
56
+ AggregateExceptionMessageFormatter $ errorMessageFormatter
66
57
) {
67
58
$ this ->getCartForCheckout = $ getCartForCheckout ;
68
59
$ this ->placeOrder = $ placeOrder ;
69
60
$ this ->orderRepository = $ orderRepository ;
70
61
$ this ->errorMessageFormatter = $ errorMessageFormatter ;
71
- $ this ->placeOrderMutex = $ placeOrderMutex ?: ObjectManager::getInstance ()->get (PlaceOrderMutexInterface::class);
72
62
}
73
63
74
64
/**
@@ -80,25 +70,6 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
80
70
throw new GraphQlInputException (__ ('Required parameter "cart_id" is missing ' ));
81
71
}
82
72
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
- {
102
73
$ maskedCartId = $ args ['input ' ]['cart_id ' ];
103
74
$ userId = (int )$ context ->getUserId ();
104
75
$ storeId = (int )$ context ->getExtensionAttributes ()->getStore ()->getId ();
0 commit comments