Skip to content

Commit b874144

Browse files
authored
Merge pull request #106 from thomashondema/draftorder
added draftorder basics
2 parents 929a1cc + 9358bd2 commit b874144

File tree

2 files changed

+58
-19
lines changed

2 files changed

+58
-19
lines changed

lib/DraftOrder.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* @author Thomas Hondema <thomashondema@live.com>
5+
* Created at 8/14/19 18:28 PM UTC+02:00
6+
*
7+
* @see https://help.shopify.com/api/reference/draftorder Shopify API Reference for DraftOrder
8+
*/
9+
10+
namespace PHPShopify;
11+
12+
13+
14+
/**
15+
* --------------------------------------------------------------------------
16+
* DraftOrder -> Custom actions
17+
* --------------------------------------------------------------------------
18+
* @method array send_invoice() Send the invoice for a DraftOrder
19+
* @method array complete() Complete a DraftOrder
20+
*
21+
*/
22+
class DraftOrder extends ShopifyResource
23+
{
24+
/**
25+
* @inheritDoc
26+
*/
27+
protected $resourceKey = 'draft_order';
28+
29+
/**
30+
* @inheritDoc
31+
*/
32+
protected $customPostActions = array(
33+
'send_invoice',
34+
'complete',
35+
);
36+
}

lib/ShopifySDK.php

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
* @property-read Customer $Customer
7979
* @property-read CustomerSavedSearch $CustomerSavedSearch
8080
* @property-read Discount $Discount
81+
* @property-read DraftOrder $DraftOrder
8182
* @property-read PriceRule $PriceRule
8283
* @property-read Event $Event
8384
* @property-read FulfillmentService $FulfillmentService
@@ -115,6 +116,7 @@
115116
* @method Customer Customer(integer $id = null)
116117
* @method CustomerSavedSearch CustomerSavedSearch(integer $id = null)
117118
* @method Discount Discount(integer $id = null)
119+
* @method DraftOrder DraftOrder(integer $id = null)
118120
* @method PriceRule PriceRule(integer $id = null)
119121
* @method Event Event(integer $id = null)
120122
* @method FulfillmentService FulfillmentService(integer $id = null)
@@ -143,25 +145,6 @@
143145
*/
144146
class ShopifySDK
145147
{
146-
/**
147-
* @var float microtime of last api call
148-
*/
149-
public static $microtimeOfLastApiCall;
150-
151-
/**
152-
* @var float Minimum gap in seconds to maintain between 2 api calls
153-
*/
154-
public static $timeAllowedForEachApiCall = .5;
155-
156-
/**
157-
* Shop / API configurations
158-
*
159-
* @var array
160-
*/
161-
public static $config = array(
162-
'ApiVersion' => '2019-04'
163-
);
164-
165148
/**
166149
* List of available resources which can be called from this client
167150
*
@@ -180,6 +163,7 @@ class ShopifySDK
180163
'Customer',
181164
'CustomerSavedSearch',
182165
'Discount',
166+
'DraftOrder',
183167
'Event',
184168
'FulfillmentService',
185169
'GiftCard',
@@ -208,6 +192,25 @@ class ShopifySDK
208192
'GraphQL'
209193
);
210194

195+
/**
196+
* @var float microtime of last api call
197+
*/
198+
public static $microtimeOfLastApiCall;
199+
200+
/**
201+
* @var float Minimum gap in seconds to maintain between 2 api calls
202+
*/
203+
public static $timeAllowedForEachApiCall = .5;
204+
205+
/**
206+
* Shop / API configurations
207+
*
208+
* @var array
209+
*/
210+
public static $config = array(
211+
'ApiVersion' => '2019-04'
212+
);
213+
211214
/**
212215
* List of resources which are only available through a parent resource
213216
*

0 commit comments

Comments
 (0)