Class: ZipMoney::ChargesApi
- Inherits:
-
Object
- Object
- ZipMoney::ChargesApi
- Defined in:
- lib/zip_money/api/charges_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#charges_cancel(id, opts = {}) ⇒ Charge
Cancel a charge Cancels an authorised charge.
-
#charges_cancel_with_http_info(id, opts = {}) ⇒ Array<(Charge, Fixnum, Hash)>
Cancel a charge Cancels an authorised charge.
-
#charges_capture(id, opts = {}) ⇒ Charge
Capture a charge | Error code | Description | |————————————|————————————————————————————————–| | amount_invalid | Capture amount greater than authorised amount | | invalid_state | The charge is not in authorised state |.
-
#charges_capture_with_http_info(id, opts = {}) ⇒ Array<(Charge, Fixnum, Hash)>
Capture a charge | Error code | Description | |————————————|————————————————————————————————–| | amount_invalid | Capture amount greater than authorised amount | | invalid_state | The charge is not in authorised state |.
-
#charges_create(opts = {}) ⇒ Charge
Create a charge Creates a #model:ehEN48PET29iNdex3 which represents a charge against a customer’s account.
-
#charges_create_with_http_info(opts = {}) ⇒ Array<(Charge, Fixnum, Hash)>
Create a charge Creates a #model:ehEN48PET29iNdex3 which represents a charge against a customer's account.
-
#charges_list(opts = {}) ⇒ ChargeCollection
List charges Lists all charges matching search criteria.
-
#charges_list_with_http_info(opts = {}) ⇒ Array<(ChargeCollection, Fixnum, Hash)>
List charges Lists all charges matching search criteria.
-
#charges_retrieve(id, opts = {}) ⇒ Charge
Retrieve a charge Retrieve details of a previously created charge.
-
#charges_retrieve_with_http_info(id, opts = {}) ⇒ Array<(Charge, Fixnum, Hash)>
Retrieve a charge Retrieve details of a previously created charge.
-
#initialize(api_client = ApiClient.default) ⇒ ChargesApi
constructor
A new instance of ChargesApi.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ ChargesApi
Returns a new instance of ChargesApi.
12 13 14 |
# File 'lib/zip_money/api/charges_api.rb', line 12 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
10 11 12 |
# File 'lib/zip_money/api/charges_api.rb', line 10 def api_client @api_client end |
Instance Method Details
#charges_cancel(id, opts = {}) ⇒ Charge
Cancel a charge Cancels an authorised charge. | Error code | Description | |————————————|————————————————————————————————–| | invalid_state | The charge is not in authorised state |
22 23 24 25 |
# File 'lib/zip_money/api/charges_api.rb', line 22 def charges_cancel(id, opts = {}) data, _status_code, _headers = charges_cancel_with_http_info(id, opts) return data end |
#charges_cancel_with_http_info(id, opts = {}) ⇒ Array<(Charge, Fixnum, Hash)>
Cancel a charge Cancels an authorised charge. | Error code | Description | |————————————|————————————————————————————————–| | invalid_state | The charge is not in authorised state |
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/zip_money/api/charges_api.rb', line 33 def charges_cancel_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ChargesApi.charges_cancel ..." end # verify the required parameter 'id' is set fail ArgumentError, "Missing the required parameter 'id' when calling ChargesApi.charges_cancel" if id.nil? # resource path local_var_path = "/charges/{id}/cancel".sub('{format}','json').sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/javascript']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['Authorization'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Charge') if @api_client.config.debugging @api_client.config.logger.debug "API called: ChargesApi#charges_cancel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#charges_capture(id, opts = {}) ⇒ Charge
Capture a charge | Error code | Description | |————————————|————————————————————————————————–| | amount_invalid | Capture amount greater than authorised amount | | invalid_state | The charge is not in authorised state |
79 80 81 82 |
# File 'lib/zip_money/api/charges_api.rb', line 79 def charges_capture(id, opts = {}) data, _status_code, _headers = charges_capture_with_http_info(id, opts) return data end |
#charges_capture_with_http_info(id, opts = {}) ⇒ Array<(Charge, Fixnum, Hash)>
Capture a charge | Error code | Description | |————————————|————————————————————————————————–| | amount_invalid | Capture amount greater than authorised amount | | invalid_state | The charge is not in authorised state |
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/zip_money/api/charges_api.rb', line 91 def charges_capture_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ChargesApi.charges_capture ..." end # verify the required parameter 'id' is set fail ArgumentError, "Missing the required parameter 'id' when calling ChargesApi.charges_capture" if id.nil? # resource path local_var_path = "/charges/{id}/capture".sub('{format}','json').sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/javascript']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['Authorization'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Charge') if @api_client.config.debugging @api_client.config.logger.debug "API called: ChargesApi#charges_capture\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#charges_create(opts = {}) ⇒ Charge
Create a charge 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 |
136 137 138 139 |
# File 'lib/zip_money/api/charges_api.rb', line 136 def charges_create(opts = {}) data, _status_code, _headers = charges_create_with_http_info(opts) return data end |
#charges_create_with_http_info(opts = {}) ⇒ Array<(Charge, Fixnum, Hash)>
Create a charge 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 |
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/zip_money/api/charges_api.rb', line 147 def charges_create_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ChargesApi.charges_create ..." end # resource path local_var_path = "/charges".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['Authorization'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Charge') if @api_client.config.debugging @api_client.config.logger.debug "API called: ChargesApi#charges_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#charges_list(opts = {}) ⇒ ChargeCollection
List charges Lists all charges matching search criteria.
192 193 194 195 |
# File 'lib/zip_money/api/charges_api.rb', line 192 def charges_list(opts = {}) data, _status_code, _headers = charges_list_with_http_info(opts) return data end |
#charges_list_with_http_info(opts = {}) ⇒ Array<(ChargeCollection, Fixnum, Hash)>
List charges Lists all charges matching search criteria.
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/zip_money/api/charges_api.rb', line 205 def charges_list_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ChargesApi.charges_list ..." end # resource path local_var_path = "/charges".sub('{format}','json') # query parameters query_params = {} query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil? query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/javascript']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/javascript']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['Authorization'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ChargeCollection') if @api_client.config.debugging @api_client.config.logger.debug "API called: ChargesApi#charges_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#charges_retrieve(id, opts = {}) ⇒ Charge
Retrieve a charge Retrieve details of a previously created charge.
251 252 253 254 |
# File 'lib/zip_money/api/charges_api.rb', line 251 def charges_retrieve(id, opts = {}) data, _status_code, _headers = charges_retrieve_with_http_info(id, opts) return data end |
#charges_retrieve_with_http_info(id, opts = {}) ⇒ Array<(Charge, Fixnum, Hash)>
Retrieve a charge Retrieve details of a previously created charge.
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/zip_money/api/charges_api.rb', line 262 def charges_retrieve_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ChargesApi.charges_retrieve ..." end # verify the required parameter 'id' is set fail ArgumentError, "Missing the required parameter 'id' when calling ChargesApi.charges_retrieve" if id.nil? # resource path local_var_path = "/charges/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/javascript']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/javascript']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['Authorization'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Charge') if @api_client.config.debugging @api_client.config.logger.debug "API called: ChargesApi#charges_retrieve\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |