moov_ruby 0.0.0.pre.dev.30 → 0.0.0.pre.dev.31
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/lib/moov/card_issuing.rb +538 -0
- data/lib/moov/files.rb +186 -0
- data/lib/moov/issuing_transactions.rb +123 -0
- data/lib/moov/models/components/applicationscope.rb +1 -0
- data/lib/moov/models/components/authorizationsimulationasyncresponse.rb +32 -0
- data/lib/moov/models/components/authorizationsimulationasyncresponse.rbi +13 -0
- data/lib/moov/models/components/bankaccount.rb +7 -2
- data/lib/moov/models/components/bankaccount.rbi +2 -0
- data/lib/moov/models/components/bankaccountpayload.rb +7 -2
- data/lib/moov/models/components/bankaccountpayload.rbi +2 -0
- data/lib/moov/models/components/cardpaymentrefundprocessingdetails.rb +6 -2
- data/lib/moov/models/components/cardpaymentrefundprocessingdetails.rbi +2 -0
- data/lib/moov/models/components/createauthorizationsimulation.rb +40 -0
- data/lib/moov/models/components/createauthorizationsimulation.rbi +17 -0
- data/lib/moov/models/components/createclearingsimulation.rb +32 -0
- data/lib/moov/models/components/createclearingsimulation.rbi +13 -0
- data/lib/moov/models/components/createdtransfer.rb +2 -1
- data/lib/moov/models/components/createinvoice.rb +6 -2
- data/lib/moov/models/components/createinvoice.rbi +2 -0
- data/lib/moov/models/components/disbursementpaymentmethodtype.rb +1 -0
- data/lib/moov/models/components/incurredfee.rb +6 -2
- data/lib/moov/models/components/incurredfee.rbi +2 -0
- data/lib/moov/models/components/issuedcardactivity.rb +78 -0
- data/lib/moov/models/components/issuedcardactivity.rbi +33 -0
- data/lib/moov/models/components/issuingmerchantdatavalidationerror.rb +56 -0
- data/lib/moov/models/components/issuingmerchantdatavalidationerror.rbi +25 -0
- data/lib/moov/models/components/paymentmethodsbankaccount.rb +7 -2
- data/lib/moov/models/components/paymentmethodsbankaccount.rbi +2 -0
- data/lib/moov/models/components/product.rb +1 -1
- data/lib/moov/models/components/productrequest.rb +1 -1
- data/lib/moov/models/components/riskverificationoutcome.rb +23 -0
- data/lib/moov/models/components/riskverificationoutcome.rbi +11 -0
- data/lib/moov/models/components/transfer.rb +2 -1
- data/lib/moov/models/components/transferauthorization.rb +9 -2
- data/lib/moov/models/components/transferauthorization.rbi +2 -0
- data/lib/moov/models/components/transferevent.rb +48 -0
- data/lib/moov/models/components/transferevent.rbi +21 -0
- data/lib/moov/models/components/transfereventachdetails.rb +40 -0
- data/lib/moov/models/components/transfereventachdetails.rbi +17 -0
- data/lib/moov/models/components/transfereventauthorizationdetails.rb +40 -0
- data/lib/moov/models/components/transfereventauthorizationdetails.rbi +17 -0
- data/lib/moov/models/components/transfereventauthorizationstatus.rb +22 -0
- data/lib/moov/models/components/transfereventauthorizationstatus.rbi +11 -0
- data/lib/moov/models/components/transfereventcancellationdetails.rb +36 -0
- data/lib/moov/models/components/transfereventcancellationdetails.rbi +15 -0
- data/lib/moov/models/components/transfereventcapturedetails.rb +40 -0
- data/lib/moov/models/components/transfereventcapturedetails.rbi +17 -0
- data/lib/moov/models/components/transfereventcardpaymentdetails.rb +36 -0
- data/lib/moov/models/components/transfereventcardpaymentdetails.rbi +15 -0
- data/lib/moov/models/components/transfereventdetails.rb +88 -0
- data/lib/moov/models/components/transfereventdetails.rbi +41 -0
- data/lib/moov/models/components/transfereventdisputedetails.rb +46 -0
- data/lib/moov/models/components/transfereventdisputedetails.rbi +19 -0
- data/lib/moov/models/components/transfereventinstantbankcreditdetails.rb +36 -0
- data/lib/moov/models/components/transfereventinstantbankcreditdetails.rbi +15 -0
- data/lib/moov/models/components/transfereventpullfromcarddetails.rb +36 -0
- data/lib/moov/models/components/transfereventpullfromcarddetails.rbi +15 -0
- data/lib/moov/models/components/transfereventpushtocarddetails.rb +36 -0
- data/lib/moov/models/components/transfereventpushtocarddetails.rbi +15 -0
- data/lib/moov/models/components/transfereventrefunddetails.rb +44 -0
- data/lib/moov/models/components/transfereventrefunddetails.rbi +19 -0
- data/lib/moov/models/components/transfereventtransferdetails.rb +32 -0
- data/lib/moov/models/components/transfereventtransferdetails.rbi +13 -0
- data/lib/moov/models/components/transfereventtype.rb +34 -0
- data/lib/moov/models/components/transfereventtype.rbi +11 -0
- data/lib/moov/models/components/transfereventwallettransactiondetails.rb +48 -0
- data/lib/moov/models/components/transfereventwallettransactiondetails.rbi +21 -0
- data/lib/moov/models/components/transfereventwirecreditdetails.rb +36 -0
- data/lib/moov/models/components/transfereventwirecreditdetails.rbi +15 -0
- data/lib/moov/models/components/transferpaymentmethodsbankaccount.rb +7 -2
- data/lib/moov/models/components/transferpaymentmethodsbankaccount.rbi +2 -0
- data/lib/moov/models/components/webhookdatatransferstatus.rb +1 -0
- data/lib/moov/models/components.rb +23 -0
- data/lib/moov/models/errors/authorizationsimulationvalidationerror.rb +44 -0
- data/lib/moov/models/errors/authorizationsimulationvalidationerror.rbi +19 -0
- data/lib/moov/models/errors/clearingsimulationvalidationerror.rb +36 -0
- data/lib/moov/models/errors/clearingsimulationvalidationerror.rbi +15 -0
- data/lib/moov/models/errors/createinvoiceerror.rb +6 -2
- data/lib/moov/models/errors/createinvoiceerror.rbi +2 -0
- data/lib/moov/models/errors/transfer_error.rb +2 -1
- data/lib/moov/models/errors.rb +2 -0
- data/lib/moov/models/operations/createauthorizationsimulation_request.rb +36 -0
- data/lib/moov/models/operations/createauthorizationsimulation_request.rbi +15 -0
- data/lib/moov/models/operations/createauthorizationsimulation_response.rb +52 -0
- data/lib/moov/models/operations/createauthorizationsimulation_response.rbi +23 -0
- data/lib/moov/models/operations/createclearingsimulation_request.rb +40 -0
- data/lib/moov/models/operations/createclearingsimulation_request.rbi +17 -0
- data/lib/moov/models/operations/createclearingsimulation_response.rb +52 -0
- data/lib/moov/models/operations/createclearingsimulation_response.rbi +23 -0
- data/lib/moov/models/operations/createreversalsimulation_request.rb +36 -0
- data/lib/moov/models/operations/createreversalsimulation_request.rbi +15 -0
- data/lib/moov/models/operations/createreversalsimulation_response.rb +52 -0
- data/lib/moov/models/operations/createreversalsimulation_response.rbi +23 -0
- data/lib/moov/models/operations/downloadfile_request.rb +36 -0
- data/lib/moov/models/operations/downloadfile_request.rbi +15 -0
- data/lib/moov/models/operations/downloadfile_response.rb +64 -0
- data/lib/moov/models/operations/downloadfile_response.rbi +29 -0
- data/lib/moov/models/operations/listissuedcardactivity_request.rb +60 -0
- data/lib/moov/models/operations/listissuedcardactivity_request.rbi +27 -0
- data/lib/moov/models/operations/listissuedcardactivity_response.rb +48 -0
- data/lib/moov/models/operations/listissuedcardactivity_response.rbi +21 -0
- data/lib/moov/models/operations/listtransferevents_request.rb +36 -0
- data/lib/moov/models/operations/listtransferevents_request.rbi +15 -0
- data/lib/moov/models/operations/listtransferevents_response.rb +48 -0
- data/lib/moov/models/operations/listtransferevents_response.rbi +21 -0
- data/lib/moov/models/operations/listtransfers_request.rb +6 -2
- data/lib/moov/models/operations/listtransfers_request.rbi +2 -0
- data/lib/moov/models/operations.rb +12 -0
- data/lib/moov/sdkconfiguration.rb +3 -3
- data/lib/moov/transfers.rb +125 -0
- metadata +76 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f204b885ee827f0f4c98470cbdc3c1b6179536fbaac47cae47c92269720287e6
|
|
4
|
+
data.tar.gz: 801b7c08d5ebdc8a6721f66fbc90b2a1536c74682cb2a6596a42e54d34e8598b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86877d6bb413904b34ee314042cdf9c210a4839af96f3ed76227b06b0936ffa405966c7aa2a2b3d23181df8a94d1762d44b2975a2009cb798fbce935ce959796
|
|
7
|
+
data.tar.gz: 820d745602623cb8824b922a96eaf492bec04aeaca6f13aa886c092839756d1b00932fb156feb0eda7c956accfde04d5328d1ef26562c5c601d69de51e8a08ac
|
data/lib/moov/card_issuing.rb
CHANGED
|
@@ -157,6 +157,544 @@ module Moov
|
|
|
157
157
|
end
|
|
158
158
|
|
|
159
159
|
|
|
160
|
+
sig { params(create_authorization_simulation: Models::Components::CreateAuthorizationSimulation, account_id: ::String, timeout_ms: T.nilable(Integer), http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])).returns(Models::Operations::CreateAuthorizationSimulationResponse) }
|
|
161
|
+
def create_authorization(create_authorization_simulation:, account_id:, timeout_ms: nil, http_headers: nil)
|
|
162
|
+
# create_authorization - Create a simulated authorization for an issued card in test mode. See our [test mode](https://docs.moov.io/guides/get-started/test-mode)
|
|
163
|
+
# guide for more information.
|
|
164
|
+
#
|
|
165
|
+
# To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
|
166
|
+
# you'll need to specify the `/accounts/{accountID}/issued-cards.write` scope.
|
|
167
|
+
request = Models::Operations::CreateAuthorizationSimulationRequest.new(
|
|
168
|
+
account_id: account_id,
|
|
169
|
+
create_authorization_simulation: create_authorization_simulation
|
|
170
|
+
)
|
|
171
|
+
url, params = @sdk_configuration.get_server_details
|
|
172
|
+
base_url = Utils.template_url(url, params)
|
|
173
|
+
url = Utils.generate_url(
|
|
174
|
+
Models::Operations::CreateAuthorizationSimulationRequest,
|
|
175
|
+
base_url,
|
|
176
|
+
'/issuing/simulations/{accountID}/authorizations',
|
|
177
|
+
request
|
|
178
|
+
)
|
|
179
|
+
headers = {}
|
|
180
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
181
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :create_authorization_simulation, :json)
|
|
182
|
+
headers['content-type'] = req_content_type
|
|
183
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
|
184
|
+
|
|
185
|
+
if form && !form.empty?
|
|
186
|
+
body = Utils.encode_form(form)
|
|
187
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
188
|
+
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
189
|
+
else
|
|
190
|
+
body = data
|
|
191
|
+
end
|
|
192
|
+
headers['Accept'] = 'application/json'
|
|
193
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
194
|
+
|
|
195
|
+
security = @sdk_configuration.security_source&.call
|
|
196
|
+
|
|
197
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
198
|
+
timeout ||= @sdk_configuration.timeout
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
connection = @sdk_configuration.client
|
|
202
|
+
|
|
203
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
204
|
+
config: @sdk_configuration,
|
|
205
|
+
base_url: base_url,
|
|
206
|
+
oauth2_scopes: nil,
|
|
207
|
+
operation_id: 'createAuthorizationSimulation',
|
|
208
|
+
security_source: @sdk_configuration.security_source
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
212
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
begin
|
|
216
|
+
http_response = T.must(connection).post(url) do |req|
|
|
217
|
+
req.body = body
|
|
218
|
+
req.headers.merge!(headers)
|
|
219
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
220
|
+
Utils.configure_request_security(req, security)
|
|
221
|
+
http_headers&.each do |key, value|
|
|
222
|
+
req.headers[key.to_s] = value
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
@sdk_configuration.hooks.before_request(
|
|
226
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
227
|
+
hook_ctx: hook_ctx
|
|
228
|
+
),
|
|
229
|
+
request: req
|
|
230
|
+
)
|
|
231
|
+
end
|
|
232
|
+
rescue StandardError => e
|
|
233
|
+
error = e
|
|
234
|
+
ensure
|
|
235
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
236
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
237
|
+
error: error,
|
|
238
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
239
|
+
hook_ctx: hook_ctx
|
|
240
|
+
),
|
|
241
|
+
response: http_response
|
|
242
|
+
)
|
|
243
|
+
else
|
|
244
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
245
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
246
|
+
hook_ctx: hook_ctx
|
|
247
|
+
),
|
|
248
|
+
response: http_response
|
|
249
|
+
)
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
if http_response.nil?
|
|
253
|
+
raise error if !error.nil?
|
|
254
|
+
raise 'no response'
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
259
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
260
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
261
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
262
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
263
|
+
hook_ctx: hook_ctx
|
|
264
|
+
),
|
|
265
|
+
response: http_response
|
|
266
|
+
)
|
|
267
|
+
response_data = http_response.env.response_body
|
|
268
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::IssuedCardAuthorization)
|
|
269
|
+
response = Models::Operations::CreateAuthorizationSimulationResponse.new(
|
|
270
|
+
status_code: http_response.status,
|
|
271
|
+
content_type: content_type,
|
|
272
|
+
raw_response: http_response,
|
|
273
|
+
headers: http_response.headers,
|
|
274
|
+
issued_card_authorization: T.unsafe(obj)
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
return response
|
|
278
|
+
else
|
|
279
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
280
|
+
end
|
|
281
|
+
elsif Utils.match_status_code(http_response.status, ['202'])
|
|
282
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
283
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
284
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
285
|
+
hook_ctx: hook_ctx
|
|
286
|
+
),
|
|
287
|
+
response: http_response
|
|
288
|
+
)
|
|
289
|
+
response_data = http_response.env.response_body
|
|
290
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::AuthorizationSimulationAsyncResponse)
|
|
291
|
+
response = Models::Operations::CreateAuthorizationSimulationResponse.new(
|
|
292
|
+
status_code: http_response.status,
|
|
293
|
+
content_type: content_type,
|
|
294
|
+
raw_response: http_response,
|
|
295
|
+
headers: http_response.headers,
|
|
296
|
+
authorization_simulation_async_response: T.unsafe(obj)
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
return response
|
|
300
|
+
else
|
|
301
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
302
|
+
end
|
|
303
|
+
elsif Utils.match_status_code(http_response.status, ['400', '409'])
|
|
304
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
305
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
306
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
307
|
+
hook_ctx: hook_ctx
|
|
308
|
+
),
|
|
309
|
+
response: http_response
|
|
310
|
+
)
|
|
311
|
+
response_data = http_response.env.response_body
|
|
312
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::GenericError)
|
|
313
|
+
obj.raw_response = http_response
|
|
314
|
+
raise obj
|
|
315
|
+
else
|
|
316
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
317
|
+
end
|
|
318
|
+
elsif Utils.match_status_code(http_response.status, ['422'])
|
|
319
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
320
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
321
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
322
|
+
hook_ctx: hook_ctx
|
|
323
|
+
),
|
|
324
|
+
response: http_response
|
|
325
|
+
)
|
|
326
|
+
response_data = http_response.env.response_body
|
|
327
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::AuthorizationSimulationValidationError)
|
|
328
|
+
obj.raw_response = http_response
|
|
329
|
+
raise obj
|
|
330
|
+
else
|
|
331
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
332
|
+
end
|
|
333
|
+
elsif Utils.match_status_code(http_response.status, ['401', '403', '404', '429'])
|
|
334
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
335
|
+
elsif Utils.match_status_code(http_response.status, ['500', '504'])
|
|
336
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
337
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
338
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
339
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
340
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
341
|
+
else
|
|
342
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
|
343
|
+
|
|
344
|
+
end
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
sig { params(create_clearing_simulation: Models::Components::CreateClearingSimulation, account_id: ::String, authorization_id: ::String, timeout_ms: T.nilable(Integer), http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])).returns(Models::Operations::CreateClearingSimulationResponse) }
|
|
349
|
+
def create_clearing(create_clearing_simulation:, account_id:, authorization_id:, timeout_ms: nil, http_headers: nil)
|
|
350
|
+
# create_clearing - Create a simulated clearing for an authorization on an issued card in test mode. See our [test mode](https://docs.moov.io/guides/get-started/test-mode)
|
|
351
|
+
# guide for more information.
|
|
352
|
+
#
|
|
353
|
+
# To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
|
354
|
+
# you'll need to specify the `/accounts/{accountID}/issued-cards.write` scope.
|
|
355
|
+
request = Models::Operations::CreateClearingSimulationRequest.new(
|
|
356
|
+
account_id: account_id,
|
|
357
|
+
authorization_id: authorization_id,
|
|
358
|
+
create_clearing_simulation: create_clearing_simulation
|
|
359
|
+
)
|
|
360
|
+
url, params = @sdk_configuration.get_server_details
|
|
361
|
+
base_url = Utils.template_url(url, params)
|
|
362
|
+
url = Utils.generate_url(
|
|
363
|
+
Models::Operations::CreateClearingSimulationRequest,
|
|
364
|
+
base_url,
|
|
365
|
+
'/issuing/simulations/{accountID}/authorizations/{authorizationID}/clearings',
|
|
366
|
+
request
|
|
367
|
+
)
|
|
368
|
+
headers = {}
|
|
369
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
370
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :create_clearing_simulation, :json)
|
|
371
|
+
headers['content-type'] = req_content_type
|
|
372
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
|
373
|
+
|
|
374
|
+
if form && !form.empty?
|
|
375
|
+
body = Utils.encode_form(form)
|
|
376
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
377
|
+
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
378
|
+
else
|
|
379
|
+
body = data
|
|
380
|
+
end
|
|
381
|
+
headers['Accept'] = 'application/json'
|
|
382
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
383
|
+
|
|
384
|
+
security = @sdk_configuration.security_source&.call
|
|
385
|
+
|
|
386
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
387
|
+
timeout ||= @sdk_configuration.timeout
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
connection = @sdk_configuration.client
|
|
391
|
+
|
|
392
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
393
|
+
config: @sdk_configuration,
|
|
394
|
+
base_url: base_url,
|
|
395
|
+
oauth2_scopes: nil,
|
|
396
|
+
operation_id: 'createClearingSimulation',
|
|
397
|
+
security_source: @sdk_configuration.security_source
|
|
398
|
+
)
|
|
399
|
+
|
|
400
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
401
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
begin
|
|
405
|
+
http_response = T.must(connection).post(url) do |req|
|
|
406
|
+
req.body = body
|
|
407
|
+
req.headers.merge!(headers)
|
|
408
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
409
|
+
Utils.configure_request_security(req, security)
|
|
410
|
+
http_headers&.each do |key, value|
|
|
411
|
+
req.headers[key.to_s] = value
|
|
412
|
+
end
|
|
413
|
+
|
|
414
|
+
@sdk_configuration.hooks.before_request(
|
|
415
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
416
|
+
hook_ctx: hook_ctx
|
|
417
|
+
),
|
|
418
|
+
request: req
|
|
419
|
+
)
|
|
420
|
+
end
|
|
421
|
+
rescue StandardError => e
|
|
422
|
+
error = e
|
|
423
|
+
ensure
|
|
424
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
425
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
426
|
+
error: error,
|
|
427
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
428
|
+
hook_ctx: hook_ctx
|
|
429
|
+
),
|
|
430
|
+
response: http_response
|
|
431
|
+
)
|
|
432
|
+
else
|
|
433
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
434
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
435
|
+
hook_ctx: hook_ctx
|
|
436
|
+
),
|
|
437
|
+
response: http_response
|
|
438
|
+
)
|
|
439
|
+
end
|
|
440
|
+
|
|
441
|
+
if http_response.nil?
|
|
442
|
+
raise error if !error.nil?
|
|
443
|
+
raise 'no response'
|
|
444
|
+
end
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
448
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
449
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
450
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
451
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
452
|
+
hook_ctx: hook_ctx
|
|
453
|
+
),
|
|
454
|
+
response: http_response
|
|
455
|
+
)
|
|
456
|
+
response_data = http_response.env.response_body
|
|
457
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::IssuedCardAuthorization)
|
|
458
|
+
response = Models::Operations::CreateClearingSimulationResponse.new(
|
|
459
|
+
status_code: http_response.status,
|
|
460
|
+
content_type: content_type,
|
|
461
|
+
raw_response: http_response,
|
|
462
|
+
headers: http_response.headers,
|
|
463
|
+
issued_card_authorization: T.unsafe(obj)
|
|
464
|
+
)
|
|
465
|
+
|
|
466
|
+
return response
|
|
467
|
+
else
|
|
468
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
469
|
+
end
|
|
470
|
+
elsif Utils.match_status_code(http_response.status, ['202'])
|
|
471
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
472
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
473
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
474
|
+
hook_ctx: hook_ctx
|
|
475
|
+
),
|
|
476
|
+
response: http_response
|
|
477
|
+
)
|
|
478
|
+
response_data = http_response.env.response_body
|
|
479
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::AuthorizationSimulationAsyncResponse)
|
|
480
|
+
response = Models::Operations::CreateClearingSimulationResponse.new(
|
|
481
|
+
status_code: http_response.status,
|
|
482
|
+
content_type: content_type,
|
|
483
|
+
raw_response: http_response,
|
|
484
|
+
headers: http_response.headers,
|
|
485
|
+
authorization_simulation_async_response: T.unsafe(obj)
|
|
486
|
+
)
|
|
487
|
+
|
|
488
|
+
return response
|
|
489
|
+
else
|
|
490
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
491
|
+
end
|
|
492
|
+
elsif Utils.match_status_code(http_response.status, ['400', '409'])
|
|
493
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
494
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
495
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
496
|
+
hook_ctx: hook_ctx
|
|
497
|
+
),
|
|
498
|
+
response: http_response
|
|
499
|
+
)
|
|
500
|
+
response_data = http_response.env.response_body
|
|
501
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::GenericError)
|
|
502
|
+
obj.raw_response = http_response
|
|
503
|
+
raise obj
|
|
504
|
+
else
|
|
505
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
506
|
+
end
|
|
507
|
+
elsif Utils.match_status_code(http_response.status, ['422'])
|
|
508
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
509
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
510
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
511
|
+
hook_ctx: hook_ctx
|
|
512
|
+
),
|
|
513
|
+
response: http_response
|
|
514
|
+
)
|
|
515
|
+
response_data = http_response.env.response_body
|
|
516
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClearingSimulationValidationError)
|
|
517
|
+
obj.raw_response = http_response
|
|
518
|
+
raise obj
|
|
519
|
+
else
|
|
520
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
521
|
+
end
|
|
522
|
+
elsif Utils.match_status_code(http_response.status, ['401', '403', '404', '429'])
|
|
523
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
524
|
+
elsif Utils.match_status_code(http_response.status, ['500', '504'])
|
|
525
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
526
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
527
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
528
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
529
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
530
|
+
else
|
|
531
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
|
532
|
+
|
|
533
|
+
end
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
sig { params(account_id: ::String, authorization_id: ::String, timeout_ms: T.nilable(Integer), http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])).returns(Models::Operations::CreateReversalSimulationResponse) }
|
|
538
|
+
def create_reversal(account_id:, authorization_id:, timeout_ms: nil, http_headers: nil)
|
|
539
|
+
# create_reversal - Create a simulated reversal for an authorization on an issued card in test mode. See our [test mode](https://docs.moov.io/guides/get-started/test-mode)
|
|
540
|
+
# guide for more information.
|
|
541
|
+
#
|
|
542
|
+
# To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
|
543
|
+
# you'll need to specify the `/accounts/{accountID}/issued-cards.write` scope.
|
|
544
|
+
request = Models::Operations::CreateReversalSimulationRequest.new(
|
|
545
|
+
account_id: account_id,
|
|
546
|
+
authorization_id: authorization_id
|
|
547
|
+
)
|
|
548
|
+
url, params = @sdk_configuration.get_server_details
|
|
549
|
+
base_url = Utils.template_url(url, params)
|
|
550
|
+
url = Utils.generate_url(
|
|
551
|
+
Models::Operations::CreateReversalSimulationRequest,
|
|
552
|
+
base_url,
|
|
553
|
+
'/issuing/simulations/{accountID}/authorizations/{authorizationID}/reversals',
|
|
554
|
+
request
|
|
555
|
+
)
|
|
556
|
+
headers = {}
|
|
557
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
558
|
+
headers['Accept'] = 'application/json'
|
|
559
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
560
|
+
|
|
561
|
+
security = @sdk_configuration.security_source&.call
|
|
562
|
+
|
|
563
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
564
|
+
timeout ||= @sdk_configuration.timeout
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
connection = @sdk_configuration.client
|
|
568
|
+
|
|
569
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
570
|
+
config: @sdk_configuration,
|
|
571
|
+
base_url: base_url,
|
|
572
|
+
oauth2_scopes: nil,
|
|
573
|
+
operation_id: 'createReversalSimulation',
|
|
574
|
+
security_source: @sdk_configuration.security_source
|
|
575
|
+
)
|
|
576
|
+
|
|
577
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
578
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
begin
|
|
582
|
+
http_response = T.must(connection).post(url) do |req|
|
|
583
|
+
req.headers.merge!(headers)
|
|
584
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
585
|
+
Utils.configure_request_security(req, security)
|
|
586
|
+
http_headers&.each do |key, value|
|
|
587
|
+
req.headers[key.to_s] = value
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
@sdk_configuration.hooks.before_request(
|
|
591
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
592
|
+
hook_ctx: hook_ctx
|
|
593
|
+
),
|
|
594
|
+
request: req
|
|
595
|
+
)
|
|
596
|
+
end
|
|
597
|
+
rescue StandardError => e
|
|
598
|
+
error = e
|
|
599
|
+
ensure
|
|
600
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
601
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
602
|
+
error: error,
|
|
603
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
604
|
+
hook_ctx: hook_ctx
|
|
605
|
+
),
|
|
606
|
+
response: http_response
|
|
607
|
+
)
|
|
608
|
+
else
|
|
609
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
610
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
611
|
+
hook_ctx: hook_ctx
|
|
612
|
+
),
|
|
613
|
+
response: http_response
|
|
614
|
+
)
|
|
615
|
+
end
|
|
616
|
+
|
|
617
|
+
if http_response.nil?
|
|
618
|
+
raise error if !error.nil?
|
|
619
|
+
raise 'no response'
|
|
620
|
+
end
|
|
621
|
+
end
|
|
622
|
+
|
|
623
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
624
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
625
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
626
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
627
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
628
|
+
hook_ctx: hook_ctx
|
|
629
|
+
),
|
|
630
|
+
response: http_response
|
|
631
|
+
)
|
|
632
|
+
response_data = http_response.env.response_body
|
|
633
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::IssuedCardAuthorization)
|
|
634
|
+
response = Models::Operations::CreateReversalSimulationResponse.new(
|
|
635
|
+
status_code: http_response.status,
|
|
636
|
+
content_type: content_type,
|
|
637
|
+
raw_response: http_response,
|
|
638
|
+
headers: http_response.headers,
|
|
639
|
+
issued_card_authorization: T.unsafe(obj)
|
|
640
|
+
)
|
|
641
|
+
|
|
642
|
+
return response
|
|
643
|
+
else
|
|
644
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
645
|
+
end
|
|
646
|
+
elsif Utils.match_status_code(http_response.status, ['202'])
|
|
647
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
648
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
649
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
650
|
+
hook_ctx: hook_ctx
|
|
651
|
+
),
|
|
652
|
+
response: http_response
|
|
653
|
+
)
|
|
654
|
+
response_data = http_response.env.response_body
|
|
655
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::AuthorizationSimulationAsyncResponse)
|
|
656
|
+
response = Models::Operations::CreateReversalSimulationResponse.new(
|
|
657
|
+
status_code: http_response.status,
|
|
658
|
+
content_type: content_type,
|
|
659
|
+
raw_response: http_response,
|
|
660
|
+
headers: http_response.headers,
|
|
661
|
+
authorization_simulation_async_response: T.unsafe(obj)
|
|
662
|
+
)
|
|
663
|
+
|
|
664
|
+
return response
|
|
665
|
+
else
|
|
666
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
667
|
+
end
|
|
668
|
+
elsif Utils.match_status_code(http_response.status, ['400', '409'])
|
|
669
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
670
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
671
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
672
|
+
hook_ctx: hook_ctx
|
|
673
|
+
),
|
|
674
|
+
response: http_response
|
|
675
|
+
)
|
|
676
|
+
response_data = http_response.env.response_body
|
|
677
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::GenericError)
|
|
678
|
+
obj.raw_response = http_response
|
|
679
|
+
raise obj
|
|
680
|
+
else
|
|
681
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
682
|
+
end
|
|
683
|
+
elsif Utils.match_status_code(http_response.status, ['401', '403', '404', '429'])
|
|
684
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
685
|
+
elsif Utils.match_status_code(http_response.status, ['500', '504'])
|
|
686
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
687
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
688
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
689
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
690
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
691
|
+
else
|
|
692
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
|
693
|
+
|
|
694
|
+
end
|
|
695
|
+
end
|
|
696
|
+
|
|
697
|
+
|
|
160
698
|
sig { params(request_card: Models::Components::RequestCard, account_id: ::String, timeout_ms: T.nilable(Integer), http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])).returns(Models::Operations::RequestCardResponse) }
|
|
161
699
|
def request(request_card:, account_id:, timeout_ms: nil, http_headers: nil)
|
|
162
700
|
# request - Request a virtual card be issued.
|