From 9358bd2b87764c0e26e7e2b7aa9f31c5ba176239 Mon Sep 17 00:00:00 2001 From: Thomas Hondema Date: Wed, 14 Aug 2019 18:43:28 +0200 Subject: [PATCH] added draftorder basics --- lib/DraftOrder.php | 36 ++++++++++++++++++++++++++++++++++++ lib/ShopifySDK.php | 41 ++++++++++++++++++++++------------------- 2 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 lib/DraftOrder.php diff --git a/lib/DraftOrder.php b/lib/DraftOrder.php new file mode 100644 index 0000000..b67602a --- /dev/null +++ b/lib/DraftOrder.php @@ -0,0 +1,36 @@ + + * Created at 8/14/19 18:28 PM UTC+02:00 + * + * @see https://help.shopify.com/api/reference/draftorder Shopify API Reference for DraftOrder + */ + +namespace PHPShopify; + + + +/** + * -------------------------------------------------------------------------- + * DraftOrder -> Custom actions + * -------------------------------------------------------------------------- + * @method array send_invoice() Send the invoice for a DraftOrder + * @method array complete() Complete a DraftOrder + * + */ +class DraftOrder extends ShopifyResource +{ + /** + * @inheritDoc + */ + protected $resourceKey = 'draft_order'; + + /** + * @inheritDoc + */ + protected $customPostActions = array( + 'send_invoice', + 'complete', + ); +} \ No newline at end of file diff --git a/lib/ShopifySDK.php b/lib/ShopifySDK.php index 0f623f8..a86182d 100644 --- a/lib/ShopifySDK.php +++ b/lib/ShopifySDK.php @@ -78,6 +78,7 @@ * @property-read Customer $Customer * @property-read CustomerSavedSearch $CustomerSavedSearch * @property-read Discount $Discount + * @property-read DraftOrder $DraftOrder * @property-read PriceRule $PriceRule * @property-read Event $Event * @property-read FulfillmentService $FulfillmentService @@ -115,6 +116,7 @@ * @method Customer Customer(integer $id = null) * @method CustomerSavedSearch CustomerSavedSearch(integer $id = null) * @method Discount Discount(integer $id = null) + * @method DraftOrder DraftOrder(integer $id = null) * @method PriceRule PriceRule(integer $id = null) * @method Event Event(integer $id = null) * @method FulfillmentService FulfillmentService(integer $id = null) @@ -143,25 +145,6 @@ */ class ShopifySDK { - /** - * @var float microtime of last api call - */ - public static $microtimeOfLastApiCall; - - /** - * @var float Minimum gap in seconds to maintain between 2 api calls - */ - public static $timeAllowedForEachApiCall = .5; - - /** - * Shop / API configurations - * - * @var array - */ - public static $config = array( - 'ApiVersion' => '2019-04' - ); - /** * List of available resources which can be called from this client * @@ -180,6 +163,7 @@ class ShopifySDK 'Customer', 'CustomerSavedSearch', 'Discount', + 'DraftOrder', 'Event', 'FulfillmentService', 'GiftCard', @@ -208,6 +192,25 @@ class ShopifySDK 'GraphQL' ); + /** + * @var float microtime of last api call + */ + public static $microtimeOfLastApiCall; + + /** + * @var float Minimum gap in seconds to maintain between 2 api calls + */ + public static $timeAllowedForEachApiCall = .5; + + /** + * Shop / API configurations + * + * @var array + */ + public static $config = array( + 'ApiVersion' => '2019-04' + ); + /** * List of resources which are only available through a parent resource *