Skip to content

add support for Order()->FulfillmentOrder and FulfillmentRequests #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,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 @@ -358,8 +362,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