Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 67521ec

Browse files
committed
Added post endpoint for updating an order.
1 parent d3f6394 commit 67521ec

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,19 @@ List a specified order:
355355
Magento::api('orders')->show($orderId);
356356
```
357357

358+
`/V1/orders`
359+
360+
Updates an order specified by the entity id within the $body:
361+
```php
362+
$body = [
363+
'entity' => [
364+
'entity_id' => '', // required
365+
// ... attributes to update
366+
]
367+
];
368+
Magento::api('orders')->edit($body);
369+
```
370+
358371

359372

360373

src/Api/Orders.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,15 @@ public function show($orderId)
3232
{
3333
return $this->get('/orders/'.$orderId);
3434
}
35+
36+
/**
37+
* Edits and saves an order using the specified entity id within the body.
38+
*
39+
* @param array $body
40+
* @return array
41+
*/
42+
public function edit($body = [])
43+
{
44+
return $this->post('/orders', $body);
45+
}
3546
}

tests/Api/OrdersTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,15 @@ public function test_can_call_magento_show()
4848

4949
$this->assertTrue($api->ok());
5050
}
51+
52+
public function test_can_edit_and_save_order()
53+
{
54+
Http::fake([
55+
'*rest/all/V1/orders' => Http::response([], 200),
56+
]);
57+
58+
$api = MagentoFacade::api('orders')->edit([]);
59+
60+
$this->assertTrue($api->ok());
61+
}
5162
}

0 commit comments

Comments
 (0)