zipmoney_merchantapi 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +69 -0
  4. data/README.md +128 -0
  5. data/Rakefile +8 -0
  6. data/docs/Address.md +15 -0
  7. data/docs/Authority.md +9 -0
  8. data/docs/CaptureChargeRequest.md +8 -0
  9. data/docs/Charge.md +17 -0
  10. data/docs/ChargeCollection.md +8 -0
  11. data/docs/ChargeOrder.md +11 -0
  12. data/docs/ChargesApi.md +307 -0
  13. data/docs/Checkout.md +18 -0
  14. data/docs/CheckoutConfiguration.md +8 -0
  15. data/docs/CheckoutFeatures.md +8 -0
  16. data/docs/CheckoutFeaturesTokenisation.md +8 -0
  17. data/docs/CheckoutOrder.md +13 -0
  18. data/docs/CheckoutsApi.md +119 -0
  19. data/docs/CreateChargeRequest.md +14 -0
  20. data/docs/CreateCheckoutRequest.md +13 -0
  21. data/docs/CreateCheckoutRequestFeatures.md +8 -0
  22. data/docs/CreateCheckoutRequestFeaturesTokenisation.md +8 -0
  23. data/docs/CreateRefundRequest.md +11 -0
  24. data/docs/CreateTokenRequest.md +8 -0
  25. data/docs/Customer.md +15 -0
  26. data/docs/CustomersApi.md +96 -0
  27. data/docs/ErrorResponse.md +8 -0
  28. data/docs/ErrorResponseError.md +10 -0
  29. data/docs/ErrorResponseErrorDetails.md +9 -0
  30. data/docs/InlineResponse200.md +8 -0
  31. data/docs/Metadata.md +7 -0
  32. data/docs/OrderItem.md +16 -0
  33. data/docs/OrderShipping.md +10 -0
  34. data/docs/OrderShippingTracking.md +10 -0
  35. data/docs/Refund.md +13 -0
  36. data/docs/RefundsApi.md +181 -0
  37. data/docs/SettlementsApi.md +96 -0
  38. data/docs/Shopper.md +17 -0
  39. data/docs/ShopperStatistics.md +16 -0
  40. data/docs/Token.md +11 -0
  41. data/docs/TokensApi.md +66 -0
  42. data/lib/zip_money.rb +68 -0
  43. data/lib/zip_money/api/charges_api.rb +301 -0
  44. data/lib/zip_money/api/checkouts_api.rb +120 -0
  45. data/lib/zip_money/api/customers_api.rb +116 -0
  46. data/lib/zip_money/api/refunds_api.rb +181 -0
  47. data/lib/zip_money/api/settlements_api.rb +116 -0
  48. data/lib/zip_money/api/tokens_api.rb +70 -0
  49. data/lib/zip_money/api_client.rb +386 -0
  50. data/lib/zip_money/api_error.rb +31 -0
  51. data/lib/zip_money/configuration.rb +238 -0
  52. data/lib/zip_money/models/address.rb +413 -0
  53. data/lib/zip_money/models/authority.rb +235 -0
  54. data/lib/zip_money/models/capture_charge_request.rb +206 -0
  55. data/lib/zip_money/models/charge.rb +369 -0
  56. data/lib/zip_money/models/charge_collection.rb +188 -0
  57. data/lib/zip_money/models/charge_order.rb +250 -0
  58. data/lib/zip_money/models/checkout.rb +344 -0
  59. data/lib/zip_money/models/checkout_configuration.rb +187 -0
  60. data/lib/zip_money/models/checkout_features.rb +181 -0
  61. data/lib/zip_money/models/checkout_features_tokenisation.rb +184 -0
  62. data/lib/zip_money/models/checkout_order.rb +299 -0
  63. data/lib/zip_money/models/create_charge_request.rb +289 -0
  64. data/lib/zip_money/models/create_checkout_request.rb +272 -0
  65. data/lib/zip_money/models/create_checkout_request_features.rb +181 -0
  66. data/lib/zip_money/models/create_checkout_request_features_tokenisation.rb +189 -0
  67. data/lib/zip_money/models/create_refund_request.rb +246 -0
  68. data/lib/zip_money/models/create_token_request.rb +186 -0
  69. data/lib/zip_money/models/customer.rb +310 -0
  70. data/lib/zip_money/models/error_response.rb +181 -0
  71. data/lib/zip_money/models/error_response_error.rb +211 -0
  72. data/lib/zip_money/models/error_response_error_details.rb +190 -0
  73. data/lib/zip_money/models/inline_response_200.rb +188 -0
  74. data/lib/zip_money/models/metadata.rb +172 -0
  75. data/lib/zip_money/models/order_item.rb +333 -0
  76. data/lib/zip_money/models/order_shipping.rb +200 -0
  77. data/lib/zip_money/models/order_shipping_tracking.rb +247 -0
  78. data/lib/zip_money/models/refund.rb +252 -0
  79. data/lib/zip_money/models/shopper.rb +339 -0
  80. data/lib/zip_money/models/shopper_statistics.rb +295 -0
  81. data/lib/zip_money/models/token.rb +228 -0
  82. data/lib/zip_money/version.rb +8 -0
  83. data/spec/api/charges_api_spec.rb +114 -0
  84. data/spec/api/checkouts_api_spec.rb +54 -0
  85. data/spec/api/customers_api_spec.rb +51 -0
  86. data/spec/api/refunds_api_spec.rb +67 -0
  87. data/spec/api/settlements_api_spec.rb +51 -0
  88. data/spec/api/tokens_api_spec.rb +41 -0
  89. data/spec/api_client_spec.rb +219 -0
  90. data/spec/auth.json +1 -0
  91. data/spec/configuration_spec.rb +50 -0
  92. data/spec/models/address_spec.rb +77 -0
  93. data/spec/models/authority_spec.rb +45 -0
  94. data/spec/models/capture_charge_request_spec.rb +35 -0
  95. data/spec/models/charge_collection_spec.rb +35 -0
  96. data/spec/models/charge_order_spec.rb +53 -0
  97. data/spec/models/charge_spec.rb +93 -0
  98. data/spec/models/checkout_configuration_spec.rb +35 -0
  99. data/spec/models/checkout_features_spec.rb +35 -0
  100. data/spec/models/checkout_features_tokenisation_spec.rb +35 -0
  101. data/spec/models/checkout_order_spec.rb +65 -0
  102. data/spec/models/checkout_spec.rb +103 -0
  103. data/spec/models/create_charge_request_spec.rb +75 -0
  104. data/spec/models/create_checkout_request_features_spec.rb +35 -0
  105. data/spec/models/create_checkout_request_features_tokenisation_spec.rb +35 -0
  106. data/spec/models/create_checkout_request_spec.rb +69 -0
  107. data/spec/models/create_refund_request_spec.rb +53 -0
  108. data/spec/models/create_token_request_spec.rb +35 -0
  109. data/spec/models/customer_spec.rb +81 -0
  110. data/spec/models/error_response_error_details_spec.rb +41 -0
  111. data/spec/models/error_response_error_spec.rb +47 -0
  112. data/spec/models/error_response_spec.rb +35 -0
  113. data/spec/models/inline_response_200_spec.rb +35 -0
  114. data/spec/models/metadata_spec.rb +29 -0
  115. data/spec/models/order_item_spec.rb +87 -0
  116. data/spec/models/order_shipping_spec.rb +47 -0
  117. data/spec/models/order_shipping_tracking_spec.rb +47 -0
  118. data/spec/models/refund_spec.rb +65 -0
  119. data/spec/models/shopper_spec.rb +92 -0
  120. data/spec/models/shopper_statistics_spec.rb +86 -0
  121. data/spec/models/token_spec.rb +52 -0
  122. data/spec/payload_helper.rb +96 -0
  123. data/spec/spec_helper.rb +104 -0
  124. data/zipmoney_merchantapi.gemspec +39 -0
  125. metadata +387 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bc7fbec9ca15a7ea7dcfc1275bb0bd59595e44cc
