Skip to content

Commit 3368f04

Browse files
zlikAmeya Savale
andauthored
Create order API endpoint (#607)
* added a custom create order API endpoint * update order creation flow * updated endpoint url * update order creation flow * apply payment method * update php doc * clean up * clean up * fix tests * add dependency on Magento_Quote * update phpdoc * removed store ID, renamed class and interface * updated di.xml and webapi.xml * use placeOrder * revert changes made by in the last commit, port some of the extra checks from into * set remote address and checkout session in our method like it is done in placeOrder in QuoteMagagement.php * minor changes as requested in code review * revert to get from getActive * fix static tests failure * suppress warnings * resolve static test issues * update parameters to match the request body structure * 1. wrap logic inside a try/catch 2. Add request authentication * fix static test issues * fix more static test errors * remove extra space --------- Co-authored-by: Ameya Savale <[email protected]>
1 parent 4bd6e19 commit 3368f04

File tree

6 files changed

+522
-5
lines changed

6 files changed

+522
-5
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* Copyright (c) Meta Platforms, Inc. and affiliates.
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License");
9+
* you may not use this file except in compliance with the License.
10+
* You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software
15+
* distributed under the License is distributed on an "AS IS" BASIS,
16+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
* See the License for the specific language governing permissions and
18+
* limitations under the License.
19+
*/
20+
21+
namespace Meta\Sales\Api;
22+
23+
use Magento\Sales\Api\Data\OrderInterface;
24+
25+
/**
26+
* Create Magento order
27+
*/
28+
interface CreateOrderApiInterface
29+
{
30+
/**
31+
* Create order
32+
*
33+
* @param string $cartId
34+
* @param string $orderId
35+
* @param string $email
36+
* @param string $firstName
37+
* @param string $lastName
38+
* @param string|null $channel
39+
* @param bool $buyerOptin
40+
* @param bool $createInvoice
41+
* @return OrderInterface
42+
*/
43+
public function createOrder(
44+
string $cartId,
45+
string $orderId,
46+
string $email,
47+
string $firstName,
48+
string $lastName,
49+
?string $channel,
50+
bool $buyerOptin = false,
51+
bool $createInvoice = false
52+
): OrderInterface;
53+
}

0 commit comments

Comments
 (0)