Skip to content

Commit e12905e

Browse files
committed
Added the Gift Card Adjustment Resource
1 parent eb26e68 commit e12905e

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ Some resources are available directly, some resources are only available through
357357
- FulfillmentOrder -> [FulfillmentRequest](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentrequest)
358358
- FulfillmentOrder -> [Fulfillment](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillment)
359359
- [GiftCard](https://help.shopify.com/api/reference/gift_card) _(Shopify Plus Only)_
360+
- [GiftCardAdjustment](https://shopify.dev/docs/api/admin-rest/2023-01/resources/gift-card-adjustment) _(Shopify Plus Only)_
360361
- [InventoryItem](https://help.shopify.com/api/reference/inventoryitem)
361362
- [InventoryLevel](https://help.shopify.com/api/reference/inventorylevel)
362363
- [Location](https://help.shopify.com/api/reference/location/) _(read only)_

lib/GiftCard.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,11 @@ public function disable()
4545

4646
return $this->post($dataArray, $url);
4747
}
48-
}
48+
49+
/**
50+
* @inheritDoc
51+
*/
52+
protected $childResource = array(
53+
'GiftCardAdjustment' => 'Adjustment'
54+
);
55+
}

lib/GiftCardAdjustment.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* @author Tareq Mahmood <tareqtms@yahoo.com>
5+
* Created at: 8/21/16 8:39 AM UTC+06:00
6+
*
7+
* @see https://shopify.dev/docs/api/admin-rest/2023-01/resources/gift-card-adjustment Shopify API Reference for Gift Card Adjustment
8+
* @note - requires gift_card_adjustments access scope enabled by Shopify Support
9+
*/
10+
11+
namespace PHPShopify;
12+
13+
14+
class GiftCardAdjustment extends ShopifyResource
15+
{
16+
/**
17+
* @inheritDoc
18+
*/
19+
protected $resourceKey = 'adjustment';
20+
}

lib/ShopifySDK.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
* @property-read Fulfillment $Fulfillment
9191
* @property-read FulfillmentService $FulfillmentService
9292
* @property-read GiftCard $GiftCard
93+
* @property-read GiftCardAdjustment $GiftCardAdjustment
9394
* @property-read InventoryItem $InventoryItem
9495
* @property-read InventoryLevel $InventoryLevel
9596
* @property-read Location $Location
@@ -140,6 +141,7 @@
140141
* @method FulfillmentService FulfillmentService(integer $id = null)
141142
* @method FulfillmentOrder FulfillmentOrder(integer $id = null)
142143
* @method GiftCard GiftCard(integer $id = null)
144+
* @method GiftCardAdjustment GiftCardAdjustment(integer $id = null)
143145
* @method InventoryItem InventoryItem(integer $id = null)
144146
* @method InventoryLevel InventoryLevel(integer $id = null)
145147
* @method Location Location(integer $id = null)
@@ -261,6 +263,7 @@ class ShopifySDK
261263
'Dispute' => 'ShopifyPayment',
262264
'Fulfillment' => 'Order',
263265
'FulfillmentEvent' => 'Fulfillment',
266+
'GiftCardAdjustment'=> 'GiftCard',
264267
'OrderRisk' => 'Order',
265268
'Payouts' => 'ShopifyPayment',
266269
'ProductImage' => 'Product',

0 commit comments

Comments
 (0)