4
+ data.tar.gz: 5a25a954c186d8491c194314fc7a37cdf3591e6b
5
+ SHA512:
6
+ metadata.gz: 42f21a8e9f0e1516af44209c7e9f9759149e91bc158a1f4a731ac37456270d5f468a82932146555a7801b54ebe6c73d36594a572746da13ce40888e28f68104b
7
+ data.tar.gz: 3c356bfd538e75cc37ebd0d23c17e306cb602ec52b5ae1342b7e79ac76937c55aefd58002cfc215391e201a815fc0f6d54b6f8f10bcb8c80c0d35f20c0383204
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 12.0.0'
7
+ end
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ zipmoney_merchantapi (1.0.0)
5
+ json (~> 1.8, >= 1.8.3)
6
+ typhoeus (~> 1.0, >= 1.0.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ZenTest (4.11.1)
12
+ addressable (2.5.1)
13
+ public_suffix (~> 2.0, >= 2.0.2)
14
+ autotest (4.4.6)
15
+ ZenTest (>= 4.4.1)
16
+ autotest-fsevent (0.2.12)
17
+ sys-uname
18
+ autotest-growl (0.2.16)
19
+ autotest-rails-pure (4.1.2)
20
+ crack (0.4.3)
21
+ safe_yaml (~> 1.0.0)
22
+ diff-lcs (1.3)
23
+ ethon (0.10.1)
24
+ ffi (>= 1.3.0)
25
+ ffi (1.9.18)
26
+ hashdiff (0.3.2)
27
+ json (1.8.6)
28
+ public_suffix (2.0.5)
29
+ rake (12.0.0)
30
+ rspec (3.5.0)
31
+ rspec-core (~> 3.5.0)
32
+ rspec-expectations (~> 3.5.0)
33
+ rspec-mocks (~> 3.5.0)
34
+ rspec-core (3.5.4)
35
+ rspec-support (~> 3.5.0)
36
+ rspec-expectations (3.5.0)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.5.0)
39
+ rspec-mocks (3.5.0)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.5.0)
42
+ rspec-support (3.5.0)
43
+ safe_yaml (1.0.4)
44
+ sys-uname (1.0.3)
45
+ ffi (>= 1.0.0)
46
+ typhoeus (1.1.2)
47
+ ethon (>= 0.9.0)
48
+ vcr (3.0.3)
49
+ webmock (1.24.6)
50
+ addressable (>= 2.3.6)
51
+ crack (>= 0.3.2)
52
+ hashdiff
53
+
54
+ PLATFORMS
55
+ ruby
56
+
57
+ DEPENDENCIES
58
+ autotest (~> 4.4, >= 4.4.6)
59
+ autotest-fsevent (~> 0.2, >= 0.2.11)
60
+ autotest-growl (~> 0.2, >= 0.2.16)
61
+ autotest-rails-pure (~> 4.1, >= 4.1.2)
62
+ rake (~> 12.0.0)
63
+ rspec (~> 3.4, >= 3.4.0)
64
+ vcr (~> 3.0, >= 3.0.1)
65
+ webmock (~> 1.24, >= 1.24.3)
66
+ zipmoney_merchantapi!
67
+
68
+ BUNDLED WITH
69
+ 1.14.3
@@ -0,0 +1,128 @@
1
+ # zip_money
2
+
3
+ ZipMoney - the Ruby gem for the Merchant API
4
+
5
+ ZipMoney Merchant API Initial build
6
+
7
+ - API version: 2017-03-01
8
+ - Package version: 1.0.1
9
+
10
+ ## Installation
11
+
12
+ ### Build a gem
13
+
14
+ To build the Ruby code into a gem:
15
+
16
+ ```shell
17
+ gem build zipmoney_merchantapi.gemspec
18
+ ```
19
+
20
+ Then either install the gem locally:
21
+
22
+ ```shell
23
+ gem install ./zipmoney_merchantapi.gem
24
+ ```
25
+ (for development, run `gem install --dev ./zipmoney_merchantapi.gem` to install the development dependencies)
26
+
27
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
28
+
29
+ Finally add this to the Gemfile:
30
+
31
+ gem 'zipmoney_merchantapi', '~> 1.0.1'
32
+
33
+ ### Install from Git
34
+
35
+ If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
36
+
37
+ gem 'zipmoney_merchantapi', :git => 'https://github.com/zipMoney/merchantapi-ruby.git'
38
+
39
+ ### Include the Ruby code directly
40
+
41
+ Include the Ruby code directly using `-I` as follows:
42
+
43
+ ```shell
44
+ ruby -Ilib script.rb
45
+ ```
46
+
47
+ ## Getting Started
48
+
49
+ Please follow the [installation](#installation) procedure and then run the following code:
50
+ ```ruby
51
+ # Load the gem
52
+ require 'zipmoney_merchantapi'
53
+
54
+ # Setup authorization
55
+ ZipMoney.configure do |config|
56
+ # Configure API key authorization: Authorization
57
+ config.api_key['Authorization'] = 'YOUR API KEY'
58
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
59
+ #config.api_key_prefix['Authorization'] = 'Bearer'
60
+ end
61
+ ```
62
+
63
+ ## Documentation for API Endpoints
64
+
65
+ All URIs are relative to *https://api.sandbox.zipmoney.com.au/merchant/v1*
66
+
67
+ Class | Method | HTTP request | Description
68
+ ------------ | ------------- | ------------- | -------------
69
+ *ZipMoney::ChargesApi* | [**charges_cancel**](docs/ChargesApi.md#charges_cancel) | **POST** /charges/{id}/cancel | Cancel a charge
70
+ *ZipMoney::ChargesApi* | [**charges_capture**](docs/ChargesApi.md#charges_capture) | **POST** /charges/{id}/capture | Capture a charge
71
+ *ZipMoney::ChargesApi* | [**charges_create**](docs/ChargesApi.md#charges_create) | **POST** /charges | Create a charge
72
+ *ZipMoney::ChargesApi* | [**charges_list**](docs/ChargesApi.md#charges_list) | **GET** /charges | List charges
73
+ *ZipMoney::ChargesApi* | [**charges_retrieve**](docs/ChargesApi.md#charges_retrieve) | **GET** /charges/{id} | Retrieve a charge
74
+ *ZipMoney::CheckoutsApi* | [**checkouts_create**](docs/CheckoutsApi.md#checkouts_create) | **POST** /checkouts | Create a checkout
75
+ *ZipMoney::CheckoutsApi* | [**checkouts_get**](docs/CheckoutsApi.md#checkouts_get) | **GET** /checkouts/{id} | Retrieve a checkout
76
+ *ZipMoney::CustomersApi* | [**customers_get**](docs/CustomersApi.md#customers_get) | **GET** /customers/{id} | Retrieve customer
77
+ *ZipMoney::CustomersApi* | [**customers_list**](docs/CustomersApi.md#customers_list) | **GET** /customers | List customers
78
+ *ZipMoney::RefundsApi* | [**refunds_create**](docs/RefundsApi.md#refunds_create) | **POST** /refunds | Create a refund
79
+ *ZipMoney::RefundsApi* | [**refunds_list**](docs/RefundsApi.md#refunds_list) | **GET** /refunds | List refunds
80
+ *ZipMoney::RefundsApi* | [**refunds_retrieve**](docs/RefundsApi.md#refunds_retrieve) | **GET** /refunds/{id} | Retrieve a refund
81
+ *ZipMoney::SettlementsApi* | [**settlements_get**](docs/SettlementsApi.md#settlements_get) | **GET** /settlements/{id} | Retrieve a settlement
82
+ *ZipMoney::SettlementsApi* | [**settlements_list**](docs/SettlementsApi.md#settlements_list) | **GET** /settlements | List settlements
83
+ *ZipMoney::TokensApi* | [**tokens_create**](docs/TokensApi.md#tokens_create) | **POST** /tokens | Create token
84
+
85
+
86
+ ## Documentation for Models
87
+
88
+ - [ZipMoney::Address](docs/Address.md)
89
+ - [ZipMoney::Authority](docs/Authority.md)
90
+ - [ZipMoney::CaptureChargeRequest](docs/CaptureChargeRequest.md)
91
+ - [ZipMoney::Charge](docs/Charge.md)
92
+ - [ZipMoney::ChargeCollection](docs/ChargeCollection.md)
93
+ - [ZipMoney::ChargeOrder](docs/ChargeOrder.md)
94
+ - [ZipMoney::Checkout](docs/Checkout.md)
95
+ - [ZipMoney::CheckoutConfiguration](docs/CheckoutConfiguration.md)
96
+ - [ZipMoney::CheckoutFeatures](docs/CheckoutFeatures.md)
97
+ - [ZipMoney::CheckoutFeaturesTokenisation](docs/CheckoutFeaturesTokenisation.md)
98
+ - [ZipMoney::CheckoutOrder](docs/CheckoutOrder.md)
99
+ - [ZipMoney::CreateChargeRequest](docs/CreateChargeRequest.md)
100
+ - [ZipMoney::CreateCheckoutRequest](docs/CreateCheckoutRequest.md)
101
+ - [ZipMoney::CreateCheckoutRequestFeatures](docs/CreateCheckoutRequestFeatures.md)
102
+ - [ZipMoney::CreateCheckoutRequestFeaturesTokenisation](docs/CreateCheckoutRequestFeaturesTokenisation.md)
103
+ - [ZipMoney::CreateRefundRequest](docs/CreateRefundRequest.md)
104
+ - [ZipMoney::CreateTokenRequest](docs/CreateTokenRequest.md)
105
+ - [ZipMoney::Customer](docs/Customer.md)
106
+ - [ZipMoney::ErrorResponse](docs/ErrorResponse.md)
107
+ - [ZipMoney::ErrorResponseError](docs/ErrorResponseError.md)
108
+ - [ZipMoney::ErrorResponseErrorDetails](docs/ErrorResponseErrorDetails.md)
109
+ - [ZipMoney::InlineResponse200](docs/InlineResponse200.md)
110
+ - [ZipMoney::Metadata](docs/Metadata.md)
111
+ - [ZipMoney::OrderItem](docs/OrderItem.md)
112
+ - [ZipMoney::OrderShipping](docs/OrderShipping.md)
113
+ - [ZipMoney::OrderShippingTracking](docs/OrderShippingTracking.md)
114
+ - [ZipMoney::Refund](docs/Refund.md)
115
+ - [ZipMoney::Shopper](docs/Shopper.md)
116
+ - [ZipMoney::ShopperStatistics](docs/ShopperStatistics.md)
117
+ - [ZipMoney::Token](docs/Token.md)
118
+
119
+
120
+ ## Documentation for Authorization
121
+
122
+
123
+ ### Authorization
124
+
125
+ - **Type**: API key
126
+ - **API key parameter name**: Authorization
127
+ - **Location**: HTTP header
128
+
@@ -0,0 +1,8 @@
1
+ begin
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task default: :spec
6
+ rescue LoadError
7
+ # no rspec available
8
+ end
@@ -0,0 +1,15 @@
1
+ # ZipMoney::Address
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **line1** | **String** | The first line in the address |
7
+ **line2** | **String** | The (optional) second address line | [optional]
8
+ **city** | **String** | The address city |
9
+ **state** | **String** | The state or province |
10
+ **postal_code** | **String** | The post or zip code |
11
+ **country** | **String** | The ISO-3166 country code. See https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2. |
12
+ **first_name** | **String** | The recipient&#39;s first name | [optional]
13
+ **last_name** | **String** | The recipient&#39;s last name | [optional]
14
+
15
+
@@ -0,0 +1,9 @@
1
+ # ZipMoney::Authority
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **type** | **String** | The type of authority (checkout_id, account_token, store_code) |
7
+ **value** | **String** | The authority value/token |
8
+
9
+
@@ -0,0 +1,8 @@
1
+ # ZipMoney::CaptureChargeRequest
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **amount** | **Float** | Amount can be less than or equal to the previously authorised amount |
7
+
8
+
@@ -0,0 +1,17 @@
1
+ # ZipMoney::Charge
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **String** | |
7
+ **reference** | **String** | | [optional]
8
+ **amount** | **Float** | |
9
+ **currency** | **String** | |
10
+ **state** | **String** | |
11
+ **captured_amount** | **Float** | |
12
+ **refunded_amount** | **Float** | The amount of the charge that has been refunded |
13
+ **created_date** | **DateTime** | |
14
+ **order** | [**ChargeOrder**](ChargeOrder.md) | | [optional]
15
+ **metadata** | **Object** | | [optional]
16
+
17
+
@@ -0,0 +1,8 @@
1
+ # ZipMoney::ChargeCollection
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **items** | [**Array&lt;Charge&gt;**](Charge.md) | |
7
+
8
+
@@ -0,0 +1,11 @@
1
+ # ZipMoney::ChargeOrder
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **reference** | **String** | The order id in the eCommerce system | [optional]
7
+ **shipping** | [**OrderShipping**](OrderShipping.md) | |
8
+ **items** | [**Array&lt;OrderItem&gt;**](OrderItem.md) | The order item breakdown | [optional]
9
+ **cart_reference** | **String** | The shopping cart reference id | [optional]
10
+
11
+
@@ -0,0 +1,307 @@
1
+ # ZipMoney::ChargesApi
2
+
3
+ All URIs are relative to *https://api.sandbox.zipmoney.com.au/merchant/v1*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**charges_cancel**](ChargesApi.md#charges_cancel) | **POST** /charges/{id}/cancel | Cancel a charge
8
+ [**charges_capture**](ChargesApi.md#charges_capture) | **POST** /charges/{id}/capture | Capture a charge
9
+ [**charges_create**](ChargesApi.md#charges_create) | **POST** /charges | Create a charge
10
+ [**charges_list**](ChargesApi.md#charges_list) | **GET** /charges | List charges
11
+ [**charges_retrieve**](ChargesApi.md#charges_retrieve) | **GET** /charges/{id} | Retrieve a charge
12
+
13
+
14
+ # **charges_cancel**
15
+ > Charge charges_cancel(id, opts)
16
+
17
+ Cancel a charge
18
+
19
+ Cancels an authorised charge. | Error code | Description | |------------------------------------|--------------------------------------------------------------------------------------------------| | invalid_state | The charge is not in authorised state |
20
+
21
+ ### Example
22
+ ```ruby
23
+ # load the gem
24
+ require 'zip_money'
25
+ # setup authorization
26
+ ZipMoney.configure do |config|
27
+ # Configure API key authorization: Authorization
28
+ config.api_key['Authorization'] = 'YOUR API KEY'
29
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
30
+ #config.api_key_prefix['Authorization'] = 'Bearer'
31
+ end
32
+
33
+ api_instance = ZipMoney::ChargesApi.new
34
+
35
+ id = "id_example" # String | The id of the authorised charge
36
+
37
+ opts = {
38
+ idempotency_key: "idempotency_key_example" # String | The unique idempotency key.
39
+ }
40
+
41
+ begin
42
+ #Cancel a charge
43
+ result = api_instance.charges_cancel(id, opts)
44
+ p result
45
+ rescue ZipMoney::ApiError => e
46
+ puts "Exception when calling ChargesApi->charges_cancel: #{e}"
47
+ end
48
+ ```
49
+
50
+ ### Parameters
51
+
52
+ Name | Type | Description | Notes
53
+ ------------- | ------------- | ------------- | -------------
54
+ **id** | **String**| The id of the authorised charge |
55
+ **idempotency_key** | **String**| The unique idempotency key. | [optional]
56
+
57
+ ### Return type
58
+
59
+ [**Charge**](Charge.md)
60
+
61
+ ### Authorization
62
+
63
+ [Authorization](../README.md#Authorization)
64
+
65
+ ### HTTP request headers
66
+
67
+ - **Content-Type**: application/json
68
+ - **Accept**: application/javascript
69
+
70
+
71
+
72
+ # **charges_capture**
73
+ > Charge charges_capture(id, opts)
74
+
75
+ Capture a charge
76
+
77
+ | Error code | Description | |------------------------------------|--------------------------------------------------------------------------------------------------| | amount_invalid | Capture amount greater than authorised amount | | invalid_state | The charge is not in authorised state |
78
+
79
+ ### Example
80
+ ```ruby
81
+ # load the gem
82
+ require 'zip_money'
83
+ # setup authorization
84
+ ZipMoney.configure do |config|
85
+ # Configure API key authorization: Authorization
86
+ config.api_key['Authorization'] = 'YOUR API KEY'
87
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
88
+ #config.api_key_prefix['Authorization'] = 'Bearer'
89
+ end
90
+
91
+ api_instance = ZipMoney::ChargesApi.new
92
+
93
+ id = "id_example" # String | The id of the authorised charge
94
+
95
+ opts = {
96
+ body: ZipMoney::CaptureChargeRequest.new, # CaptureChargeRequest |
97
+ idempotency_key: "idempotency_key_example" # String | The unique idempotency key.
98
+ }
99
+
100
+ begin
101
+ #Capture a charge
102
+ result = api_instance.charges_capture(id, opts)
103
+ p result
104
+ rescue ZipMoney::ApiError => e
105
+ puts "Exception when calling ChargesApi->charges_capture: #{e}"
106
+ end
107
+ ```
108
+
109
+ ### Parameters
110
+
111
+ Name | Type | Description | Notes
112
+ ------------- | ------------- | ------------- | -------------
113
+ **id** | **String**| The id of the authorised charge |
114
+ **body** | [**CaptureChargeRequest**](CaptureChargeRequest.md)| | [optional]
115
+ **idempotency_key** | **String**| The unique idempotency key. | [optional]
116
+
117
+ ### Return type
118
+
119
+ [**Charge**](Charge.md)
120
+
121
+ ### Authorization
122
+
123
+ [Authorization](../README.md#Authorization)
124
+
125
+ ### HTTP request headers
126
+
127
+ - **Content-Type**: application/json
128
+ - **Accept**: application/javascript
129
+
130
+
131
+
132
+ # **charges_create**
133
+ > Charge charges_create(opts)
134
+
135
+ Create a charge
136
+
137
+ Creates a #model:ehEN48PET29iNdex3 which represents a charge against a customer's account. To execute this endpoint you must first obtain customer approval by implementing the #docTextSection:43C79g2JjeGs8AHWi as a part of your online store. This endpoint will return 201 if successful otherwise 402 with a specific error response. ## Capture or authorisation A charge can be created as either an authorisation or an immediate capture. This can be controlled in the initial request to the charge. In most cases you will want to immediately capture the payment, this will mark the debit for settlement into your account the very same day and will immediately deduct the funds from the customer's account. In some cases you may wish to delay the settlement of funds until a later date, perhaps until the goods are shipped to the customer. In this scenario you should send { capture: false } in the request to the #endpoint:dtmp3HxaHKjewvvGW endpoint and the charge will be created in an authorised state. An authorised charge will place a hold for the specified amount on the customer's account in the form of a pending debit. Once authorised you are guaranteed the funds are available and awaiting a capture request to the #endpoint:wReod3JtbzNutMSXj endpoint, at which point the charge will move to the captured state and the funds will be settled into your account. It is at this point the customer's interest free period will start if applicable for the selected account. ## Specific error responses If a charge was not able to be performed a \"402 - Request Failed\" status code will be returned as detailed in #docTextSection:fJYHM2ZKtEui8RrAM. The error object can contain more specific error reason codes, which are detailed below. | Error code | Description | |------------------------------------|--------------------------------------------------------------------------------------------------| | account_insufficient_funds | Customer does not have sufficient funds to perform the charge | | account_inoperative | The account is in arrears or closed and cannot be charged | | account_locked | The account is locked | | amount_invalid | The amount provided does not match the approved checkout amount | | fraud_check | Fraud checks resulted in payment failure |
138
+
139
+ ### Example
140
+ ```ruby
141
+ # load the gem
142
+ require 'zip_money'
143
+ # setup authorization
144
+ ZipMoney.configure do |config|
145
+ # Configure API key authorization: Authorization
146
+ config.api_key['Authorization'] = 'YOUR API KEY'
147
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
148
+ #config.api_key_prefix['Authorization'] = 'Bearer'
149
+ end
150
+
151
+ api_instance = ZipMoney::ChargesApi.new
152
+
153
+ opts = {
154
+ body: ZipMoney::CreateChargeRequest.new, # CreateChargeRequest |
155
+ idempotency_key: "idempotency_key_example" # String | The unique idempotency key.
156
+ }
157
+
158
+ begin
159
+ #Create a charge
160
+ result = api_instance.charges_create(opts)
161
+ p result
162
+ rescue ZipMoney::ApiError => e
163
+ puts "Exception when calling ChargesApi->charges_create: #{e}"
164
+ end
165
+ ```
166
+
167
+ ### Parameters
168
+
169
+ Name | Type | Description | Notes
170
+ ------------- | ------------- | ------------- | -------------
171
+ **body** | [**CreateChargeRequest**](CreateChargeRequest.md)| | [optional]
172
+ **idempotency_key** | **String**| The unique idempotency key. | [optional]
173
+
174
+ ### Return type
175
+
176
+ [**Charge**](Charge.md)
177
+
178
+ ### Authorization
179
+
180
+ [Authorization](../README.md#Authorization)
181
+
182
+ ### HTTP request headers
183
+
184
+ - **Content-Type**: application/json
185
+ - **Accept**: application/json
186
+
187
+
188
+
189
+ # **charges_list**
190
+ > ChargeCollection charges_list(opts)
191
+
192
+ List charges
193
+
194
+ Lists all charges matching search criteria.
195
+
196
+ ### Example
197
+ ```ruby
198
+ # load the gem
199
+ require 'zip_money'
200
+ # setup authorization
201
+ ZipMoney.configure do |config|
202
+ # Configure API key authorization: Authorization
203
+ config.api_key['Authorization'] = 'YOUR API KEY'
204
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
205
+ #config.api_key_prefix['Authorization'] = 'Bearer'
206
+ end
207
+
208
+ api_instance = ZipMoney::ChargesApi.new
209
+
210
+ opts = {
211
+ state: "state_example", # String | The state filter
212
+ skip: 0, # Integer | Number of items to skip when paging
213
+ limit: 100, # Integer | Number of items to retrieve when paging
214
+ expand: "expand_example" # String | Allows expanding related entities in the response. Only valid entry is 'customer'
215
+ }
216
+
217
+ begin
218
+ #List charges
219
+ result = api_instance.charges_list(opts)
220
+ p result
221
+ rescue ZipMoney::ApiError => e
222
+ puts "Exception when calling ChargesApi->charges_list: #{e}"
223
+ end
224
+ ```
225
+
226
+ ### Parameters
227
+
228
+ Name | Type | Description | Notes
229
+ ------------- | ------------- | ------------- | -------------
230
+ **state** | **String**| The state filter | [optional]
231
+ **skip** | **Integer**| Number of items to skip when paging | [optional] [default to 0]
232
+ **limit** | **Integer**| Number of items to retrieve when paging | [optional] [default to 100]
233
+ **expand** | **String**| Allows expanding related entities in the response. Only valid entry is &#39;customer&#39; | [optional]
234
+
235
+ ### Return type
236
+
237
+ [**ChargeCollection**](ChargeCollection.md)
238
+
239
+ ### Authorization
240
+
241
+ [Authorization](../README.md#Authorization)
242
+
243
+ ### HTTP request headers
244
+
245
+ - **Content-Type**: application/javascript
246
+ - **Accept**: application/javascript
247
+
248
+
249
+
250
+ # **charges_retrieve**
251
+ > Charge charges_retrieve(id, opts)
252
+
253
+ Retrieve a charge
254
+
255
+ Retrieve details of a previously created charge.
256
+
257
+ ### Example
258
+ ```ruby
259
+ # load the gem
260
+ require 'zip_money'
261
+ # setup authorization
262
+ ZipMoney.configure do |config|
263
+ # Configure API key authorization: Authorization
264
+ config.api_key['Authorization'] = 'YOUR API KEY'
265
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
266
+ #config.api_key_prefix['Authorization'] = 'Bearer'
267
+ end
268
+
269
+ api_instance = ZipMoney::ChargesApi.new
270
+
271
+ id = "id_example" # String | The id of the charge
272
+
273
+ opts = {
274
+ expand: "expand_example" # String | Allows expanding related entities in the response. Only valid entry is 'customer'
275
+ }
276
+
277
+ begin
278
+ #Retrieve a charge
279
+ result = api_instance.charges_retrieve(id, opts)
280
+ p result
281
+ rescue ZipMoney::ApiError => e
282
+ puts "Exception when calling ChargesApi->charges_retrieve: #{e}"
283
+ end
284
+ ```
285
+
286
+ ### Parameters
287
+
288
+ Name | Type | Description | Notes
289
+ ------------- | ------------- | ------------- | -------------
290
+ **id** | **String**| The id of the charge |
291
+ **expand** | **String**| Allows expanding related entities in the response. Only valid entry is &#39;customer&#39; | [optional]
292
+
293
+ ### Return type
294
+
295
+ [**Charge**](Charge.md)
296
+
297
+ ### Authorization
298
+
299
+ [Authorization](../README.md#Authorization)
300
+
301
+ ### HTTP request headers
302
+
303
+ - **Content-Type**: application/javascript
304
+ - **Accept**: application/javascript
305
+
306
+
307
+