File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
app/code/Magento/Quote/etc
dev/tests/api-functional/testsuite/Magento/Quote/Api Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 59
59
<parameter name =" customerId" force =" true" >%customer_id%</parameter >
60
60
</data >
61
61
</route >
62
+ <route url =" /V1/carts/mine/order" method =" PUT" >
63
+ <service class =" Magento\Quote\Api\CartManagementInterface" method =" placeOrder" />
64
+ <resources >
65
+ <resource ref =" self" />
66
+ </resources >
67
+ <data >
68
+ <parameter name =" cartId" force =" true" >%cart_id%</parameter >
69
+ </data >
70
+ </route >
62
71
63
72
<!-- Managing guest carts -->
64
73
Original file line number Diff line number Diff line change @@ -369,6 +369,41 @@ public function testPlaceOrder()
369
369
$ quote ->delete ();
370
370
}
371
371
372
+ /**
373
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_check_payment.php
374
+ */
375
+ public function testPlaceOrderForMyCart ()
376
+ {
377
+ $ this ->_markTestAsRestOnly ();
378
+
379
+ // get customer ID token
380
+ /** @var \Magento\Integration\Service\V1\CustomerTokenServiceInterface $customerTokenService */
381
+ $ customerTokenService = $ this ->objectManager ->create (
382
+ 'Magento\Integration\Service\V1\CustomerTokenServiceInterface '
383
+ );
384
+ $ token = $ customerTokenService ->createCustomerAccessToken ('customer@example.com ' , 'password ' );
385
+
386
+ /** @var $quote \Magento\Quote\Model\Quote */
387
+ $ quote = $ this ->objectManager ->create ('Magento\Quote\Model\Quote ' )->load ('test_order_1 ' , 'reserved_order_id ' );
388
+
389
+ $ serviceInfo = [
390
+ 'rest ' => [
391
+ 'resourcePath ' => '/V1/carts/mine/order ' ,
392
+ 'httpMethod ' => \Magento \Framework \Webapi \Rest \Request::HTTP_METHOD_PUT ,
393
+ 'token ' => $ token
394
+ ],
395
+ ];
396
+
397
+ $ orderId = $ this ->_webApiCall ($ serviceInfo , []);
398
+
399
+ /** @var \Magento\Sales\Model\Order $order */
400
+ $ order = $ this ->objectManager ->create ('Magento\Sales\Model\Order ' )->load ($ orderId );
401
+ $ items = $ order ->getAllItems ();
402
+ $ this ->assertCount (1 , $ items );
403
+ $ this ->assertEquals ('Simple Product ' , $ items [0 ]->getName ());
404
+ $ quote ->delete ();
405
+ }
406
+
372
407
/**
373
408
* Test to get my cart based on customer authentication token or session
374
409
*
You can’t perform that action at this time.
0 commit comments