bleumi_pay_sdk_ruby 1.0.2 → 1.0.7
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +67 -47
- data/bleumi_pay_sdk_ruby.gemspec +4 -5
- data/docs/AlgorandBalance.md +28 -0
- data/docs/AlgorandWalletAddress.md +24 -0
- data/docs/AlgorandWalletInputs.md +23 -0
- data/docs/BadRequest.md +2 -1
- data/docs/Chain.md +14 -0
- data/docs/CheckoutToken.md +28 -0
- data/docs/CreateCheckoutUrlRequest.md +28 -0
- data/docs/CreateCheckoutUrlResponse.md +17 -0
- data/docs/CreatePaymentRequest.md +19 -0
- data/docs/CreatePaymentResponse.md +15 -0
- data/docs/CreatePayoutRequest.md +28 -0
- data/docs/CreatePayoutResponse.md +15 -0
- data/docs/EthereumBalance.md +30 -0
- data/docs/EthereumWalletAddress.md +23 -0
- data/docs/EthereumWalletInputs.md +23 -0
- data/docs/HostedCheckoutsApi.md +197 -0
- data/docs/PaginatedPaymentOperations.md +28 -0
- data/docs/PaginatedPayments.md +95 -0
- data/docs/PaginatedPayoutItems.md +59 -0
- data/docs/Payment.md +67 -0
- data/docs/PaymentAddresses.md +21 -0
- data/docs/PaymentBalances.md +21 -0
- data/docs/PaymentOperation.md +46 -0
- data/docs/PaymentOperationInputs.md +31 -0
- data/docs/PaymentOperationResponse.md +15 -0
- data/docs/PaymentRefundRequest.md +14 -0
- data/docs/PaymentSettleRequest.md +17 -0
- data/docs/PaymentsApi.md +368 -0
- data/docs/Payout.md +18 -0
- data/docs/PayoutItem.md +39 -0
- data/docs/PayoutItemInputs.md +28 -0
- data/docs/PayoutsApi.md +137 -0
- data/docs/RskBalance.md +28 -0
- data/docs/ValidateCheckoutRequest.md +21 -0
- data/docs/ValidateCheckoutResponse.md +15 -0
- data/docs/WalletBalance.md +18 -4
- data/hc_create.rb +40 -0
- data/hc_list.rb +17 -0
- data/hc_validate.rb +22 -0
- data/lib/bleumi_pay_sdk_ruby.rb +38 -17
- data/lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb +212 -0
- data/lib/bleumi_pay_sdk_ruby/api/payments_api.rb +517 -0
- data/lib/bleumi_pay_sdk_ruby/api/payouts_api.rb +157 -0
- data/lib/bleumi_pay_sdk_ruby/api/request_validator.rb +288 -0
- data/lib/bleumi_pay_sdk_ruby/api_client.rb +11 -9
- data/lib/bleumi_pay_sdk_ruby/api_error.rb +3 -3
- data/lib/bleumi_pay_sdk_ruby/configuration.rb +4 -4
- data/lib/bleumi_pay_sdk_ruby/models/algorand_balance.rb +219 -0
- data/lib/bleumi_pay_sdk_ruby/models/algorand_wallet_address.rb +221 -0
- data/lib/bleumi_pay_sdk_ruby/models/algorand_wallet_inputs.rb +247 -0
- data/lib/bleumi_pay_sdk_ruby/models/bad_request.rb +15 -5
- data/lib/bleumi_pay_sdk_ruby/models/{eth_network.rb → chain.rb} +12 -9
- data/lib/bleumi_pay_sdk_ruby/models/checkout_token.rb +302 -0
- data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_request.rb +312 -0
- data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_response.rb +227 -0
- data/lib/bleumi_pay_sdk_ruby/models/{wallet_create_input.rb → create_payment_request.rb} +33 -11
- data/lib/bleumi_pay_sdk_ruby/models/{wallet_create_output.rb → create_payment_response.rb} +19 -23
- data/lib/bleumi_pay_sdk_ruby/models/create_payout_request.rb +244 -0
- data/lib/bleumi_pay_sdk_ruby/models/create_payout_response.rb +212 -0
- data/lib/bleumi_pay_sdk_ruby/models/ethereum_balance.rb +241 -0
- data/lib/bleumi_pay_sdk_ruby/models/ethereum_wallet_address.rb +221 -0
- data/lib/bleumi_pay_sdk_ruby/models/{wallet_inputs.rb → ethereum_wallet_inputs.rb} +35 -50
- data/lib/bleumi_pay_sdk_ruby/models/paginated_payment_operations.rb +224 -0
- data/lib/bleumi_pay_sdk_ruby/models/{paginated_wallet_operations.rb → paginated_payments.rb} +19 -9
- data/lib/bleumi_pay_sdk_ruby/models/{paginated_wallets.rb → paginated_payout_items.rb} +19 -9
- data/lib/bleumi_pay_sdk_ruby/models/{wallet.rb → payment.rb} +31 -54
- data/lib/bleumi_pay_sdk_ruby/models/payment_addresses.rb +231 -0
- data/lib/bleumi_pay_sdk_ruby/models/payment_balances.rb +225 -0
- data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation.rb → payment_operation.rb} +44 -18
- data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation_inputs.rb → payment_operation_inputs.rb} +38 -12
- data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation_output.rb → payment_operation_response.rb} +18 -8
- data/lib/bleumi_pay_sdk_ruby/models/{wallet_refund_operation_input.rb → payment_refund_request.rb} +18 -8
- data/lib/bleumi_pay_sdk_ruby/models/{wallet_settle_operation_input.rb → payment_settle_request.rb} +18 -8
- data/lib/bleumi_pay_sdk_ruby/models/payout.rb +237 -0
- data/lib/bleumi_pay_sdk_ruby/models/payout_item.rb +286 -0
- data/lib/bleumi_pay_sdk_ruby/models/payout_item_inputs.rb +244 -0
- data/lib/bleumi_pay_sdk_ruby/models/rsk_balance.rb +219 -0
- data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_request.rb +257 -0
- data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_response.rb +212 -0
- data/lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb +37 -12
- data/lib/bleumi_pay_sdk_ruby/version.rb +4 -4
- data/po_create.rb +39 -0
- data/po_list.rb +23 -0
- data/py_create.rb +48 -0
- data/py_get.rb +18 -0
- data/py_getop.rb +19 -0
- data/py_list.rb +24 -0
- data/py_listops.rb +21 -0
- data/py_refund.rb +43 -0
- data/py_settle.rb +43 -0
- data/spec/api/hosted_checkouts_api_spec.rb +67 -0
- data/spec/api/payments_api_spec.rb +123 -0
- data/spec/api/payouts_api_spec.rb +61 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/algorand_balance_spec.rb +47 -0
- data/spec/models/algorand_wallet_address_spec.rb +47 -0
- data/spec/models/algorand_wallet_inputs_spec.rb +65 -0
- data/spec/models/bad_request_spec.rb +47 -0
- data/spec/models/chain_spec.rb +35 -0
- data/spec/models/checkout_token_spec.rb +77 -0
- data/spec/models/create_checkout_url_request_spec.rb +89 -0
- data/spec/models/create_checkout_url_response_spec.rb +47 -0
- data/spec/models/create_payment_request_spec.rb +59 -0
- data/spec/models/create_payment_response_spec.rb +41 -0
- data/spec/models/create_payout_request_spec.rb +53 -0
- data/spec/models/create_payout_response_spec.rb +41 -0
- data/spec/models/ethereum_balance_spec.rb +59 -0
- data/spec/models/ethereum_wallet_address_spec.rb +47 -0
- data/spec/models/ethereum_wallet_inputs_spec.rb +65 -0
- data/spec/models/paginated_payment_operations_spec.rb +47 -0
- data/spec/models/paginated_payments_spec.rb +47 -0
- data/spec/models/paginated_payout_items_spec.rb +47 -0
- data/spec/models/payment_addresses_spec.rb +53 -0
- data/spec/models/payment_balances_spec.rb +53 -0
- data/spec/models/payment_operation_inputs_spec.rb +65 -0
- data/spec/models/payment_operation_response_spec.rb +41 -0
- data/spec/models/payment_operation_spec.rb +71 -0
- data/spec/models/payment_refund_request_spec.rb +41 -0
- data/spec/models/payment_settle_request_spec.rb +47 -0
- data/spec/models/payment_spec.rb +65 -0
- data/spec/models/payout_item_inputs_spec.rb +53 -0
- data/spec/models/payout_item_spec.rb +71 -0
- data/spec/models/payout_spec.rb +53 -0
- data/spec/models/rsk_balance_spec.rb +47 -0
- data/spec/models/validate_checkout_request_spec.rb +59 -0
- data/spec/models/validate_checkout_response_spec.rb +41 -0
- data/spec/models/wallet_balance_spec.rb +65 -0
- data/spec/spec_helper.rb +111 -0
- metadata +180 -49
- data/docs/Erc20PaymentsApi.md +0 -334
- data/docs/EthAddress.md +0 -8
- data/docs/EthNetwork.md +0 -9
- data/docs/PaginatedWalletOperations.md +0 -8
- data/docs/PaginatedWallets.md +0 -8
- data/docs/Wallet.md +0 -13
- data/docs/WalletCreateInput.md +0 -9
- data/docs/WalletCreateOutput.md +0 -10
- data/docs/WalletInputs.md +0 -11
- data/docs/WalletOperation.md +0 -11
- data/docs/WalletOperationInputs.md +0 -10
- data/docs/WalletOperationOutput.md +0 -8
- data/docs/WalletRefundOperationInput.md +0 -7
- data/docs/WalletSettleOperationInput.md +0 -8
- data/lib/bleumi_pay_sdk_ruby/api/erc20_payments_api.rb +0 -482
- data/lib/bleumi_pay_sdk_ruby/models/eth_address.rb +0 -208
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Bleumi Pay REST API
|
|
3
|
+
|
|
4
|
+
#A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts 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.2
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module BleumiPay
|
|
16
|
+
class HostedCheckoutsApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
attr_accessor :request_validator
|
|
19
|
+
|
|
20
|
+
def initialize(api_client = ApiClient.default, request_validator = RequestValidator.default)
|
|
21
|
+
@api_client = api_client
|
|
22
|
+
@request_validator = request_validator
|
|
23
|
+
end
|
|
24
|
+
# Generate a unique checkout URL to accept payment.
|
|
25
|
+
# @param create_checkout_url_request [CreateCheckoutUrlRequest] Specify checkout URL creation parameters.
|
|
26
|
+
# @param [Hash] opts the optional parameters
|
|
27
|
+
# @return [CreateCheckoutUrlResponse]
|
|
28
|
+
def create_checkout_url(create_checkout_url_request, opts = {})
|
|
29
|
+
data, _status_code, _headers = create_checkout_url_with_http_info(create_checkout_url_request, opts)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Generate a unique checkout URL to accept payment.
|
|
34
|
+
# @param create_checkout_url_request [CreateCheckoutUrlRequest] Specify checkout URL creation parameters.
|
|
35
|
+
# @param [Hash] opts the optional parameters
|
|
36
|
+
# @return [Array<(CreateCheckoutUrlResponse, Integer, Hash)>] CreateCheckoutUrlResponse data, response status code and response headers
|
|
37
|
+
def create_checkout_url_with_http_info(create_checkout_url_request, opts = {})
|
|
38
|
+
if @api_client.config.debugging
|
|
39
|
+
@api_client.config.logger.debug 'Calling API: HostedCheckoutsApi.create_checkout_url ...'
|
|
40
|
+
end
|
|
41
|
+
# verify the required parameter 'create_checkout_url_request' is set
|
|
42
|
+
if @api_client.config.client_side_validation && create_checkout_url_request.nil?
|
|
43
|
+
fail ArgumentError, "Missing the required parameter 'create_checkout_url_request' when calling HostedCheckoutsApi.create_checkout_url"
|
|
44
|
+
end
|
|
45
|
+
# verify the values in the request body are valid
|
|
46
|
+
msg = @request_validator.validate_create_checkout_url_request(create_checkout_url_request)
|
|
47
|
+
if (@request_validator.is_not_empty(msg))
|
|
48
|
+
fail ArgumentError, "`#{msg}` when calling HostedCheckoutsApi.create_checkout_url"
|
|
49
|
+
end
|
|
50
|
+
# resource path
|
|
51
|
+
local_var_path = '/v1/payment/hc'
|
|
52
|
+
|
|
53
|
+
# query parameters
|
|
54
|
+
query_params = opts[:query_params] || {}
|
|
55
|
+
|
|
56
|
+
# header parameters
|
|
57
|
+
header_params = opts[:header_params] || {}
|
|
58
|
+
# HTTP header 'Accept' (if needed)
|
|
59
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
60
|
+
# HTTP header 'Content-Type'
|
|
61
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
62
|
+
|
|
63
|
+
# form parameters
|
|
64
|
+
form_params = opts[:form_params] || {}
|
|
65
|
+
|
|
66
|
+
# http body (model)
|
|
67
|
+
post_body = opts[:body] || @api_client.object_to_http_body(create_checkout_url_request)
|
|
68
|
+
|
|
69
|
+
# return_type
|
|
70
|
+
return_type = opts[:return_type] || 'CreateCheckoutUrlResponse'
|
|
71
|
+
|
|
72
|
+
# auth_names
|
|
73
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth']
|
|
74
|
+
|
|
75
|
+
new_options = opts.merge(
|
|
76
|
+
:header_params => header_params,
|
|
77
|
+
:query_params => query_params,
|
|
78
|
+
:form_params => form_params,
|
|
79
|
+
:body => post_body,
|
|
80
|
+
:auth_names => auth_names,
|
|
81
|
+
:return_type => return_type
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
85
|
+
if @api_client.config.debugging
|
|
86
|
+
@api_client.config.logger.debug "API called: HostedCheckoutsApi#create_checkout_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
87
|
+
end
|
|
88
|
+
return data, status_code, headers
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Retrieve all tokens configured for the Hosted Checkout in your account in the Bleumi Pay Dashboard.
|
|
92
|
+
# @param [Hash] opts the optional parameters
|
|
93
|
+
# @return [Array<CheckoutToken>]
|
|
94
|
+
def list_tokens(opts = {})
|
|
95
|
+
data, _status_code, _headers = list_tokens_with_http_info(opts)
|
|
96
|
+
data
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Retrieve all tokens configured for the Hosted Checkout in your account in the Bleumi Pay Dashboard.
|
|
100
|
+
# @param [Hash] opts the optional parameters
|
|
101
|
+
# @return [Array<(Array<CheckoutToken>, Integer, Hash)>] Array<CheckoutToken> data, response status code and response headers
|
|
102
|
+
def list_tokens_with_http_info(opts = {})
|
|
103
|
+
if @api_client.config.debugging
|
|
104
|
+
@api_client.config.logger.debug 'Calling API: HostedCheckoutsApi.list_tokens ...'
|
|
105
|
+
end
|
|
106
|
+
# resource path
|
|
107
|
+
local_var_path = '/v1/payment/hc/tokens'
|
|
108
|
+
|
|
109
|
+
# query parameters
|
|
110
|
+
query_params = opts[:query_params] || {}
|
|
111
|
+
|
|
112
|
+
# header parameters
|
|
113
|
+
header_params = opts[:header_params] || {}
|
|
114
|
+
# HTTP header 'Accept' (if needed)
|
|
115
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
116
|
+
|
|
117
|
+
# form parameters
|
|
118
|
+
form_params = opts[:form_params] || {}
|
|
119
|
+
|
|
120
|
+
# http body (model)
|
|
121
|
+
post_body = opts[:body]
|
|
122
|
+
|
|
123
|
+
# return_type
|
|
124
|
+
return_type = opts[:return_type] || 'Array<CheckoutToken>'
|
|
125
|
+
|
|
126
|
+
# auth_names
|
|
127
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth']
|
|
128
|
+
|
|
129
|
+
new_options = opts.merge(
|
|
130
|
+
:header_params => header_params,
|
|
131
|
+
:query_params => query_params,
|
|
132
|
+
:form_params => form_params,
|
|
133
|
+
:body => post_body,
|
|
134
|
+
:auth_names => auth_names,
|
|
135
|
+
:return_type => return_type
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
139
|
+
if @api_client.config.debugging
|
|
140
|
+
@api_client.config.logger.debug "API called: HostedCheckoutsApi#list_tokens\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
141
|
+
end
|
|
142
|
+
return data, status_code, headers
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Validate the GET parameters passed by Hosted Checkout in successUrl upon successfully completing payment.
|
|
146
|
+
# @param validate_checkout_request [ValidateCheckoutRequest] Specify validation of checkout parameters.
|
|
147
|
+
# @param [Hash] opts the optional parameters
|
|
148
|
+
# @return [ValidateCheckoutResponse]
|
|
149
|
+
def validate_checkout_payment(validate_checkout_request, opts = {})
|
|
150
|
+
data, _status_code, _headers = validate_checkout_payment_with_http_info(validate_checkout_request, opts)
|
|
151
|
+
data
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Validate the GET parameters passed by Hosted Checkout in successUrl upon successfully completing payment.
|
|
155
|
+
# @param validate_checkout_request [ValidateCheckoutRequest] Specify validation of checkout parameters.
|
|
156
|
+
# @param [Hash] opts the optional parameters
|
|
157
|
+
# @return [Array<(ValidateCheckoutResponse, Integer, Hash)>] ValidateCheckoutResponse data, response status code and response headers
|
|
158
|
+
def validate_checkout_payment_with_http_info(validate_checkout_request, opts = {})
|
|
159
|
+
if @api_client.config.debugging
|
|
160
|
+
@api_client.config.logger.debug 'Calling API: HostedCheckoutsApi.validate_checkout_payment ...'
|
|
161
|
+
end
|
|
162
|
+
# verify the required parameter 'validate_checkout_request' is set
|
|
163
|
+
if @api_client.config.client_side_validation && validate_checkout_request.nil?
|
|
164
|
+
fail ArgumentError, "Missing the required parameter 'validate_checkout_request' when calling HostedCheckoutsApi.validate_checkout_payment"
|
|
165
|
+
end
|
|
166
|
+
# verify the values in the request body are valid
|
|
167
|
+
msg = @request_validator.validate_checkout_payment_params(validate_checkout_request)
|
|
168
|
+
if (@request_validator.is_not_empty(msg))
|
|
169
|
+
fail ArgumentError, "`#{msg}` when calling HostedCheckoutsApi.validate_checkout_payment"
|
|
170
|
+
end
|
|
171
|
+
# resource path
|
|
172
|
+
local_var_path = '/v1/payment/hc/validate'
|
|
173
|
+
|
|
174
|
+
# query parameters
|
|
175
|
+
query_params = opts[:query_params] || {}
|
|
176
|
+
|
|
177
|
+
# header parameters
|
|
178
|
+
header_params = opts[:header_params] || {}
|
|
179
|
+
# HTTP header 'Accept' (if needed)
|
|
180
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
181
|
+
# HTTP header 'Content-Type'
|
|
182
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
183
|
+
|
|
184
|
+
# form parameters
|
|
185
|
+
form_params = opts[:form_params] || {}
|
|
186
|
+
|
|
187
|
+
# http body (model)
|
|
188
|
+
post_body = opts[:body] || @api_client.object_to_http_body(validate_checkout_request)
|
|
189
|
+
|
|
190
|
+
# return_type
|
|
191
|
+
return_type = opts[:return_type] || 'ValidateCheckoutResponse'
|
|
192
|
+
|
|
193
|
+
# auth_names
|
|
194
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth']
|
|
195
|
+
|
|
196
|
+
new_options = opts.merge(
|
|
197
|
+
:header_params => header_params,
|
|
198
|
+
:query_params => query_params,
|
|
199
|
+
:form_params => form_params,
|
|
200
|
+
:body => post_body,
|
|
201
|
+
:auth_names => auth_names,
|
|
202
|
+
:return_type => return_type
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
206
|
+
if @api_client.config.debugging
|
|
207
|
+
@api_client.config.logger.debug "API called: HostedCheckoutsApi#validate_checkout_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
208
|
+
end
|
|
209
|
+
return data, status_code, headers
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
end
|
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Bleumi Pay REST API
|
|
3
|
+
|
|
4
|
+
#A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts 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.2
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module BleumiPay
|
|
16
|
+
class PaymentsApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
attr_accessor :request_validator
|
|
19
|
+
|
|
20
|
+
def initialize(api_client = ApiClient.default, request_validator = RequestValidator.default)
|
|
21
|
+
@api_client = api_client
|
|
22
|
+
@request_validator = request_validator
|
|
23
|
+
end
|
|
24
|
+
# Generate a unique wallet address in the specified network to accept payment
|
|
25
|
+
# @param create_payment_request [CreatePaymentRequest]
|
|
26
|
+
# @param [Hash] opts the optional parameters
|
|
27
|
+
# @option opts [Chain] :chain Network in which payment is to be created. Please refer documentation for Supported Networks
|
|
28
|
+
# @return [CreatePaymentResponse]
|
|
29
|
+
def create_payment(create_payment_request, opts = {})
|
|
30
|
+
data, _status_code, _headers = create_payment_with_http_info(create_payment_request, opts)
|
|
31
|
+
data
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Generate a unique wallet address in the specified network to accept payment
|
|
35
|
+
# @param create_payment_request [CreatePaymentRequest]
|
|
36
|
+
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @option opts [Chain] :chain Network in which payment is to be created. Please refer documentation for Supported Networks
|
|
38
|
+
# @return [Array<(CreatePaymentResponse, Integer, Hash)>] CreatePaymentResponse data, response status code and response headers
|
|
39
|
+
def create_payment_with_http_info(create_payment_request, opts = {})
|
|
40
|
+
if @api_client.config.debugging
|
|
41
|
+
@api_client.config.logger.debug 'Calling API: PaymentsApi.create_payment ...'
|
|
42
|
+
end
|
|
43
|
+
# verify the required parameter 'create_payment_request' is set
|
|
44
|
+
if @api_client.config.client_side_validation && create_payment_request.nil?
|
|
45
|
+
fail ArgumentError, "Missing the required parameter 'create_payment_request' when calling PaymentsApi.create_payment"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# verify the values in the request body are valid
|
|
49
|
+
chain = opts[:'chain'] if !opts[:'chain'].nil?
|
|
50
|
+
msg = @request_validator.validate_create_payment_request(create_payment_request, chain)
|
|
51
|
+
if (@request_validator.is_not_empty(msg))
|
|
52
|
+
fail ArgumentError, "`#{msg}` when calling PaymentsApi.create_payment"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# resource path
|
|
56
|
+
local_var_path = '/v1/payment'
|
|
57
|
+
|
|
58
|
+
# query parameters
|
|
59
|
+
query_params = opts[:query_params] || {}
|
|
60
|
+
query_params[:'chain'] = opts[:'chain'] if !opts[:'chain'].nil?
|
|
61
|
+
|
|
62
|
+
# header parameters
|
|
63
|
+
header_params = opts[:header_params] || {}
|
|
64
|
+
# HTTP header 'Accept' (if needed)
|
|
65
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
66
|
+
# HTTP header 'Content-Type'
|
|
67
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
68
|
+
|
|
69
|
+
# form parameters
|
|
70
|
+
form_params = opts[:form_params] || {}
|
|
71
|
+
|
|
72
|
+
# http body (model)
|
|
73
|
+
post_body = opts[:body] || @api_client.object_to_http_body(create_payment_request)
|
|
74
|
+
|
|
75
|
+
# return_type
|
|
76
|
+
return_type = opts[:return_type] || 'CreatePaymentResponse'
|
|
77
|
+
|
|
78
|
+
# auth_names
|
|
79
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth']
|
|
80
|
+
|
|
81
|
+
new_options = opts.merge(
|
|
82
|
+
:header_params => header_params,
|
|
83
|
+
:query_params => query_params,
|
|
84
|
+
:form_params => form_params,
|
|
85
|
+
:body => post_body,
|
|
86
|
+
:auth_names => auth_names,
|
|
87
|
+
:return_type => return_type
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
91
|
+
if @api_client.config.debugging
|
|
92
|
+
@api_client.config.logger.debug "API called: PaymentsApi#create_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
93
|
+
end
|
|
94
|
+
return data, status_code, headers
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Retrieve the wallet addresses & token balances for a given payment
|
|
98
|
+
# @param id [String] Unique identifier of the payment (specified during createPayment) to retrieve
|
|
99
|
+
# @param [Hash] opts the optional parameters
|
|
100
|
+
# @return [Payment]
|
|
101
|
+
def get_payment(id, opts = {})
|
|
102
|
+
data, _status_code, _headers = get_payment_with_http_info(id, opts)
|
|
103
|
+
data
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Retrieve the wallet addresses & token balances for a given payment
|
|
107
|
+
# @param id [String] Unique identifier of the payment (specified during createPayment) to retrieve
|
|
108
|
+
# @param [Hash] opts the optional parameters
|
|
109
|
+
# @return [Array<(Payment, Integer, Hash)>] Payment data, response status code and response headers
|
|
110
|
+
def get_payment_with_http_info(id, opts = {})
|
|
111
|
+
if @api_client.config.debugging
|
|
112
|
+
@api_client.config.logger.debug 'Calling API: PaymentsApi.get_payment ...'
|
|
113
|
+
end
|
|
114
|
+
# verify the required parameter 'id' is set
|
|
115
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
116
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling PaymentsApi.get_payment"
|
|
117
|
+
end
|
|
118
|
+
# resource path
|
|
119
|
+
local_var_path = '/v1/payment/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
120
|
+
|
|
121
|
+
# query parameters
|
|
122
|
+
query_params = opts[:query_params] || {}
|
|
123
|
+
|
|
124
|
+
# header parameters
|
|
125
|
+
header_params = opts[:header_params] || {}
|
|
126
|
+
# HTTP header 'Accept' (if needed)
|
|
127
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
128
|
+
|
|
129
|
+
# form parameters
|
|
130
|
+
form_params = opts[:form_params] || {}
|
|
131
|
+
|
|
132
|
+
# http body (model)
|
|
133
|
+
post_body = opts[:body]
|
|
134
|
+
|
|
135
|
+
# return_type
|
|
136
|
+
return_type = opts[:return_type] || 'Payment'
|
|
137
|
+
|
|
138
|
+
# auth_names
|
|
139
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth']
|
|
140
|
+
|
|
141
|
+
new_options = opts.merge(
|
|
142
|
+
:header_params => header_params,
|
|
143
|
+
:query_params => query_params,
|
|
144
|
+
:form_params => form_params,
|
|
145
|
+
:body => post_body,
|
|
146
|
+
:auth_names => auth_names,
|
|
147
|
+
:return_type => return_type
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
151
|
+
if @api_client.config.debugging
|
|
152
|
+
@api_client.config.logger.debug "API called: PaymentsApi#get_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
153
|
+
end
|
|
154
|
+
return data, status_code, headers
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Retrieve a payment operation for a specific payment.
|
|
158
|
+
# @param id [String] Unique identifier of the payment (specified during [Create a Payment](#createPayment))
|
|
159
|
+
# @param txid [String] ID of a specific operation of the payment
|
|
160
|
+
# @param [Hash] opts the optional parameters
|
|
161
|
+
# @return [PaymentOperation]
|
|
162
|
+
def get_payment_operation(id, txid, opts = {})
|
|
163
|
+
data, _status_code, _headers = get_payment_operation_with_http_info(id, txid, opts)
|
|
164
|
+
data
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Retrieve a payment operation for a specific payment.
|
|
168
|
+
# @param id [String] Unique identifier of the payment (specified during [Create a Payment](#createPayment))
|
|
169
|
+
# @param txid [String] ID of a specific operation of the payment
|
|
170
|
+
# @param [Hash] opts the optional parameters
|
|
171
|
+
# @return [Array<(PaymentOperation, Integer, Hash)>] PaymentOperation data, response status code and response headers
|
|
172
|
+
def get_payment_operation_with_http_info(id, txid, opts = {})
|
|
173
|
+
if @api_client.config.debugging
|
|
174
|
+
@api_client.config.logger.debug 'Calling API: PaymentsApi.get_payment_operation ...'
|
|
175
|
+
end
|
|
176
|
+
# verify the required parameter 'id' is set
|
|
177
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
178
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling PaymentsApi.get_payment_operation"
|
|
179
|
+
end
|
|
180
|
+
# verify the required parameter 'txid' is set
|
|
181
|
+
if @api_client.config.client_side_validation && txid.nil?
|
|
182
|
+
fail ArgumentError, "Missing the required parameter 'txid' when calling PaymentsApi.get_payment_operation"
|
|
183
|
+
end
|
|
184
|
+
# resource path
|
|
185
|
+
local_var_path = '/v1/payment/{id}/operation/{txid}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'txid' + '}', CGI.escape(txid.to_s))
|
|
186
|
+
|
|
187
|
+
# query parameters
|
|
188
|
+
query_params = opts[:query_params] || {}
|
|
189
|
+
|
|
190
|
+
# header parameters
|
|
191
|
+
header_params = opts[:header_params] || {}
|
|
192
|
+
# HTTP header 'Accept' (if needed)
|
|
193
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
194
|
+
|
|
195
|
+
# form parameters
|
|
196
|
+
form_params = opts[:form_params] || {}
|
|
197
|
+
|
|
198
|
+
# http body (model)
|
|
199
|
+
post_body = opts[:body]
|
|
200
|
+
|
|
201
|
+
# return_type
|
|
202
|
+
return_type = opts[:return_type] || 'PaymentOperation'
|
|
203
|
+
|
|
204
|
+
# auth_names
|
|
205
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth']
|
|
206
|
+
|
|
207
|
+
new_options = opts.merge(
|
|
208
|
+
:header_params => header_params,
|
|
209
|
+
:query_params => query_params,
|
|
210
|
+
:form_params => form_params,
|
|
211
|
+
:body => post_body,
|
|
212
|
+
:auth_names => auth_names,
|
|
213
|
+
:return_type => return_type
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
217
|
+
if @api_client.config.debugging
|
|
218
|
+
@api_client.config.logger.debug "API called: PaymentsApi#get_payment_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
219
|
+
end
|
|
220
|
+
return data, status_code, headers
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# Retrieve all payment operations for a specific payment.
|
|
224
|
+
# @param id [String] Unique identifier of the payment (specified during [Create a Payment](#createPayment))
|
|
225
|
+
# @param [Hash] opts the optional parameters
|
|
226
|
+
# @option opts [String] :next_token Cursor to start results from
|
|
227
|
+
# @return [PaginatedPaymentOperations]
|
|
228
|
+
def list_payment_operations(id, opts = {})
|
|
229
|
+
data, _status_code, _headers = list_payment_operations_with_http_info(id, opts)
|
|
230
|
+
data
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# Retrieve all payment operations for a specific payment.
|
|
234
|
+
# @param id [String] Unique identifier of the payment (specified during [Create a Payment](#createPayment))
|
|
235
|
+
# @param [Hash] opts the optional parameters
|
|
236
|
+
# @option opts [String] :next_token Cursor to start results from
|
|
237
|
+
# @return [Array<(PaginatedPaymentOperations, Integer, Hash)>] PaginatedPaymentOperations data, response status code and response headers
|
|
238
|
+
def list_payment_operations_with_http_info(id, opts = {})
|
|
239
|
+
if @api_client.config.debugging
|
|
240
|
+
@api_client.config.logger.debug 'Calling API: PaymentsApi.list_payment_operations ...'
|
|
241
|
+
end
|
|
242
|
+
# verify the required parameter 'id' is set
|
|
243
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
244
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling PaymentsApi.list_payment_operations"
|
|
245
|
+
end
|
|
246
|
+
# resource path
|
|
247
|
+
local_var_path = '/v1/payment/{id}/operation'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
248
|
+
|
|
249
|
+
# query parameters
|
|
250
|
+
query_params = opts[:query_params] || {}
|
|
251
|
+
query_params[:'nextToken'] = opts[:'next_token'] if !opts[:'next_token'].nil?
|
|
252
|
+
|
|
253
|
+
# header parameters
|
|
254
|
+
header_params = opts[:header_params] || {}
|
|
255
|
+
# HTTP header 'Accept' (if needed)
|
|
256
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
257
|
+
|
|
258
|
+
# form parameters
|
|
259
|
+
form_params = opts[:form_params] || {}
|
|
260
|
+
|
|
261
|
+
# http body (model)
|
|
262
|
+
post_body = opts[:body]
|
|
263
|
+
|
|
264
|
+
# return_type
|
|
265
|
+
return_type = opts[:return_type] || 'PaginatedPaymentOperations'
|
|
266
|
+
|
|
267
|
+
# auth_names
|
|
268
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth']
|
|
269
|
+
|
|
270
|
+
new_options = opts.merge(
|
|
271
|
+
:header_params => header_params,
|
|
272
|
+
:query_params => query_params,
|
|
273
|
+
:form_params => form_params,
|
|
274
|
+
:body => post_body,
|
|
275
|
+
:auth_names => auth_names,
|
|
276
|
+
:return_type => return_type
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
280
|
+
if @api_client.config.debugging
|
|
281
|
+
@api_client.config.logger.debug "API called: PaymentsApi#list_payment_operations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
282
|
+
end
|
|
283
|
+
return data, status_code, headers
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
# Retrieve all payments created.
|
|
287
|
+
# @param [Hash] opts the optional parameters
|
|
288
|
+
# @option opts [String] :next_token Cursor to start results from
|
|
289
|
+
# @option opts [String] :sort_by Sort payments by
|
|
290
|
+
# @option opts [String] :sort_order Sort Order
|
|
291
|
+
# @option opts [String] :start_at Get payments from this timestamp (unix)
|
|
292
|
+
# @option opts [String] :end_at Get payments till this timestamp (unix)
|
|
293
|
+
# @return [PaginatedPayments]
|
|
294
|
+
def list_payments(opts = {})
|
|
295
|
+
data, _status_code, _headers = list_payments_with_http_info(opts)
|
|
296
|
+
data
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Retrieve all payments created.
|
|
300
|
+
# @param [Hash] opts the optional parameters
|
|
301
|
+
# @option opts [String] :next_token Cursor to start results from
|
|
302
|
+
# @option opts [String] :sort_by Sort payments by
|
|
303
|
+
# @option opts [String] :sort_order Sort Order
|
|
304
|
+
# @option opts [String] :start_at Get payments from this timestamp (unix)
|
|
305
|
+
# @option opts [String] :end_at Get payments till this timestamp (unix)
|
|
306
|
+
# @return [Array<(PaginatedPayments, Integer, Hash)>] PaginatedPayments data, response status code and response headers
|
|
307
|
+
def list_payments_with_http_info(opts = {})
|
|
308
|
+
if @api_client.config.debugging
|
|
309
|
+
@api_client.config.logger.debug 'Calling API: PaymentsApi.list_payments ...'
|
|
310
|
+
end
|
|
311
|
+
allowable_values = ["createdAt", "updatedAt"]
|
|
312
|
+
if @api_client.config.client_side_validation && opts[:'sort_by'] && !allowable_values.include?(opts[:'sort_by'])
|
|
313
|
+
fail ArgumentError, "invalid value for \"sort_by\", must be one of #{allowable_values}"
|
|
314
|
+
end
|
|
315
|
+
allowable_values = ["ascending", "descending"]
|
|
316
|
+
if @api_client.config.client_side_validation && opts[:'sort_order'] && !allowable_values.include?(opts[:'sort_order'])
|
|
317
|
+
fail ArgumentError, "invalid value for \"sort_order\", must be one of #{allowable_values}"
|
|
318
|
+
end
|
|
319
|
+
# resource path
|
|
320
|
+
local_var_path = '/v1/payment'
|
|
321
|
+
|
|
322
|
+
# query parameters
|
|
323
|
+
query_params = opts[:query_params] || {}
|
|
324
|
+
query_params[:'nextToken'] = opts[:'next_token'] if !opts[:'next_token'].nil?
|
|
325
|
+
query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
|
|
326
|
+
query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?
|
|
327
|
+
query_params[:'startAt'] = opts[:'start_at'] if !opts[:'start_at'].nil?
|
|
328
|
+
query_params[:'endAt'] = opts[:'end_at'] if !opts[:'end_at'].nil?
|
|
329
|
+
|
|
330
|
+
# header parameters
|
|
331
|
+
header_params = opts[:header_params] || {}
|
|
332
|
+
# HTTP header 'Accept' (if needed)
|
|
333
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
334
|
+
|
|
335
|
+
# form parameters
|
|
336
|
+
form_params = opts[:form_params] || {}
|
|
337
|
+
|
|
338
|
+
# http body (model)
|
|
339
|
+
post_body = opts[:body]
|
|
340
|
+
|
|
341
|
+
# return_type
|
|
342
|
+
return_type = opts[:return_type] || 'PaginatedPayments'
|
|
343
|
+
|
|
344
|
+
# auth_names
|
|
345
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth']
|
|
346
|
+
|
|
347
|
+
new_options = opts.merge(
|
|
348
|
+
:header_params => header_params,
|
|
349
|
+
:query_params => query_params,
|
|
350
|
+
:form_params => form_params,
|
|
351
|
+
:body => post_body,
|
|
352
|
+
:auth_names => auth_names,
|
|
353
|
+
:return_type => return_type
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
357
|
+
if @api_client.config.debugging
|
|
358
|
+
@api_client.config.logger.debug "API called: PaymentsApi#list_payments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
359
|
+
end
|
|
360
|
+
return data, status_code, headers
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
# Refund the balance of a token for a given payment to the buyerAddress
|
|
364
|
+
# @param id [String] Unique identifier of the payment (specified during createPayment)
|
|
365
|
+
# @param payment_refund_request [PaymentRefundRequest] Request body - used to specify the token to refund.
|
|
366
|
+
# @param [Hash] opts the optional parameters
|
|
367
|
+
# @option opts [Chain] :chain Network in which payment is to be refunded.
|
|
368
|
+
# @return [PaymentOperationResponse]
|
|
369
|
+
def refund_payment(id, payment_refund_request, opts = {})
|
|
370
|
+
data, _status_code, _headers = refund_payment_with_http_info(id, payment_refund_request, opts)
|
|
371
|
+
data
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
# Refund the balance of a token for a given payment to the buyerAddress
|
|
375
|
+
# @param id [String] Unique identifier of the payment (specified during createPayment)
|
|
376
|
+
# @param payment_refund_request [PaymentRefundRequest] Request body - used to specify the token to refund.
|
|
377
|
+
# @param [Hash] opts the optional parameters
|
|
378
|
+
# @option opts [Chain] :chain Network in which payment is to be refunded.
|
|
379
|
+
# @return [Array<(PaymentOperationResponse, Integer, Hash)>] PaymentOperationResponse data, response status code and response headers
|
|
380
|
+
def refund_payment_with_http_info(id, payment_refund_request, opts = {})
|
|
381
|
+
if @api_client.config.debugging
|
|
382
|
+
@api_client.config.logger.debug 'Calling API: PaymentsApi.refund_payment ...'
|
|
383
|
+
end
|
|
384
|
+
# verify the required parameter 'id' is set
|
|
385
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
386
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling PaymentsApi.refund_payment"
|
|
387
|
+
end
|
|
388
|
+
# verify the required parameter 'payment_refund_request' is set
|
|
389
|
+
if @api_client.config.client_side_validation && payment_refund_request.nil?
|
|
390
|
+
fail ArgumentError, "Missing the required parameter 'payment_refund_request' when calling PaymentsApi.refund_payment"
|
|
391
|
+
end
|
|
392
|
+
# verify the values in the request body are valid
|
|
393
|
+
chain = opts[:'chain'] if !opts[:'chain'].nil?
|
|
394
|
+
msg = @request_validator.validate_refund_payment_request(payment_refund_request, chain)
|
|
395
|
+
if (@request_validator.is_not_empty(msg))
|
|
396
|
+
fail ArgumentError, "`#{msg}` when calling PaymentsApi.refund_payment"
|
|
397
|
+
end
|
|
398
|
+
# resource path
|
|
399
|
+
local_var_path = '/v1/payment/{id}/refund'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
400
|
+
|
|
401
|
+
# query parameters
|
|
402
|
+
query_params = opts[:query_params] || {}
|
|
403
|
+
query_params[:'chain'] = opts[:'chain'] if !opts[:'chain'].nil?
|
|
404
|
+
|
|
405
|
+
# header parameters
|
|
406
|
+
header_params = opts[:header_params] || {}
|
|
407
|
+
# HTTP header 'Accept' (if needed)
|
|
408
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
409
|
+
# HTTP header 'Content-Type'
|
|
410
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
411
|
+
|
|
412
|
+
# form parameters
|
|
413
|
+
form_params = opts[:form_params] || {}
|
|
414
|
+
|
|
415
|
+
# http body (model)
|
|
416
|
+
post_body = opts[:body] || @api_client.object_to_http_body(payment_refund_request)
|
|
417
|
+
|
|
418
|
+
# return_type
|
|
419
|
+
return_type = opts[:return_type] || 'PaymentOperationResponse'
|
|
420
|
+
|
|
421
|
+
# auth_names
|
|
422
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth']
|
|
423
|
+
|
|
424
|
+
new_options = opts.merge(
|
|
425
|
+
:header_params => header_params,
|
|
426
|
+
:query_params => query_params,
|
|
427
|
+
:form_params => form_params,
|
|
428
|
+
:body => post_body,
|
|
429
|
+
:auth_names => auth_names,
|
|
430
|
+
:return_type => return_type
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
434
|
+
if @api_client.config.debugging
|
|
435
|
+
@api_client.config.logger.debug "API called: PaymentsApi#refund_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
436
|
+
end
|
|
437
|
+
return data, status_code, headers
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
# Settle a specific amount of a token for a given payment to the transferAddress and remaining balance (if any) will be refunded to the buyerAddress
|
|
441
|
+
# @param id [String] Unique identifier of the payment (specified during createPayment)
|
|
442
|
+
# @param payment_settle_request [PaymentSettleRequest] Request body - used to specify the amount to settle.
|
|
443
|
+
# @param [Hash] opts the optional parameters
|
|
444
|
+
# @option opts [Chain] :chain Network in which payment is to be settled.
|
|
445
|
+
# @return [PaymentOperationResponse]
|
|
446
|
+
def settle_payment(id, payment_settle_request, opts = {})
|
|
447
|
+
data, _status_code, _headers = settle_payment_with_http_info(id, payment_settle_request, opts)
|
|
448
|
+
data
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
# Settle a specific amount of a token for a given payment to the transferAddress and remaining balance (if any) will be refunded to the buyerAddress
|
|
452
|
+
# @param id [String] Unique identifier of the payment (specified during createPayment)
|
|
453
|
+
# @param payment_settle_request [PaymentSettleRequest] Request body - used to specify the amount to settle.
|
|
454
|
+
# @param [Hash] opts the optional parameters
|
|
455
|
+
# @option opts [Chain] :chain Network in which payment is to be settled.
|
|
456
|
+
# @return [Array<(PaymentOperationResponse, Integer, Hash)>] PaymentOperationResponse data, response status code and response headers
|
|
457
|
+
def settle_payment_with_http_info(id, payment_settle_request, opts = {})
|
|
458
|
+
if @api_client.config.debugging
|
|
459
|
+
@api_client.config.logger.debug 'Calling API: PaymentsApi.settle_payment ...'
|
|
460
|
+
end
|
|
461
|
+
# verify the required parameter 'id' is set
|
|
462
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
463
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling PaymentsApi.settle_payment"
|
|
464
|
+
end
|
|
465
|
+
# verify the required parameter 'payment_settle_request' is set
|
|
466
|
+
if @api_client.config.client_side_validation && payment_settle_request.nil?
|
|
467
|
+
fail ArgumentError, "Missing the required parameter 'payment_settle_request' when calling PaymentsApi.settle_payment"
|
|
468
|
+
end
|
|
469
|
+
# verify the values in the request body are valid
|
|
470
|
+
chain = opts[:'chain'] if !opts[:'chain'].nil?
|
|
471
|
+
msg = @request_validator.validate_settle_payment_request(payment_settle_request, chain)
|
|
472
|
+
if (@request_validator.is_not_empty(msg))
|
|
473
|
+
fail ArgumentError, "`#{msg}` when calling PaymentsApi.settle_payment"
|
|
474
|
+
end
|
|
475
|
+
# resource path
|
|
476
|
+
local_var_path = '/v1/payment/{id}/settle'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
477
|
+
|
|
478
|
+
# query parameters
|
|
479
|
+
query_params = opts[:query_params] || {}
|
|
480
|
+
query_params[:'chain'] = opts[:'chain'] if !opts[:'chain'].nil?
|
|
481
|
+
|
|
482
|
+
# header parameters
|
|
483
|
+
header_params = opts[:header_params] || {}
|
|
484
|
+
# HTTP header 'Accept' (if needed)
|
|
485
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
486
|
+
# HTTP header 'Content-Type'
|
|
487
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
488
|
+
|
|
489
|
+
# form parameters
|
|
490
|
+
form_params = opts[:form_params] || {}
|
|
491
|
+
|
|
492
|
+
# http body (model)
|
|
493
|
+
post_body = opts[:body] || @api_client.object_to_http_body(payment_settle_request)
|
|
494
|
+
|
|
495
|
+
# return_type
|
|
496
|
+
return_type = opts[:return_type] || 'PaymentOperationResponse'
|
|
497
|
+
|
|
498
|
+
# auth_names
|
|
499
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth']
|
|
500
|
+
|
|
501
|
+
new_options = opts.merge(
|
|
502
|
+
:header_params => header_params,
|
|
503
|
+
:query_params => query_params,
|
|
504
|
+
:form_params => form_params,
|
|
505
|
+
:body => post_body,
|
|
506
|
+
:auth_names => auth_names,
|
|
507
|
+
:return_type => return_type
|
|
508
|
+
)
|
|
509
|
+
|
|
510
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
511
|
+
if @api_client.config.debugging
|
|
512
|
+
@api_client.config.logger.debug "API called: PaymentsApi#settle_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
513
|
+
end
|
|
514
|
+
return data, status_code, headers
|
|
515
|
+
end
|
|
516
|
+
end
|
|
517
|
+
end
|