Skip to content

Commit d5759b3

Browse files
authored
Merge pull request #278 from jeroendelau/master
add support for Order()->FulfillmentOrder and FulfillmentRequests
2 parents 38b31fc + 69b3057 commit d5759b3

File tree

4 files changed

+62
-5
lines changed

4 files changed

+62
-5
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ Some resources are available directly, some resources are only available through
351351
- [DiscountCode](https://help.shopify.com/en/api/reference/discounts/discountcode)
352352
- [Event](https://help.shopify.com/api/reference/event/)
353353
- [FulfillmentService](https://help.shopify.com/api/reference/fulfillmentservice)
354+
- [Fulfillment](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillment)
355+
- [FulfillmentOrder](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentorder)
356+
- FulfillmentOrder -> [FulfillmentRequest](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentrequest)
357+
- FulfillmentOrder -> [Fulfillment](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillment)
354358
- [GiftCard](https://help.shopify.com/api/reference/gift_card) _(Shopify Plus Only)_
355359
- [InventoryItem](https://help.shopify.com/api/reference/inventoryitem)
356360
- [InventoryLevel](https://help.shopify.com/api/reference/inventorylevel)
@@ -359,8 +363,7 @@ Some resources are available directly, some resources are only available through
359363
- [Metafield](https://help.shopify.com/api/reference/metafield)
360364
- [Multipass](https://help.shopify.com/api/reference/multipass) _(Shopify Plus Only, API not available yet)_
361365
- [Order](https://help.shopify.com/api/reference/order)
362-
- Order -> [Fulfillment](https://help.shopify.com/api/reference/fulfillment)
363-
- Order -> Fulfillment -> [Event](https://help.shopify.com/api/reference/fulfillmentevent)
366+
- Order -> [FulfillmentOrder](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentorder)
364367
- Order -> [Risk](https://help.shopify.com/api/reference/order_risks)
365368
- Order -> [Refund](https://help.shopify.com/api/reference/refund)
366369
- Order -> [Transaction](https://help.shopify.com/api/reference/transaction)

lib/FulfillmentOrder.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?php
22
/**
3-
* Created by PhpStorm.
4-
* @author Mark Solly <[email protected]>
5-
* Created at 5/21/21 11:27 AM UTC+10:00
63
*
74
* @see https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillmentorder Shopify API Reference for Fulfillment Order
85
*/
@@ -14,6 +11,8 @@
1411
* --------------------------------------------------------------------------
1512
* FulfillmentOrder -> Child Resources
1613
* --------------------------------------------------------------------------
14+
* @property-read FulfillmentRequest $FulfillmentRequest
15+
* @property-read Fulfillment $Fulfillment
1716
*
1817
* --------------------------------------------------------------------------
1918
* Fulfillment -> Custom actions
@@ -33,6 +32,13 @@ class FulfillmentOrder extends ShopifyResource
3332
*/
3433
protected $resourceKey = 'fulfillment_order';
3534

35+
/**
36+
* @inheritDoc
37+
*/
38+
protected $childResource = array (
39+
'FulfillmentRequest',
40+
'Fulfillment'
41+
);
3642

3743
/**
3844
* @inheritDoc

lib/FulfillmentRequest.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* @author Tareq Mahmood <[email protected]>
5+
* Created at 8/19/16 5:28 PM UTC+06:00
6+
*
7+
* @see https://help.shopify.com/api/reference/fulfillmentservice Shopify API Reference for FulfillmentService
8+
*/
9+
10+
namespace PHPShopify;
11+
12+
/**
13+
* --------------------------------------------------------------------------
14+
* FulfillmentRequest -> Child Resources
15+
* --------------------------------------------------------------------------
16+
*
17+
* --------------------------------------------------------------------------
18+
* FulfillmentRequest -> Custom actions
19+
* --------------------------------------------------------------------------
20+
* @method array accept() Accept a fulfilment order
21+
* @method array reject() Rejects a fulfillment order
22+
*/
23+
class FulfillmentRequest extends ShopifyResource
24+
{
25+
/**
26+
* @inheritDoc
27+
*/
28+
protected $resourceKey = 'fulfillment_request';
29+
30+
/**
31+
* @inheritDoc
32+
*/
33+
public $countEnabled = false;
34+
35+
/**
36+
* @inheritDoc
37+
*/
38+
protected $customPostActions = array(
39+
'accept',
40+
'reject'
41+
);
42+
43+
protected function pluralizeKey()
44+
{
45+
return $this->resourceKey;
46+
}
47+
}

lib/Order.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* --------------------------------------------------------------------------
1616
* Order -> Child Resources
1717
* --------------------------------------------------------------------------
18+
* @property-read FulfillmentOrder $FulfillmentOrder
1819
* @property-read Fulfillment $Fulfillment
1920
* @property-read OrderRisk $Risk
2021
* @property-read Refund $Refund

0 commit comments

Comments
 (0)