Skip to content

Commit ae83c92

Browse files
committed
[Fixes #107] Discount code 'lookup'
1 parent f474538 commit ae83c92

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ Some resources are available directly, some resources are only available through
290290
- CustomerSavedSearch -> [Customer](https://help.shopify.com/api/reference/customer/)
291291
- [DraftOrder](https://help.shopify.com/api/reference/draftorder)
292292
- [Discount](https://help.shopify.com/api/reference/discount) _(Shopify Plus Only)_
293+
- [DiscountCode](https://help.shopify.com/en/api/reference/discounts/discountcode)
293294
- [Event](https://help.shopify.com/api/reference/event/)
294295
- [FulfillmentService](https://help.shopify.com/api/reference/fulfillmentservice)
295296
- [GiftCard](https://help.shopify.com/api/reference/gift_card) _(Shopify Plus Only)_
@@ -385,9 +386,9 @@ The custom methods are specific to some resources which may not be available for
385386
Perform bulk operations against a number of addresses
386387

387388
- DraftOrder ->
388-
- [send_invoice()]()
389+
- [send_invoice($data)]()
389390
Send the invoice for a DraftOrder
390-
- [complete()]()
391+
- [complete($data)]()
391392
Complete a DraftOrder
392393

393394
- Discount ->
@@ -396,6 +397,10 @@ The custom methods are specific to some resources which may not be available for
396397
- [disable()]()
397398
Disable a discount
398399

400+
- DiscountCode ->
401+
- [lookup($data)]()
402+
Retrieves the location of a discount code.
403+
399404
- Fulfillment ->
400405
- [complete()](https://help.shopify.com/api/reference/fulfillment#complete)
401406
Complete a fulfillment

lib/DiscountCode.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,25 @@
1010
namespace PHPShopify;
1111

1212

13+
/**
14+
* --------------------------------------------------------------------------
15+
* DiscountCode -> Custom actions
16+
* --------------------------------------------------------------------------
17+
* @method array lookup() Retrieves the location of a discount code.
18+
*
19+
*/
20+
1321
class DiscountCode extends ShopifyResource
1422
{
1523
/**
1624
* @inheritDoc
1725
*/
1826
protected $resourceKey = 'discount_code';
27+
28+
/**
29+
* @inheritDoc
30+
*/
31+
protected $customGetActions = array(
32+
'lookup',
33+
);
1934
}

lib/ShopifySDK.php

Lines changed: 3 additions & 0 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 DiscountCode $DiscountCode
8182
* @property-read DraftOrder $DraftOrder
8283
* @property-read PriceRule $PriceRule
8384
* @property-read Event $Event
@@ -117,6 +118,7 @@
117118
* @method CustomerSavedSearch CustomerSavedSearch(integer $id = null)
118119
* @method Discount Discount(integer $id = null)
119120
* @method DraftOrder DraftOrder(integer $id = null)
121+
* @method DiscountCode DiscountCode(integer $id = null)
120122
* @method PriceRule PriceRule(integer $id = null)
121123
* @method Event Event(integer $id = null)
122124
* @method FulfillmentService FulfillmentService(integer $id = null)
@@ -163,6 +165,7 @@ class ShopifySDK
163165
'Customer',
164166
'CustomerSavedSearch',
165167
'Discount',
168+
'DiscountCode',
166169
'DraftOrder',
167170
'Event',
168171
'FulfillmentService',

0 commit comments

Comments
 (0)