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

Commit 58acbd9

Browse files
authored
Merge pull request #50 from grayloon/order-show
Order Show
2 parents 593b469 + 8ebc905 commit 58acbd9

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,23 @@ Magento::api('guestCarts')->couponCode($cartId, $couponCode);
256256
<a id="orders"></a>
257257
### Orders (salesOrderRepositoryV1)
258258

259-
Lists orders that match specified search criteria.
259+
Lists orders that match specified search criteria.
260260

261261
`/V1/orders`
262-
263-
Lists orders that match specified search criteria.
264262
```php
265263
Magento::api('orders')->all($pageSize = 50, $currentPage = 1, $filters = []);
266264
```
267265

266+
`/V1/orders/{id}`
267+
268+
List a specified order:
269+
```php
270+
Magento::api('orders')->show($orderId);
271+
```
272+
273+
274+
275+
268276
<a id="product-attributes"></a>
269277
### Product Attributes (catalogProductAttributeRepositoryV1)
270278

src/Api/Orders.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,16 @@ public function all($pageSize = 50, $currentPage = 1, $filters = [])
2020
'searchCriteria[currentPage]' => $currentPage,
2121
]));
2222
}
23+
24+
/**
25+
* Loads a specified order.
26+
*
27+
* @param int $orderId
28+
*
29+
* @return array
30+
*/
31+
public function show($orderId)
32+
{
33+
return $this->get('/orders/'.$orderId);
34+
}
2335
}

tests/Api/OrdersTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,15 @@ public function test_can_call_magento_api_orders_all_with_filter()
3737

3838
$this->assertTrue($api->ok());
3939
}
40+
41+
public function test_can_call_magento_show()
42+
{
43+
Http::fake([
44+
'*rest/all/V1/orders/1' => Http::response([], 200),
45+
]);
46+
47+
$api = MagentoFacade::api('orders')->show(1);
48+
49+
$this->assertTrue($api->ok());
50+
}
4051
}

0 commit comments

Comments
 (0)