bleumi_pay_sdk_ruby 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +105 -0
  4. data/Rakefile +10 -0
  5. data/bleumi_pay_sdk_ruby.gemspec +39 -0
  6. data/docs/BadRequest.md +17 -0
  7. data/docs/Erc20PaymentsApi.md +318 -0
  8. data/docs/EthAddress.md +17 -0
  9. data/docs/EthNetwork.md +16 -0
  10. data/docs/PaginatedWalletOperations.md +8 -0
  11. data/docs/PaginatedWallets.md +8 -0
  12. data/docs/Wallet.md +29 -0
  13. data/docs/WalletBalance.md +23 -0
  14. data/docs/WalletCreateInput.md +21 -0
  15. data/docs/WalletCreateOutput.md +19 -0
  16. data/docs/WalletInputs.md +12 -0
  17. data/docs/WalletOperation.md +12 -0
  18. data/docs/WalletOperationInputs.md +21 -0
  19. data/docs/WalletOperationOutput.md +15 -0
  20. data/docs/WalletRefundOperationInput.md +15 -0
  21. data/docs/WalletSettleOperationInput.md +19 -0
  22. data/lib/bleumi_pay_sdk_ruby.rb +55 -0
  23. data/lib/bleumi_pay_sdk_ruby/api/erc20_payments_api.rb +482 -0
  24. data/lib/bleumi_pay_sdk_ruby/api_client.rb +386 -0
  25. data/lib/bleumi_pay_sdk_ruby/api_error.rb +57 -0
  26. data/lib/bleumi_pay_sdk_ruby/configuration.rb +248 -0
  27. data/lib/bleumi_pay_sdk_ruby/models/bad_request.rb +213 -0
  28. data/lib/bleumi_pay_sdk_ruby/models/eth_address.rb +208 -0
  29. data/lib/bleumi_pay_sdk_ruby/models/eth_network.rb +39 -0
  30. data/lib/bleumi_pay_sdk_ruby/models/paginated_wallet_operations.rb +214 -0
  31. data/lib/bleumi_pay_sdk_ruby/models/paginated_wallets.rb +214 -0
  32. data/lib/bleumi_pay_sdk_ruby/models/wallet.rb +293 -0
  33. data/lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb +247 -0
  34. data/lib/bleumi_pay_sdk_ruby/models/wallet_create_input.rb +230 -0
  35. data/lib/bleumi_pay_sdk_ruby/models/wallet_create_output.rb +216 -0
  36. data/lib/bleumi_pay_sdk_ruby/models/wallet_inputs.rb +262 -0
  37. data/lib/bleumi_pay_sdk_ruby/models/wallet_operation.rb +256 -0
  38. data/lib/bleumi_pay_sdk_ruby/models/wallet_operation_inputs.rb +246 -0
  39. data/lib/bleumi_pay_sdk_ruby/models/wallet_operation_output.rb +202 -0
  40. data/lib/bleumi_pay_sdk_ruby/models/wallet_refund_operation_input.rb +201 -0
  41. data/lib/bleumi_pay_sdk_ruby/models/wallet_settle_operation_input.rb +216 -0
  42. data/lib/bleumi_pay_sdk_ruby/version.rb +15 -0
  43. data/spec/api/erc20_payments_api_spec.rb +120 -0
  44. data/spec/api_client_spec.rb +226 -0
  45. data/spec/configuration_spec.rb +42 -0
  46. data/spec/models/bad_request_spec.rb +47 -0
  47. data/spec/models/eth_address_spec.rb +41 -0
  48. data/spec/models/eth_network_spec.rb +35 -0
  49. data/spec/models/paginated_wallet_operations_spec.rb +47 -0
  50. data/spec/models/paginated_wallets_spec.rb +47 -0
  51. data/spec/models/wallet_balance_spec.rb +59 -0
  52. data/spec/models/wallet_create_input_spec.rb +53 -0
  53. data/spec/models/wallet_create_output_spec.rb +47 -0
  54. data/spec/models/wallet_inputs_spec.rb +65 -0
  55. data/spec/models/wallet_operation_inputs_spec.rb +59 -0
  56. data/spec/models/wallet_operation_output_spec.rb +41 -0
  57. data/spec/models/wallet_operation_spec.rb +65 -0
  58. data/spec/models/wallet_refund_operation_input_spec.rb +41 -0
  59. data/spec/models/wallet_settle_operation_input_spec.rb +47 -0
  60. data/spec/models/wallet_spec.rb +77 -0
  61. data/spec/spec_helper.rb +111 -0
  62. metadata +184 -0
