Skip to content

Commit

Permalink
Merge pull request #23 from danizord/feature/order-transactions
Browse files Browse the repository at this point in the history
Add support for order transactions
  • Loading branch information
bakura10 authored Sep 30, 2016
2 parents daf3a10 + 5fccfd7 commit e9d1ac4
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.4.0

* Add support for order transaction methods (https://help.shopify.com/api/reference/transaction)

# 1.3.0

* Added new endpoint for accessing articles without the blog reference.
Expand Down
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,6 @@ 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 @@ -318,6 +310,12 @@ Here is a list of supported endpoints (more to come in the future):
* updateProductVariant(array $args = [])
* deleteProductVariant(array $args = [])

**TRANSACTION RELATED METHODS:**

* getTransactions(array $args = [])
* getTransaction(array $args = [])
* createTransaction(array $args = [])

**USAGE CHARGE RELATED METHODS:**

* getUsageCharges(array $args = [])
Expand All @@ -334,4 +332,4 @@ Here is a list of supported endpoints (more to come in the future):

**OTHER METHODS:**

* createDelegateAccessToken(array $args = [])
* createDelegateAccessToken(array $args = [])
133 changes: 133 additions & 0 deletions src/ServiceDescription/Shopify-v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -3115,6 +3115,139 @@
]
],

/**
* --------------------------------------------------------------------------------
* TRANSACTION RELATED METHODS
*
* DOC: https://docs.shopify.com/api/transaction
* --------------------------------------------------------------------------------
*/

'GetTransactions' => [
'httpMethod' => 'GET',
'uri' => 'orders/{order_id}/transactions.json',
'summary' => 'Retrieve a list of transactions for a given order',
'data' => ['root_key' => 'transactions'],
'parameters' => [
'order_id' => [
'description' => 'Order from which we need to extract transactions',
'location' => 'uri',
'type' => 'integer',
'required' => true
],
'since_id' => [
'description' => 'Restrict results after the specified id',
'location' => 'query',
'type' => 'integer',
'required' => false
],
'fields' => [
'description' => 'Comma separated list of fields to retrieve',
'location' => 'query',
'type' => 'string',
'required' => false
]
]
],

'GetTransaction' => [
'httpMethod' => 'GET',
'uri' => 'orders/{order_id}/transactions/{id}.json',
'summary' => 'Retrieve a specific transaction',
'data' => ['root_key' => 'transaction'],
'parameters' => [
'order_id' => [
'description' => 'Order from which we need to extract transactions',
'location' => 'uri',
'type' => 'integer',
'required' => true
],
'id' => [
'description' => 'Transaction ID',
'location' => 'uri',
'type' => 'integer',
'required' => true
],
'fields' => [
'description' => 'Comma separated list of fields to retrieve',
'location' => 'query',
'type' => 'string',
'required' => false
]
]
],

'CreateTransaction' => [
'httpMethod' => 'POST',
'uri' => 'orders/{order_id}/transactions.json',
'summary' => 'Create a new transaction for a given order',
'data' => ['root_key' => 'transaction'],
'parameters' => [
'order_id' => [
'description' => 'Order from which we need to extract transactions',
'location' => 'uri',
'type' => 'integer',
'required' => true
],
'amount' => [
'description' => 'The amount of money that the transaction was for',
'location' => 'json',
'type' => 'string',
'required' => false
],
'authorization' => [
'description' => 'The authorization code associated with the transaction',
'location' => 'json',
'type' => 'string',
'required' => false
],
'device_id' => [
'description' => 'The unique identifier for the device',
'location' => 'json',
'type' => 'string',
'required' => false
],
'gateway' => [
'description' => 'The name of the gateway the transaction was issued through',
'location' => 'json',
'type' => 'string',
'required' => false
],
'kind' => [
'description' => 'The kind of transaction',
'location' => 'json',
'type' => 'string',
'required' => true,
'enum' => ['authorization', 'capture', 'sale', 'void', 'refund'],
],
'error_code' => [
'description' => 'A standardized error code, independent of the payment provider',
'location' => 'json',
'type' => 'string',
'required' => false
],
'status' => [
'description' => 'The status of the transaction',
'location' => 'json',
'type' => 'string',
'required' => false,
'enum' => ['pending', 'failure', 'success', 'error']
],
'test' => [
'description' => 'The option to use the transaction for testing purposes',
'location' => 'json',
'type' => 'boolean',
'required' => false
],
'currency' => [
'description' => 'The three letter code (ISO 4217) for the currency used for the payment',
'location' => 'json',
'type' => 'string',
'required' => false
],
]
],

/**
* --------------------------------------------------------------------------------
* USAGE CHARGES 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 @@ -154,6 +154,12 @@
* @method array updateProductVariant(array $args = []) {@command Shopify UpdateProductVariant}
* @method array deleteProductVariant(array $args = []) {@command Shopify DeleteProductVariant}
*
* TRANSACTION RELATED METHODS:
*
* @method array getTransactions(array $args = []) {@command Shopify GetTransactions}
* @method array getTransaction(array $args = []) {@command Shopify GetTransaction}
* @method array createTransaction(array $args = []) {@command Shopify CreateTransaction}
*
* USAGE CHARGE RELATED METHODS:
*
* @method array getUsageCharges(array $args = []) {@command Shopify GetUsageCharges}
Expand Down

0 comments on commit e9d1ac4

Please sign in to comment.