Skip to content

Commit 71f49b3

Browse files
authored
Merge pull request #171 from MCriggerXroadz/dev-shopifypayments
Dev shopifypayments
2 parents 979965a + 6a114af commit 71f49b3

File tree

5 files changed

+126
-1
lines changed

5 files changed

+126
-1
lines changed

lib/Balance.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* @author Robert Jacobson <rjacobson@thexroadz.com>
5+
* @author Matthew Crigger <mcrigger@thexroadz.com>
6+
*
7+
* @see https://help.shopify.com/en/api/reference/shopify_payments/balance Shopify API Reference for Shopify Payment Balance
8+
*/
9+
10+
namespace PHPShopify;
11+
12+
/**
13+
* --------------------------------------------------------------------------
14+
* ShopifyPayment -> Child Resources
15+
* --------------------------------------------------------------------------
16+
*
17+
*
18+
*/
19+
class Balance extends ShopifyResource
20+
{
21+
/**
22+
* @inheritDoc
23+
*/
24+
protected $resourceKey = 'balance';
25+
26+
/**
27+
* Get the pluralized version of the resource key
28+
*
29+
* Normally its the same as $resourceKey appended with 's', when it's different, the specific resource class will override this function
30+
*
31+
* @return string
32+
*/
33+
protected function pluralizeKey()
34+
{
35+
return $this->resourceKey;
36+
}
37+
38+
/**
39+
* If the resource is read only. (No POST / PUT / DELETE actions)
40+
*
41+
* @var boolean
42+
*/
43+
public $readOnly = true;
44+
45+
/**
46+
* @inheritDoc
47+
*/
48+
protected $childResource = array(
49+
'Transactions'
50+
);
51+
}

lib/Payouts.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* @author Robert Jacobson <rjacobson@thexroadz.com>
5+
* @author Matthew Crigger <mcrigger@thexroadz.com>
6+
*
7+
* @see https://help.shopify.com/en/api/reference/shopify_payments/payout Shopify API Reference for Shopify Payment Payouts
8+
*/
9+
10+
namespace PHPShopify;
11+
12+
/**
13+
* --------------------------------------------------------------------------
14+
* ShopifyPayment -> Child Resources
15+
* --------------------------------------------------------------------------
16+
*
17+
*
18+
*/
19+
class Payouts extends ShopifyResource
20+
{
21+
/**
22+
* @inheritDoc
23+
*/
24+
protected $resourceKey = 'payout';
25+
}

lib/ShopifyPayment.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
*
1919
* @method ShopifyResource Dispute(integer $id = null)
2020
*
21+
* @property-read ShopifyResource $Balance
22+
*
23+
* @method ShopifyResource Balance(integer $id = null)
24+
*
25+
* @property-read ShopifyResource $Payouts
26+
*
27+
* @method ShopifyResource Payouts(integer $id = null)
28+
*
29+
2130
*/
2231
class ShopifyPayment extends ShopifyResource
2332
{
@@ -26,10 +35,19 @@ class ShopifyPayment extends ShopifyResource
2635
*/
2736
public $resourceKey = 'shopify_payment';
2837

38+
/**
39+
* If the resource is read only. (No POST / PUT / DELETE actions)
40+
*
41+
* @var boolean
42+
*/
43+
public $readOnly = true;
44+
2945
/**
3046
* @inheritDoc
3147
*/
3248
protected $childResource = array(
33-
'Dispute'
49+
'Balance',
50+
'Dispute',
51+
'Payouts',
3452
);
3553
}

lib/ShopifySDK.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
* @method ScriptTag ScriptTag(integer $id = null)
147147
* @method ShippingZone ShippingZone(integer $id = null)
148148
* @method Shop Shop(integer $id = null)
149+
* @method ShopifyPayment ShopifyPayment()
149150
* @method SmartCollection SmartCollection(integer $id = null)
150151
* @method Theme Theme(int $id = null)
151152
* @method User User(integer $id = null)
@@ -235,16 +236,20 @@ class ShopifySDK
235236
protected $childResources = array(
236237
'Article' => 'Blog',
237238
'Asset' => 'Theme',
239+
'Balance' => 'ShopifyPayment',
238240
'CustomerAddress' => 'Customer',
241+
'Dispute' => 'ShopifyPayment',
239242
'Fulfillment' => 'Order',
240243
'FulfillmentEvent' => 'Fulfillment',
241244
'OrderRisk' => 'Order',
245+
'Payouts' => 'ShopifyPayment',
242246
'ProductImage' => 'Product',
243247
'ProductVariant' => 'Product',
244248
'DiscountCode' => 'PriceRule',
245249
'Province' => 'Country',
246250
'Refund' => 'Order',
247251
'Transaction' => 'Order',
252+
'Transactions' => 'Balance',
248253
'UsageCharge' => 'RecurringApplicationCharge',
249254
);
250255

lib/Transactions.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* @author Robert Jacobson <rjacobson@thexroadz.com>
5+
* @author Matthew Crigger <mcrigger@thexroadz.com>
6+
*
7+
* @see https://help.shopify.com/en/api/reference/shopify_payments/transaction Shopify API Reference for Shopify Payment Transactions
8+
*/
9+
10+
namespace PHPShopify;
11+
12+
13+
class Transactions extends ShopifyResource
14+
{
15+
/**
16+
* @inheritDoc
17+
*/
18+
protected $resourceKey = 'transaction';
19+
20+
/**
21+
* If the resource is read only. (No POST / PUT / DELETE actions)
22+
*
23+
* @var boolean
24+
*/
25+
public $readOnly = true;
26+
}

0 commit comments

Comments
 (0)