Skip to content

Dev shopifypayments #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions lib/Balance.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/**
* Created by PhpStorm.
* @author Robert Jacobson <rjacobson@thexroadz.com>
* @author Matthew Crigger <mcrigger@thexroadz.com>
*
* @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'
);
}
25 changes: 25 additions & 0 deletions lib/Payouts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* Created by PhpStorm.
* @author Robert Jacobson <rjacobson@thexroadz.com>
* @author Matthew Crigger <mcrigger@thexroadz.com>
*
* @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';
}
20 changes: 19 additions & 1 deletion lib/ShopifyPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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',
);
}
5 changes: 5 additions & 0 deletions lib/ShopifySDK.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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',
);

Expand Down
26 changes: 26 additions & 0 deletions lib/Transactions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Created by PhpStorm.
* @author Robert Jacobson <rjacobson@thexroadz.com>
* @author Matthew Crigger <mcrigger@thexroadz.com>
*
* @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;
}