@@ -0,0 +1,17 @@
1
+ # BleumiPay::EthAddress
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **addr** | **String** | Valid Ethereum address string should pass validation pattern |
8
+
9
+ ## Code Sample
10
+
11
+ ```ruby
12
+ require 'BleumiPay'
13
+
14
+ instance = BleumiPay::EthAddress.new(addr: null)
15
+ ```
16
+
17
+
@@ -0,0 +1,16 @@
1
+ # BleumiPay::EthNetwork
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+
8
+ ## Code Sample
9
+
10
+ ```ruby
11
+ require 'BleumiPay'
12
+
13
+ instance = BleumiPay::EthNetwork.new()
14
+ ```
15
+
16
+
@@ -0,0 +1,8 @@
1
+ # BleumiPay::PaginatedWalletOperations
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **results** | [**Array<WalletOperation>**](WalletOperation.md) | List of operations of the wallet in the current page |
8
+ **next_token** | **String** | Cursor to fetch next page of results, empty if no more results | [optional]
@@ -0,0 +1,8 @@
1
+ # BleumiPay::PaginatedWallets
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **results** | [**Array<Wallet>**](Wallet.md) | List of wallets in the current page |
8
+ **next_token** | **String** | Cursor to fetch next page of results, empty if no more results | [optional]
data/docs/Wallet.md ADDED
@@ -0,0 +1,29 @@
1
+ # BleumiPay::Wallet
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **id** | **String** | Unique ID identifying the wallet; specified when it was created by your system |
8
+ **chain** | **String** | Ethereum network in which wallet is to be created. Please refer to the [network list](https://pay.bleumi.com/docs/#supported-ethereum-networks) |
9
+ **addr** | **String** | Wallet address |
10
+ **balances** | [**Hash<String, WalletBalance>**](WalletBalance.md) | The current token balance |
11
+ **inputs** | [**WalletInputs**](WalletInputs.md) | |
12
+ **created_at** | **Integer** | UNIX timestamp when the wallet was created |
13
+ **updated_at** | **Integer** | UNIX timestamp when the lastest operation was performed |
14
+
15
+ ## Code Sample
16
+
17
+ ```ruby
18
+ require 'BleumiPay'
19
+
20
+ instance = BleumiPay::Wallet.new(id: null,
21
+ chain: null,
22
+ addr: null,
23
+ balances: null,
24
+ inputs: null,
25
+ created_at: null,
26
+ updated_at: null)
27
+ ```
28
+
29
+
@@ -0,0 +1,23 @@
1
+ # BleumiPay::WalletBalance
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **balance** | **String** | Address of the buyer |
8
+ **token_balance** | **String** | Address of the merchant |
9
+ **token_decimals** | **Integer** | Wallet Library address |
10
+ **block_num** | **String** | Wallet Proxy address |
11
+
12
+ ## Code Sample
13
+
14
+ ```ruby
15
+ require 'BleumiPay'
16
+
17
+ instance = BleumiPay::WalletBalance.new(balance: null,
18
+ token_balance: null,
19
+ token_decimals: null,
20
+ block_num: null)
21
+ ```
22
+
23
+
@@ -0,0 +1,21 @@
1
+ # BleumiPay::WalletCreateInput
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **id** | **String** | Unique ID identifying the wallet; specified here to create the wallet by your system |
8
+ **buyer_address** | [**EthAddress**](EthAddress.md) | |
9
+ **transfer_address** | [**EthAddress**](EthAddress.md) | |
10
+
11
+ ## Code Sample
12
+
13
+ ```ruby
14
+ require 'BleumiPay'
15
+
16
+ instance = BleumiPay::WalletCreateInput.new(id: null,
17
+ buyer_address: null,
18
+ transfer_address: null)
19
+ ```
20
+
21
+
@@ -0,0 +1,19 @@
1
+ # BleumiPay::WalletCreateOutput
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **chain** | [**EthNetwork**](EthNetwork.md) | |
8
+ **addr** | **String** | Address of the newly created wallet |
9
+
10
+ ## Code Sample
11
+
12
+ ```ruby
13
+ require 'BleumiPay'
14
+
15
+ instance = BleumiPay::WalletCreateOutput.new(chain: null,
16
+ addr: null)
17
+ ```
18
+
19
+
@@ -0,0 +1,12 @@
1
+ # BleumiPay::WalletInputs
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **buyer** | **String** | Address of the buyer |
8
+ **merchant** | **String** | Address of the merchant |
9
+ **wallet_library** | **String** | Wallet Library address |
10
+ **wallet_proxy** | **String** | Wallet Proxy address |
11
+ **salt** | **String** | Salt used to create the wallet |
12
+
@@ -0,0 +1,12 @@
1
+ # BleumiPay::WalletOperation
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **id** | **String** | Unique ID of the wallet; specified when it was created by your system | [optional]
8
+ **func_name** | **String** | The name of the function invoked on the payment processor |
9
+ **status** | **Boolean** | <b>null</b> - operation in progress <br/> <b>true</b> - operation completed successfuly <br/> <b>false</b> - operation failed to process |
10
+ **inputs** | [**WalletOperationInputs**](WalletOperationInputs.md) | |
11
+ **hash** | **String** | Transaction hash of operation submitted to the network. This field is blank when operation is in progress. |
12
+
@@ -0,0 +1,21 @@
1
+ # BleumiPay::WalletOperationInputs
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **amount** | **String** | Amount to be settled |
8
+ **token** | **String** | Address of the ERC-20 token |
9
+ **token_amount** | **String** | Amount in full precision |
10
+ **token_decimals** | **String** | |
11
+
12
+ ## Code Sample
13
+
14
+ ```ruby
15
+ require 'BleumiPay'
16
+
17
+ instance = BleumiPay::WalletOperationInputs.new(amount: null,
18
+ token: null,
19
+ token_amount: null,
20
+ token_decimals: null)
21
+ ```
@@ -0,0 +1,15 @@
1
+ # BleumiPay::WalletOperationOutput
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **txid** | **String** | Unique identifier for the wallet operation transaction |
8
+
9
+ ## Code Sample
10
+
11
+ ```ruby
12
+ require 'BleumiPay'
13
+
14
+ instance = BleumiPay::WalletOperationOutput.new(txid: null)
15
+ ```
@@ -0,0 +1,15 @@
1
+ # BleumiPay::WalletRefundOperationInput
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **token** | [**EthAddress**](EthAddress.md) | |
8
+
9
+ ## Code Sample
10
+
11
+ ```ruby
12
+ require 'BleumiPay'
13
+
14
+ instance = BleumiPay::WalletRefundOperationInput.new(token: null)
15
+ ```
@@ -0,0 +1,19 @@
1
+ # BleumiPay::WalletSettleOperationInput
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **token** | [**EthAddress**](EthAddress.md) | |
8
+ **amount** | **String** | Amount to be settled |
9
+
10
+ ## Code Sample
11
+
12
+ ```ruby
13
+ require 'BleumiPay'
14
+
15
+ instance = BleumiPay::WalletSettleOperationInput.new(token: null,
16
+ amount: null)
17
+ ```
18
+
19
+
@@ -0,0 +1,55 @@
1
+ =begin
2
+ #Bleumi Pay API
3
+
4
+ #A simple and powerful REST API to integrate ERC20 payments into your business or application
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: info@bleumi.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.0
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'bleumi_pay_sdk_ruby/api_client'
15
+ require 'bleumi_pay_sdk_ruby/api_error'
16
+ require 'bleumi_pay_sdk_ruby/version'
17
+ require 'bleumi_pay_sdk_ruby/configuration'
18
+
19
+ # Models
20
+ require 'bleumi_pay_sdk_ruby/models/bad_request'
21
+ require 'bleumi_pay_sdk_ruby/models/eth_address'
22
+ require 'bleumi_pay_sdk_ruby/models/eth_network'
23
+ require 'bleumi_pay_sdk_ruby/models/paginated_wallet_operations'
24
+ require 'bleumi_pay_sdk_ruby/models/paginated_wallets'
25
+ require 'bleumi_pay_sdk_ruby/models/wallet'
26
+ require 'bleumi_pay_sdk_ruby/models/wallet_balance'
27
+ require 'bleumi_pay_sdk_ruby/models/wallet_create_input'
28
+ require 'bleumi_pay_sdk_ruby/models/wallet_create_output'
29
+ require 'bleumi_pay_sdk_ruby/models/wallet_inputs'
30
+ require 'bleumi_pay_sdk_ruby/models/wallet_operation'
31
+ require 'bleumi_pay_sdk_ruby/models/wallet_operation_inputs'
32
+ require 'bleumi_pay_sdk_ruby/models/wallet_operation_output'
33
+ require 'bleumi_pay_sdk_ruby/models/wallet_refund_operation_input'
34
+ require 'bleumi_pay_sdk_ruby/models/wallet_settle_operation_input'
35
+
36
+ # APIs
37
+ require 'bleumi_pay_sdk_ruby/api/erc20_payments_api'
38
+
39
+ module BleumiPay
40
+ class << self
41
+ # Customize default settings for the SDK using block.
42
+ # BleumiPay.configure do |config|
43
+ # config.username = "xxx"
44
+ # config.password = "xxx"
45
+ # end
46
+ # If no block given, return the default Configuration object.
47
+ def configure
48
+ if block_given?
49
+ yield(Configuration.default)
50
+ else
51
+ Configuration.default
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,482 @@
1
+ =begin
2
+ #Bleumi Pay API
3
+
4
+ #A simple and powerful REST API to integrate ERC20 payments into your business or application
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: info@bleumi.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module BleumiPay
16
+ class Erc20PaymentsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create an unique wallet address to accept payments for an ERC-20 token from a buyer
23
+ # @param wallet_create_input [WalletCreateInput]
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [EthNetwork] :chain Ethereum network in which wallet is to be created.
26
+ # @return [WalletCreateOutput]
27
+ def create_wallet(wallet_create_input, opts = {})
28
+ data, _status_code, _headers = create_wallet_with_http_info(wallet_create_input, opts)
29
+ data
30
+ end
31
+
32
+ # Create an unique wallet address to accept payments for an ERC-20 token from a buyer
33
+ # @param wallet_create_input [WalletCreateInput]
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [EthNetwork] :chain Ethereum network in which wallet is to be created.
36
+ # @return [Array<(WalletCreateOutput, Integer, Hash)>] WalletCreateOutput data, response status code and response headers
37
+ def create_wallet_with_http_info(wallet_create_input, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: Erc20PaymentsApi.create_wallet ...'
40
+ end
41
+ # verify the required parameter 'wallet_create_input' is set
42
+ if @api_client.config.client_side_validation && wallet_create_input.nil?
43
+ fail ArgumentError, "Missing the required parameter 'wallet_create_input' when calling Erc20PaymentsApi.create_wallet"
44
+ end
45
+ # resource path
46
+ local_var_path = '/v1/payment/erc20/wallet'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+ query_params[:'chain'] = opts[:'chain'] if !opts[:'chain'].nil?
51
+
52
+ # header parameters
53
+ header_params = opts[:header_params] || {}
54
+ # HTTP header 'Accept' (if needed)
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
56
+ # HTTP header 'Content-Type'
57
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
58
+
59
+ # form parameters
60
+ form_params = opts[:form_params] || {}
61
+
62
+ # http body (model)
63
+ post_body = opts[:body] || @api_client.object_to_http_body(wallet_create_input)
64
+
65
+ # return_type
66
+ return_type = opts[:return_type] || 'WalletCreateOutput'
67
+
68
+ # auth_names
69
+ auth_names = opts[:auth_names] || ['ApiKeyAuth']
70
+
71
+ new_options = opts.merge(
72
+ :header_params => header_params,
73
+ :query_params => query_params,
74
+ :form_params => form_params,
75
+ :body => post_body,
76
+ :auth_names => auth_names,
77
+ :return_type => return_type
78
+ )
79
+
80
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
81
+ if @api_client.config.debugging
82
+ @api_client.config.logger.debug "API called: Erc20PaymentsApi#create_wallet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
83
+ end
84
+ return data, status_code, headers
85
+ end
86
+
87
+ # Return a specific wallet
88
+ # @param id [String] Unique ID identifying the wallet in your system
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [Wallet]
91
+ def get_wallet(id, opts = {})
92
+ data, _status_code, _headers = get_wallet_with_http_info(id, opts)
93
+ data
94
+ end
95
+
96
+ # Return a specific wallet
97
+ # @param id [String] Unique ID identifying the wallet in your system
98
+ # @param [Hash] opts the optional parameters
99
+ # @return [Array<(Wallet, Integer, Hash)>] Wallet data, response status code and response headers
100
+ def get_wallet_with_http_info(id, opts = {})
101
+ if @api_client.config.debugging
102
+ @api_client.config.logger.debug 'Calling API: Erc20PaymentsApi.get_wallet ...'
103
+ end
104
+ # verify the required parameter 'id' is set
105
+ if @api_client.config.client_side_validation && id.nil?
106
+ fail ArgumentError, "Missing the required parameter 'id' when calling Erc20PaymentsApi.get_wallet"
107
+ end
108
+ # resource path
109
+ local_var_path = '/v1/payment/erc20/wallet/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
110
+
111
+ # query parameters
112
+ query_params = opts[:query_params] || {}
113
+
114
+ # header parameters
115
+ header_params = opts[:header_params] || {}
116
+ # HTTP header 'Accept' (if needed)
117
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
118
+
119
+ # form parameters
120
+ form_params = opts[:form_params] || {}
121
+
122
+ # http body (model)
123
+ post_body = opts[:body]
124
+
125
+ # return_type
126
+ return_type = opts[:return_type] || 'Wallet'
127
+
128
+ # auth_names
129
+ auth_names = opts[:auth_names] || ['ApiKeyAuth']
130
+
131
+ new_options = opts.merge(
132
+ :header_params => header_params,
133
+ :query_params => query_params,
134
+ :form_params => form_params,
135
+ :body => post_body,
136
+ :auth_names => auth_names,
137
+ :return_type => return_type
138
+ )
139
+
140
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
141
+ if @api_client.config.debugging
142
+ @api_client.config.logger.debug "API called: Erc20PaymentsApi#get_wallet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
143
+ end
144
+ return data, status_code, headers
145
+ end
146
+
147
+ # Return a specific operation of the wallet
148
+ # @param id [String] Unique ID identifying the wallet in your system
149
+ # @param txid [String] ID of a specific operation of the wallet
150
+ # @param [Hash] opts the optional parameters
151
+ # @return [WalletOperation]
152
+ def get_wallet_operation(id, txid, opts = {})
153
+ data, _status_code, _headers = get_wallet_operation_with_http_info(id, txid, opts)
154
+ data
155
+ end
156
+
157
+ # Return a specific operation of the wallet
158
+ # @param id [String] Unique ID identifying the wallet in your system
159
+ # @param txid [String] ID of a specific operation of the wallet
160
+ # @param [Hash] opts the optional parameters
161
+ # @return [Array<(WalletOperation, Integer, Hash)>] WalletOperation data, response status code and response headers
162
+ def get_wallet_operation_with_http_info(id, txid, opts = {})
163
+ if @api_client.config.debugging
164
+ @api_client.config.logger.debug 'Calling API: Erc20PaymentsApi.get_wallet_operation ...'
165
+ end
166
+ # verify the required parameter 'id' is set
167
+ if @api_client.config.client_side_validation && id.nil?
168
+ fail ArgumentError, "Missing the required parameter 'id' when calling Erc20PaymentsApi.get_wallet_operation"
169
+ end
170
+ # verify the required parameter 'txid' is set
171
+ if @api_client.config.client_side_validation && txid.nil?
172
+ fail ArgumentError, "Missing the required parameter 'txid' when calling Erc20PaymentsApi.get_wallet_operation"
173
+ end
174
+ # resource path
175
+ local_var_path = '/v1/payment/erc20/wallet/{id}/operation/{txid}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'txid' + '}', CGI.escape(txid.to_s))
176
+
177
+ # query parameters
178
+ query_params = opts[:query_params] || {}
179
+
180
+ # header parameters
181
+ header_params = opts[:header_params] || {}
182
+ # HTTP header 'Accept' (if needed)
183
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
184
+
185
+ # form parameters
186
+ form_params = opts[:form_params] || {}
187
+
188
+ # http body (model)
189
+ post_body = opts[:body]
190
+
191
+ # return_type
192
+ return_type = opts[:return_type] || 'WalletOperation'
193
+
194
+ # auth_names
195
+ auth_names = opts[:auth_names] || ['ApiKeyAuth']
196
+
197
+ new_options = opts.merge(
198
+ :header_params => header_params,
199
+ :query_params => query_params,
200
+ :form_params => form_params,
201
+ :body => post_body,
202
+ :auth_names => auth_names,
203
+ :return_type => return_type
204
+ )
205
+
206
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
207
+ if @api_client.config.debugging
208
+ @api_client.config.logger.debug "API called: Erc20PaymentsApi#get_wallet_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
209
+ end
210
+ return data, status_code, headers
211
+ end
212
+
213
+ # Return the list of operations performed by the mechant on a specific wallet
214
+ # @param id [String] Unique ID identifying the wallet in your system
215
+ # @param [Hash] opts the optional parameters
216
+ # @option opts [String] :next_token Cursor to start results from
217
+ # @return [PaginatedWalletOperations]
218
+ def get_wallet_operations(id, opts = {})
219
+ data, _status_code, _headers = get_wallet_operations_with_http_info(id, opts)
220
+ data
221
+ end
222
+
223
+ # Return the list of operations performed by the mechant on a specific wallet
224
+ # @param id [String] Unique ID identifying the wallet in your system
225
+ # @param [Hash] opts the optional parameters
226
+ # @option opts [String] :next_token Cursor to start results from
227
+ # @return [Array<(PaginatedWalletOperations, Integer, Hash)>] PaginatedWalletOperations data, response status code and response headers
228
+ def get_wallet_operations_with_http_info(id, opts = {})
229
+ if @api_client.config.debugging
230
+ @api_client.config.logger.debug 'Calling API: Erc20PaymentsApi.get_wallet_operations ...'
231
+ end
232
+ # verify the required parameter 'id' is set
233
+ if @api_client.config.client_side_validation && id.nil?
234
+ fail ArgumentError, "Missing the required parameter 'id' when calling Erc20PaymentsApi.get_wallet_operations"
235
+ end
236
+ # resource path
237
+ local_var_path = '/v1/payment/erc20/wallet/{id}/operation'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
238
+
239
+ # query parameters
240
+ query_params = opts[:query_params] || {}
241
+ query_params[:'nextToken'] = opts[:'next_token'] if !opts[:'next_token'].nil?
242
+
243
+ # header parameters
244
+ header_params = opts[:header_params] || {}
245
+ # HTTP header 'Accept' (if needed)
246
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
247
+
248
+ # form parameters
249
+ form_params = opts[:form_params] || {}
250
+
251
+ # http body (model)
252
+ post_body = opts[:body]
253
+
254
+ # return_type
255
+ return_type = opts[:return_type] || 'PaginatedWalletOperations'
256
+
257
+ # auth_names
258
+ auth_names = opts[:auth_names] || ['ApiKeyAuth']
259
+
260
+ new_options = opts.merge(
261
+ :header_params => header_params,
262
+ :query_params => query_params,
263
+ :form_params => form_params,
264
+ :body => post_body,
265
+ :auth_names => auth_names,
266
+ :return_type => return_type
267
+ )
268
+
269
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
270
+ if @api_client.config.debugging
271
+ @api_client.config.logger.debug "API called: Erc20PaymentsApi#get_wallet_operations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
272
+ end
273
+ return data, status_code, headers
274
+ end
275
+
276
+ # Returns a list of wallets
277
+ # @param [Hash] opts the optional parameters
278
+ # @option opts [String] :next_token Cursor to start results from
279
+ # @option opts [String] :sort_by Sort wallets by
280
+ # @option opts [String] :start_at Get wallets from this timestamp
281
+ # @option opts [String] :end_at Get wallets till this timestamp
282
+ # @return [PaginatedWallets]
283
+ def list_wallets(opts = {})
284
+ data, _status_code, _headers = list_wallets_with_http_info(opts)
285
+ data
286
+ end
287
+
288
+ # Returns a list of wallets
289
+ # @param [Hash] opts the optional parameters
290
+ # @option opts [String] :next_token Cursor to start results from
291
+ # @option opts [String] :sort_by Sort wallets by
292
+ # @option opts [String] :start_at Get wallets from this timestamp
293
+ # @option opts [String] :end_at Get wallets till this timestamp
294
+ # @return [Array<(PaginatedWallets, Integer, Hash)>] PaginatedWallets data, response status code and response headers
295
+ def list_wallets_with_http_info(opts = {})
296
+ if @api_client.config.debugging
297
+ @api_client.config.logger.debug 'Calling API: Erc20PaymentsApi.list_wallets ...'
298
+ end
299
+ allowable_values = ["createdAt", "updatedAt"]
300
+ if @api_client.config.client_side_validation && opts[:'sort_by'] && !allowable_values.include?(opts[:'sort_by'])
301
+ fail ArgumentError, "invalid value for \"sort_by\", must be one of #{allowable_values}"
302
+ end
303
+ # resource path
304
+ local_var_path = '/v1/payment/erc20/wallet'
305
+
306
+ # query parameters
307
+ query_params = opts[:query_params] || {}
308
+ query_params[:'nextToken'] = opts[:'next_token'] if !opts[:'next_token'].nil?
309
+ query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
310
+ query_params[:'startAt'] = opts[:'start_at'] if !opts[:'start_at'].nil?
311
+ query_params[:'endAt'] = opts[:'end_at'] if !opts[:'end_at'].nil?
312
+
313
+ # header parameters
314
+ header_params = opts[:header_params] || {}
315
+ # HTTP header 'Accept' (if needed)
316
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
317
+
318
+ # form parameters
319
+ form_params = opts[:form_params] || {}
320
+
321
+ # http body (model)
322
+ post_body = opts[:body]
323
+
324
+ # return_type
325
+ return_type = opts[:return_type] || 'PaginatedWallets'
326
+
327
+ # auth_names
328
+ auth_names = opts[:auth_names] || ['ApiKeyAuth']
329
+
330
+ new_options = opts.merge(
331
+ :header_params => header_params,
332
+ :query_params => query_params,
333
+ :form_params => form_params,
334
+ :body => post_body,
335
+ :auth_names => auth_names,
336
+ :return_type => return_type
337
+ )
338
+
339
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
340
+ if @api_client.config.debugging
341
+ @api_client.config.logger.debug "API called: Erc20PaymentsApi#list_wallets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
342
+ end
343
+ return data, status_code, headers
344
+ end
345
+
346
+ # Refund wallet
347
+ # @param id [String] Unique ID identifying this record in your system
348
+ # @param wallet_refund_operation_input [WalletRefundOperationInput] Request body - used to specify the token to refund.
349
+ # @param [Hash] opts the optional parameters
350
+ # @return [WalletOperationOutput]
351
+ def refund_wallet(id, wallet_refund_operation_input, opts = {})
352
+ data, _status_code, _headers = refund_wallet_with_http_info(id, wallet_refund_operation_input, opts)
353
+ data
354
+ end
355
+
356
+ # Refund wallet
357
+ # @param id [String] Unique ID identifying this record in your system
358
+ # @param wallet_refund_operation_input [WalletRefundOperationInput] Request body - used to specify the token to refund.
359
+ # @param [Hash] opts the optional parameters
360
+ # @return [Array<(WalletOperationOutput, Integer, Hash)>] WalletOperationOutput data, response status code and response headers
361
+ def refund_wallet_with_http_info(id, wallet_refund_operation_input, opts = {})
362
+ if @api_client.config.debugging
363
+ @api_client.config.logger.debug 'Calling API: Erc20PaymentsApi.refund_wallet ...'
364
+ end
365
+ # verify the required parameter 'id' is set
366
+ if @api_client.config.client_side_validation && id.nil?
367
+ fail ArgumentError, "Missing the required parameter 'id' when calling Erc20PaymentsApi.refund_wallet"
368
+ end
369
+ # verify the required parameter 'wallet_refund_operation_input' is set
370
+ if @api_client.config.client_side_validation && wallet_refund_operation_input.nil?
371
+ fail ArgumentError, "Missing the required parameter 'wallet_refund_operation_input' when calling Erc20PaymentsApi.refund_wallet"
372
+ end
373
+ # resource path
374
+ local_var_path = '/v1/payment/erc20/wallet/{id}/refund'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
375
+
376
+ # query parameters
377
+ query_params = opts[:query_params] || {}
378
+
379
+ # header parameters
380
+ header_params = opts[:header_params] || {}
381
+ # HTTP header 'Accept' (if needed)
382
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
383
+ # HTTP header 'Content-Type'
384
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
385
+
386
+ # form parameters
387
+ form_params = opts[:form_params] || {}
388
+
389
+ # http body (model)
390
+ post_body = opts[:body] || @api_client.object_to_http_body(wallet_refund_operation_input)
391
+
392
+ # return_type
393
+ return_type = opts[:return_type] || 'WalletOperationOutput'
394
+
395
+ # auth_names
396
+ auth_names = opts[:auth_names] || ['ApiKeyAuth']
397
+
398
+ new_options = opts.merge(
399
+ :header_params => header_params,
400
+ :query_params => query_params,
401
+ :form_params => form_params,
402
+ :body => post_body,
403
+ :auth_names => auth_names,
404
+ :return_type => return_type
405
+ )
406
+
407
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
408
+ if @api_client.config.debugging
409
+ @api_client.config.logger.debug "API called: Erc20PaymentsApi#refund_wallet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
410
+ end
411
+ return data, status_code, headers
412
+ end
413
+
414
+ # Settle a wallet, amount received will be transferred even if less than payment amount
415
+ # @param id [String] Unique ID identifying this record in your system
416
+ # @param wallet_settle_operation_input [WalletSettleOperationInput] Request body - used to specify the amount to settle.
417
+ # @param [Hash] opts the optional parameters
418
+ # @return [WalletOperationOutput]
419
+ def settle_wallet(id, wallet_settle_operation_input, opts = {})
420
+ data, _status_code, _headers = settle_wallet_with_http_info(id, wallet_settle_operation_input, opts)
421
+ data
422
+ end
423
+
424
+ # Settle a wallet, amount received will be transferred even if less than payment amount
425
+ # @param id [String] Unique ID identifying this record in your system
426
+ # @param wallet_settle_operation_input [WalletSettleOperationInput] Request body - used to specify the amount to settle.
427
+ # @param [Hash] opts the optional parameters
428
+ # @return [Array<(WalletOperationOutput, Integer, Hash)>] WalletOperationOutput data, response status code and response headers
429
+ def settle_wallet_with_http_info(id, wallet_settle_operation_input, opts = {})
430
+ if @api_client.config.debugging
431
+ @api_client.config.logger.debug 'Calling API: Erc20PaymentsApi.settle_wallet ...'
432
+ end
433
+ # verify the required parameter 'id' is set
434
+ if @api_client.config.client_side_validation && id.nil?
435
+ fail ArgumentError, "Missing the required parameter 'id' when calling Erc20PaymentsApi.settle_wallet"
436
+ end
437
+ # verify the required parameter 'wallet_settle_operation_input' is set
438
+ if @api_client.config.client_side_validation && wallet_settle_operation_input.nil?
439
+ fail ArgumentError, "Missing the required parameter 'wallet_settle_operation_input' when calling Erc20PaymentsApi.settle_wallet"
440
+ end
441
+ # resource path
442
+ local_var_path = '/v1/payment/erc20/wallet/{id}/settle'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
443
+
444
+ # query parameters
445
+ query_params = opts[:query_params] || {}
446
+
447
+ # header parameters
448
+ header_params = opts[:header_params] || {}
449
+ # HTTP header 'Accept' (if needed)
450
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
451
+ # HTTP header 'Content-Type'
452
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
453
+
454
+ # form parameters
455
+ form_params = opts[:form_params] || {}
456
+
457
+ # http body (model)
458
+ post_body = opts[:body] || @api_client.object_to_http_body(wallet_settle_operation_input)
459
+
460
+ # return_type
461
+ return_type = opts[:return_type] || 'WalletOperationOutput'
462
+
463
+ # auth_names
464
+ auth_names = opts[:auth_names] || ['ApiKeyAuth']
465
+
466
+ new_options = opts.merge(
467
+ :header_params => header_params,
468
+ :query_params => query_params,
469
+ :form_params => form_params,
470
+ :body => post_body,
471
+ :auth_names => auth_names,
472
+ :return_type => return_type
473
+ )
474
+
475
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
476
+ if @api_client.config.debugging
477
+ @api_client.config.logger.debug "API called: Erc20PaymentsApi#settle_wallet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
478
+ end
479
+ return data, status_code, headers
480
+ end
481
+ end
482
+ end