Skip to content

Commit

Permalink
Merge pull request #20 from zf-fr/usage-charge
Browse files Browse the repository at this point in the history
Add usage charge
  • Loading branch information
bakura10 authored Aug 24, 2016
2 parents 4cbcc91 + fe48cdb commit a1b29aa
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.2.0

* Add support for usage charge methods (https://help.shopify.com/api/reference/usagecharge)

# 1.1.0

* Add `createDelegateAccessToken` endpoint ([more info on delegate tokens](https://help.shopify.com/api/guides/authentication/oauth#delegating-access-to-subsystems))
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@ Here is a list of supported endpoints (more to come in the future):
* updateCustomCollection(array $args = [])
* deleteCustomCollection(array $args = [])

**CUSTOM COLLECTION RELATED METHODS:**

* getCustomCollections(array $args = [])
* getCustomCollection(array $args = [])
* createCustomCollection(array $args = [])
* updateCustomCollection(array $args = [])
* deleteCustomCollection(array $args = [])

**EVENT RELATED METHODS:**

* getEvents(array $args = [])
Expand Down Expand Up @@ -307,6 +315,12 @@ Here is a list of supported endpoints (more to come in the future):
* updateProductVariant(array $args = [])
* deleteProductVariant(array $args = [])

**USAGE CHARGE RELATED METHODS:**

* getUsageCharges(array $args = [])
* getUsageCharge(array $args = [])
* createUsageCharge(array $args = [])

**WEBHOOK RELATED METHODS:**

* getWebhooks(array $args = [])
Expand Down
91 changes: 90 additions & 1 deletion src/ServiceDescription/Shopify-v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -2293,6 +2293,18 @@
'type' => 'string',
'required' => true
],
'capped_amount' => [
'description' => 'Capped amount (to use with usage charge)',
'location' => 'json',
'type' => 'number',
'required' => false
],
'terms' => [
'description' => 'Terms displayed to the merchant when accepting the charge (to use with usage charge)',
'location' => 'json',
'type' => 'string',
'required' => false
],
'test' => [
'description' => 'Test mode for the charge',
'location' => 'json',
Expand Down Expand Up @@ -2712,7 +2724,7 @@

/**
* --------------------------------------------------------------------------------
* ASSETS RELATED METHODS
* PRODUCT VARIANT RELATED METHODS
*
* DOC: https://docs.shopify.com/api/product_variant
* --------------------------------------------------------------------------------
Expand Down Expand Up @@ -2945,6 +2957,83 @@
]
],

/**
* --------------------------------------------------------------------------------
* USAGE CHARGES RELATED METHODS
*
* DOC: https://docs.shopify.com/api/usagecharge
* --------------------------------------------------------------------------------
*/

'GetUsageCharges' => [
'httpMethod' => 'GET',
'uri' => 'recurring_application_charges/{recurring_charge_id}/usage_charges.json',
'summary' => 'Retrieve a list of usage charges for the given recurring application charges',
'data' => ['root_key' => 'usage_charges'],
'parameters' => [
'recurring_charge_id' => [
'description' => 'Recurring charge from which we need to extract usage charges',
'location' => 'uri',
'type' => 'integer',
'required' => true
],
'fields' => [
'description' => 'Comma separated list of fields to retrieve',
'location' => 'query',
'type' => 'string',
'required' => false
]
]
],

'GetUsageCharge' => [
'httpMethod' => 'GET',
'uri' => 'recurring_application_charges/{recurring_charge_id}/usage_charges/{id}.json',
'summary' => 'Retrieve a specific usage charge',
'data' => ['root_key' => 'usage_charge'],
'parameters' => [
'id' => [
'description' => 'Specific usage charge ID',
'location' => 'uri',
'type' => 'integer',
'required' => true
],
'recurring_charge_id' => [
'description' => 'Recurring charge from which we need to extract usage charges',
'location' => 'uri',
'type' => 'integer',
'required' => true
],
'fields' => [
'description' => 'Comma separated list of fields to retrieve',
'location' => 'query',
'type' => 'string',
'required' => false
]
]
],

'CreateUsageCharge' => [
'httpMethod' => 'POST',
'uri' => 'recurring_application_charges/{recurring_charge_id}/usage_charges.json',
'summary' => 'Create a new usage charge',
'data' => ['root_key' => 'usage_charge'],
'parameters' => [
'description' => [
'description' => 'Usage charge description',
'location' => 'json',
'type' => 'string',
'required' => true
],
'price' => [
'description' => 'Price to charge',
'location' => 'json',
'type' => 'number',
'required' => true
]
]
],

/**
* --------------------------------------------------------------------------------
* WEBHOOK RELATED METHODS
Expand Down
6 changes: 6 additions & 0 deletions src/ShopifyClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@
* @method array createProductVariant(array $args = []) {@command Shopify CreateProductVariant}
* @method array updateProductVariant(array $args = []) {@command Shopify UpdateProductVariant}
* @method array deleteProductVariant(array $args = []) {@command Shopify DeleteProductVariant}
*
* USAGE CHARGE RELATED METHODS:
*
* @method array getUsageCharges(array $args = []) {@command Shopify GetUsageCharges}
* @method array getUsageCharge(array $args = []) {@command Shopify GetUsageCharge}
* @method array createUsageCharge(array $args = []) {@command Shopify CreateUsageCharge}
*
* WEBHOOK RELATED METHODS:
*
Expand Down

0 comments on commit a1b29aa

Please sign in to comment.