diff --git a/lib/Balance.php b/lib/Balance.php new file mode 100644 index 0000000..4144c5c --- /dev/null +++ b/lib/Balance.php @@ -0,0 +1,51 @@ + + * @author Matthew Crigger + * + * @see https://help.shopify.com/en/api/reference/shopify_payments/balance Shopify API Reference for Shopify Payment Balance + */ + +namespace PHPShopify; + +/** + * -------------------------------------------------------------------------- + * ShopifyPayment -> Child Resources + * -------------------------------------------------------------------------- + * + * + */ +class Balance extends ShopifyResource +{ + /** + * @inheritDoc + */ + protected $resourceKey = 'balance'; + + /** + * Get the pluralized version of the resource key + * + * Normally its the same as $resourceKey appended with 's', when it's different, the specific resource class will override this function + * + * @return string + */ + protected function pluralizeKey() + { + return $this->resourceKey; + } + + /** + * If the resource is read only. (No POST / PUT / DELETE actions) + * + * @var boolean + */ + public $readOnly = true; + + /** + * @inheritDoc + */ + protected $childResource = array( + 'Transactions' + ); +} \ No newline at end of file diff --git a/lib/Payouts.php b/lib/Payouts.php new file mode 100644 index 0000000..e43245b --- /dev/null +++ b/lib/Payouts.php @@ -0,0 +1,25 @@ + + * @author Matthew Crigger + * + * @see https://help.shopify.com/en/api/reference/shopify_payments/payout Shopify API Reference for Shopify Payment Payouts + */ + +namespace PHPShopify; + +/** + * -------------------------------------------------------------------------- + * ShopifyPayment -> Child Resources + * -------------------------------------------------------------------------- + * + * + */ +class Payouts extends ShopifyResource +{ + /** + * @inheritDoc + */ + protected $resourceKey = 'payout'; +} \ No newline at end of file diff --git a/lib/ShopifyPayment.php b/lib/ShopifyPayment.php index a6da406..54fc6b3 100644 --- a/lib/ShopifyPayment.php +++ b/lib/ShopifyPayment.php @@ -18,6 +18,15 @@ * * @method ShopifyResource Dispute(integer $id = null) * + * @property-read ShopifyResource $Balance + * + * @method ShopifyResource Balance(integer $id = null) + * + * @property-read ShopifyResource $Payouts + * + * @method ShopifyResource Payouts(integer $id = null) + * + */ class ShopifyPayment extends ShopifyResource { @@ -26,10 +35,19 @@ class ShopifyPayment extends ShopifyResource */ public $resourceKey = 'shopify_payment'; + /** + * If the resource is read only. (No POST / PUT / DELETE actions) + * + * @var boolean + */ + public $readOnly = true; + /** * @inheritDoc */ protected $childResource = array( - 'Dispute' + 'Balance', + 'Dispute', + 'Payouts', ); } \ No newline at end of file diff --git a/lib/ShopifySDK.php b/lib/ShopifySDK.php index 94dbe81..9000e84 100644 --- a/lib/ShopifySDK.php +++ b/lib/ShopifySDK.php @@ -146,6 +146,7 @@ * @method ScriptTag ScriptTag(integer $id = null) * @method ShippingZone ShippingZone(integer $id = null) * @method Shop Shop(integer $id = null) + * @method ShopifyPayment ShopifyPayment() * @method SmartCollection SmartCollection(integer $id = null) * @method Theme Theme(int $id = null) * @method User User(integer $id = null) @@ -235,16 +236,20 @@ class ShopifySDK protected $childResources = array( 'Article' => 'Blog', 'Asset' => 'Theme', + 'Balance' => 'ShopifyPayment', 'CustomerAddress' => 'Customer', + 'Dispute' => 'ShopifyPayment', 'Fulfillment' => 'Order', 'FulfillmentEvent' => 'Fulfillment', 'OrderRisk' => 'Order', + 'Payouts' => 'ShopifyPayment', 'ProductImage' => 'Product', 'ProductVariant' => 'Product', 'DiscountCode' => 'PriceRule', 'Province' => 'Country', 'Refund' => 'Order', 'Transaction' => 'Order', + 'Transactions' => 'Balance', 'UsageCharge' => 'RecurringApplicationCharge', ); diff --git a/lib/Transactions.php b/lib/Transactions.php new file mode 100644 index 0000000..0b45020 --- /dev/null +++ b/lib/Transactions.php @@ -0,0 +1,26 @@ + + * @author Matthew Crigger + * + * @see https://help.shopify.com/en/api/reference/shopify_payments/transaction Shopify API Reference for Shopify Payment Transactions + */ + +namespace PHPShopify; + + +class Transactions extends ShopifyResource +{ + /** + * @inheritDoc + */ + protected $resourceKey = 'transaction'; + + /** + * If the resource is read only. (No POST / PUT / DELETE actions) + * + * @var boolean + */ + public $readOnly = true; +}