Skip to content

Commit

Permalink
Merge pull request #278 from jeroendelau/master
Browse files Browse the repository at this point in the history
add support for Order()->FulfillmentOrder and FulfillmentRequests
  • Loading branch information
tareqtms authored Feb 13, 2023
2 parents 38b31fc + 69b3057 commit d5759b3
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 5 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ Some resources are available directly, some resources are only available through
- [DiscountCode](https://help.shopify.com/en/api/reference/discounts/discountcode)
- [Event](https://help.shopify.com/api/reference/event/)
- [FulfillmentService](https://help.shopify.com/api/reference/fulfillmentservice)
- [Fulfillment](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillment)
- [FulfillmentOrder](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentorder)
- FulfillmentOrder -> [FulfillmentRequest](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentrequest)
- FulfillmentOrder -> [Fulfillment](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillment)
- [GiftCard](https://help.shopify.com/api/reference/gift_card) _(Shopify Plus Only)_
- [InventoryItem](https://help.shopify.com/api/reference/inventoryitem)
- [InventoryLevel](https://help.shopify.com/api/reference/inventorylevel)
Expand All @@ -359,8 +363,7 @@ Some resources are available directly, some resources are only available through
- [Metafield](https://help.shopify.com/api/reference/metafield)
- [Multipass](https://help.shopify.com/api/reference/multipass) _(Shopify Plus Only, API not available yet)_
- [Order](https://help.shopify.com/api/reference/order)
- Order -> [Fulfillment](https://help.shopify.com/api/reference/fulfillment)
- Order -> Fulfillment -> [Event](https://help.shopify.com/api/reference/fulfillmentevent)
- Order -> [FulfillmentOrder](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentorder)
- Order -> [Risk](https://help.shopify.com/api/reference/order_risks)
- Order -> [Refund](https://help.shopify.com/api/reference/refund)
- Order -> [Transaction](https://help.shopify.com/api/reference/transaction)
Expand Down
12 changes: 9 additions & 3 deletions lib/FulfillmentOrder.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?php
/**
* Created by PhpStorm.
* @author Mark Solly <mark@solly.com.au>
* Created at 5/21/21 11:27 AM UTC+10:00
*
* @see https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillmentorder Shopify API Reference for Fulfillment Order
*/
Expand All @@ -14,6 +11,8 @@
* --------------------------------------------------------------------------
* FulfillmentOrder -> Child Resources
* --------------------------------------------------------------------------
* @property-read FulfillmentRequest $FulfillmentRequest
* @property-read Fulfillment $Fulfillment
*
* --------------------------------------------------------------------------
* Fulfillment -> Custom actions
Expand All @@ -33,6 +32,13 @@ class FulfillmentOrder extends ShopifyResource
*/
protected $resourceKey = 'fulfillment_order';

/**
* @inheritDoc
*/
protected $childResource = array (
'FulfillmentRequest',
'Fulfillment'
);

/**
* @inheritDoc
Expand Down
47 changes: 47 additions & 0 deletions lib/FulfillmentRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Created by PhpStorm.
* @author Tareq Mahmood <tareqtms@yahoo.com>
* Created at 8/19/16 5:28 PM UTC+06:00
*
* @see https://help.shopify.com/api/reference/fulfillmentservice Shopify API Reference for FulfillmentService
*/

namespace PHPShopify;

/**
* --------------------------------------------------------------------------
* FulfillmentRequest -> Child Resources
* --------------------------------------------------------------------------
*
* --------------------------------------------------------------------------
* FulfillmentRequest -> Custom actions
* --------------------------------------------------------------------------
* @method array accept() Accept a fulfilment order
* @method array reject() Rejects a fulfillment order
*/
class FulfillmentRequest extends ShopifyResource
{
/**
* @inheritDoc
*/
protected $resourceKey = 'fulfillment_request';

/**
* @inheritDoc
*/
public $countEnabled = false;

/**
* @inheritDoc
*/
protected $customPostActions = array(
'accept',
'reject'
);

protected function pluralizeKey()
{
return $this->resourceKey;
}
}
1 change: 1 addition & 0 deletions lib/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* --------------------------------------------------------------------------
* Order -> Child Resources
* --------------------------------------------------------------------------
* @property-read FulfillmentOrder $FulfillmentOrder
* @property-read Fulfillment $Fulfillment
* @property-read OrderRisk $Risk
* @property-read Refund $Refund
Expand Down

0 comments on commit d5759b3

Please sign in to comment.