moov_ruby 0.0.0.pre.dev.24 → 0.0.0.pre.dev.25
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/avatars.rb +4 -4
- data/lib/moov/card_issuing.rb +116 -0
- data/lib/moov/client.rb +2 -2
- data/lib/moov/enriched_address.rb +1 -1
- data/lib/moov/enriched_profile.rb +1 -1
- data/lib/moov/institutions.rb +1 -1
- data/lib/moov/models/components/achcreditoptions.rb +40 -0
- data/lib/moov/models/components/achcreditoptions.rbi +17 -0
- data/lib/moov/models/components/achcredittransferprocessingdetails.rb +40 -0
- data/lib/moov/models/components/achcredittransferprocessingdetails.rbi +17 -0
- data/lib/moov/models/components/achdebitoptions.rb +48 -0
- data/lib/moov/models/components/achdebitoptions.rbi +21 -0
- data/lib/moov/models/components/achdebittransferprocessingdetails.rb +40 -0
- data/lib/moov/models/components/achdebittransferprocessingdetails.rbi +17 -0
- data/lib/moov/models/components/asynccreatedrefund.rb +7 -3
- data/lib/moov/models/components/asynccreatedrefund.rbi +2 -0
- data/lib/moov/models/components/capture.rb +77 -0
- data/lib/moov/models/components/capture.rbi +35 -0
- data/lib/moov/models/components/{refundcardstatus.rb → capturestatus.rb} +5 -4
- data/lib/moov/models/components/{refundcardstatus.rbi → capturestatus.rbi} +2 -2
- data/lib/moov/models/components/cardacquiringrefund.rb +11 -7
- data/lib/moov/models/components/cardacquiringrefund.rbi +4 -2
- data/lib/moov/models/components/cardpaymentoptions.rb +39 -0
- data/lib/moov/models/components/cardpaymentoptions.rbi +15 -0
- data/lib/moov/models/components/cardpaymentrefundprocessingdetails.rb +32 -0
- data/lib/moov/models/components/cardpaymentrefundprocessingdetails.rbi +13 -0
- data/lib/moov/models/components/cardpaymenttransferprocessingdetails.rb +44 -0
- data/lib/moov/models/components/cardpaymenttransferprocessingdetails.rbi +19 -0
- data/lib/moov/models/components/createcancellation.rb +32 -0
- data/lib/moov/models/components/createcancellation.rbi +13 -0
- data/lib/moov/models/components/createcapture.rb +65 -0
- data/lib/moov/models/components/createcapture.rbi +29 -0
- data/lib/moov/models/components/createdtransfer.rb +22 -26
- data/lib/moov/models/components/createdtransfer.rbi +8 -10
- data/lib/moov/models/components/createrefund.rb +9 -5
- data/lib/moov/models/components/createrefund.rbi +2 -0
- data/lib/moov/models/components/createreversal.rb +3 -3
- data/lib/moov/models/components/createtransfer.rb +4 -4
- data/lib/moov/models/components/createtransferfacilitatorfee.rb +36 -0
- data/lib/moov/models/components/createtransferfacilitatorfee.rbi +15 -0
- data/lib/moov/models/components/createtransferoptions.rb +2 -2
- data/lib/moov/models/components/instantbankcredittransferprocessingdetails.rb +44 -0
- data/lib/moov/models/components/instantbankcredittransferprocessingdetails.rbi +19 -0
- data/lib/moov/models/components/merchantcategories.rb +32 -0
- data/lib/moov/models/components/merchantcategories.rbi +13 -0
- data/lib/moov/models/components/merchantcategory.rb +37 -0
- data/lib/moov/models/components/merchantcategory.rbi +15 -0
- data/lib/moov/models/components/moovfeedetails.rb +5 -5
- data/lib/moov/models/components/paymentmethodswallet.rb +1 -0
- data/lib/moov/models/components/pullfromcardoptions.rb +39 -0
- data/lib/moov/models/components/pullfromcardoptions.rbi +15 -0
- data/lib/moov/models/components/pullfromcardtransferprocessingdetails.rb +44 -0
- data/lib/moov/models/components/pullfromcardtransferprocessingdetails.rbi +19 -0
- data/lib/moov/models/components/pushtocardoptions.rb +32 -0
- data/lib/moov/models/components/pushtocardoptions.rbi +13 -0
- data/lib/moov/models/components/pushtocardtransferprocessingdetails.rb +44 -0
- data/lib/moov/models/components/pushtocardtransferprocessingdetails.rbi +19 -0
- data/lib/moov/models/components/refundprocessingdetails.rb +32 -0
- data/lib/moov/models/components/refundprocessingdetails.rbi +13 -0
- data/lib/moov/models/components/sendfunds.rb +6 -2
- data/lib/moov/models/components/sendfunds.rbi +2 -0
- data/lib/moov/models/components/sendfundserror.rb +6 -2
- data/lib/moov/models/components/sendfundserror.rbi +2 -0
- data/lib/moov/models/components/sendfundswire.rb +32 -0
- data/lib/moov/models/components/sendfundswire.rbi +13 -0
- data/lib/moov/models/components/sendfundswireerror.rb +32 -0
- data/lib/moov/models/components/sendfundswireerror.rbi +13 -0
- data/lib/moov/models/components/transfer.rb +22 -26
- data/lib/moov/models/components/transfer.rbi +8 -10
- data/lib/moov/models/components/transferauthorization.rb +52 -0
- data/lib/moov/models/components/transferauthorization.rbi +23 -0
- data/lib/moov/models/components/transferdestination.rb +5 -17
- data/lib/moov/models/components/transferdestination.rbi +0 -6
- data/lib/moov/models/components/transferpaymentmethodswallet.rb +1 -0
- data/lib/moov/models/components/transferprocessingdetails.rb +52 -0
- data/lib/moov/models/components/transferprocessingdetails.rbi +23 -0
- data/lib/moov/models/components/transferrailoptions.rb +48 -0
- data/lib/moov/models/components/transferrailoptions.rbi +21 -0
- data/lib/moov/models/components/transfersource.rb +9 -17
- data/lib/moov/models/components/transfersource.rbi +2 -6
- data/lib/moov/models/components/transferstatus.rb +1 -0
- data/lib/moov/models/components/transfertype.rb +25 -0
- data/lib/moov/models/components/{achtransactionstatus.rbi → transfertype.rbi} +2 -2
- data/lib/moov/models/components/wallet.rb +1 -0
- data/lib/moov/models/components/wallettype.rb +2 -0
- data/lib/moov/models/components/webhookdatatransferstatus.rb +3 -0
- data/lib/moov/models/components.rb +26 -10
- data/lib/moov/models/errors/capturevalidationerror.rb +68 -0
- data/lib/moov/models/errors/capturevalidationerror.rbi +31 -0
- data/lib/moov/models/errors/cardacquiringrefund_error.rb +11 -7
- data/lib/moov/models/errors/cardacquiringrefund_error.rbi +4 -2
- data/lib/moov/models/errors/transfer_error.rb +22 -26
- data/lib/moov/models/errors/transfer_error.rbi +8 -10
- data/lib/moov/models/errors.rb +1 -0
- data/lib/moov/models/operations/createcancellation_request.rb +6 -2
- data/lib/moov/models/operations/createcancellation_request.rbi +2 -0
- data/lib/moov/models/operations/createcapture_request.rb +44 -0
- data/lib/moov/models/operations/createcapture_request.rbi +19 -0
- data/lib/moov/models/operations/createcapture_response.rb +48 -0
- data/lib/moov/models/operations/createcapture_response.rbi +21 -0
- data/lib/moov/models/operations/createreversal_request.rb +3 -3
- data/lib/moov/models/operations/getcapture_request.rb +40 -0
- data/lib/moov/models/operations/getcapture_request.rbi +17 -0
- data/lib/moov/models/operations/getcapture_response.rb +48 -0
- data/lib/moov/models/operations/getcapture_response.rbi +21 -0
- data/lib/moov/models/operations/initiaterefund_request.rb +6 -6
- data/lib/moov/models/operations/initiaterefund_request.rbi +2 -2
- data/lib/moov/models/operations/listcaptures_request.rb +36 -0
- data/lib/moov/models/operations/listcaptures_request.rbi +15 -0
- data/lib/moov/models/operations/listcaptures_response.rb +48 -0
- data/lib/moov/models/operations/listcaptures_response.rbi +21 -0
- data/lib/moov/models/operations/listissuingmerchantcategories_response.rb +48 -0
- data/lib/moov/models/operations/listissuingmerchantcategories_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 +7 -0
- data/lib/moov/sdkconfiguration.rb +2 -2
- data/lib/moov/transfers.rb +434 -5
- data/lib/moov_ruby.rb +1 -1
- metadata +70 -22
- data/lib/moov/models/components/achtransactiondetails.rb +0 -92
- data/lib/moov/models/components/achtransactiondetails.rbi +0 -43
- data/lib/moov/models/components/achtransactionstatus.rb +0 -24
- data/lib/moov/models/components/cardacquiringdispute.rb +0 -40
- data/lib/moov/models/components/cardacquiringdispute.rbi +0 -17
- data/lib/moov/models/components/cardtransactiondetails.rb +0 -93
- data/lib/moov/models/components/cardtransactiondetails.rbi +0 -41
- data/lib/moov/models/components/cardtransactionstatus.rb +0 -24
- data/lib/moov/models/components/cardtransactionstatus.rbi +0 -11
- data/lib/moov/models/components/instantbanktransactiondetails.rb +0 -64
- data/lib/moov/models/components/instantbanktransactiondetails.rbi +0 -29
- data/lib/moov/models/components/instantbanktransactionstatus.rb +0 -21
- data/lib/moov/models/components/instantbanktransactionstatus.rbi +0 -11
- data/lib/moov/models/components/refundcarddetails.rb +0 -56
- data/lib/moov/models/components/refundcarddetails.rbi +0 -25
- data/lib/moov/models/components/transfercapture.rb +0 -36
- data/lib/moov/models/components/transfercapture.rbi +0 -15
data/lib/moov/transfers.rb
CHANGED
|
@@ -1000,15 +1000,16 @@ module Moov
|
|
|
1000
1000
|
end
|
|
1001
1001
|
|
|
1002
1002
|
|
|
1003
|
-
sig { params(account_id: ::String, transfer_id: ::String, timeout_ms: T.nilable(Integer), http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])).returns(Models::Operations::CreateCancellationResponse) }
|
|
1004
|
-
def create_cancellation(account_id:, transfer_id:, timeout_ms: nil, http_headers: nil)
|
|
1003
|
+
sig { params(create_cancellation: Models::Components::CreateCancellation, account_id: ::String, transfer_id: ::String, timeout_ms: T.nilable(Integer), http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])).returns(Models::Operations::CreateCancellationResponse) }
|
|
1004
|
+
def create_cancellation(create_cancellation:, account_id:, transfer_id:, timeout_ms: nil, http_headers: nil)
|
|
1005
1005
|
# create_cancellation - Initiate a cancellation for a card, ACH, or queued transfer.
|
|
1006
1006
|
#
|
|
1007
1007
|
# To access this endpoint using a [token](https://docs.moov.io/api/authentication/access-tokens/) you'll need
|
|
1008
1008
|
# to specify the `/accounts/{accountID}/transfers.write` scope.
|
|
1009
1009
|
request = Models::Operations::CreateCancellationRequest.new(
|
|
1010
1010
|
account_id: account_id,
|
|
1011
|
-
transfer_id: transfer_id
|
|
1011
|
+
transfer_id: transfer_id,
|
|
1012
|
+
create_cancellation: create_cancellation
|
|
1012
1013
|
)
|
|
1013
1014
|
url, params = @sdk_configuration.get_server_details
|
|
1014
1015
|
base_url = Utils.template_url(url, params)
|
|
@@ -1020,6 +1021,17 @@ module Moov
|
|
|
1020
1021
|
)
|
|
1021
1022
|
headers = {}
|
|
1022
1023
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1024
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :create_cancellation, :json)
|
|
1025
|
+
headers['content-type'] = req_content_type
|
|
1026
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
|
1027
|
+
|
|
1028
|
+
if form && !form.empty?
|
|
1029
|
+
body = Utils.encode_form(form)
|
|
1030
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
1031
|
+
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
1032
|
+
else
|
|
1033
|
+
body = data
|
|
1034
|
+
end
|
|
1023
1035
|
headers['Accept'] = 'application/json'
|
|
1024
1036
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1025
1037
|
|
|
@@ -1045,6 +1057,7 @@ module Moov
|
|
|
1045
1057
|
|
|
1046
1058
|
begin
|
|
1047
1059
|
http_response = T.must(connection).post(url) do |req|
|
|
1060
|
+
req.body = body
|
|
1048
1061
|
req.headers.merge!(headers)
|
|
1049
1062
|
req.options.timeout = timeout unless timeout.nil?
|
|
1050
1063
|
Utils.configure_request_security(req, security)
|
|
@@ -1385,6 +1398,420 @@ module Moov
|
|
|
1385
1398
|
end
|
|
1386
1399
|
|
|
1387
1400
|
|
|
1401
|
+
sig { params(create_capture: Models::Components::CreateCapture, x_idempotency_key: ::String, account_id: ::String, transfer_id: ::String, timeout_ms: T.nilable(Integer), http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])).returns(Models::Operations::CreateCaptureResponse) }
|
|
1402
|
+
def create_capture(create_capture:, x_idempotency_key:, account_id:, transfer_id:, timeout_ms: nil, http_headers: nil)
|
|
1403
|
+
# create_capture - Create a capture against an authorized transfer.
|
|
1404
|
+
#
|
|
1405
|
+
# To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
|
1406
|
+
# you'll need to specify the `/accounts/{accountID}/transfers.write` scope.
|
|
1407
|
+
request = Models::Operations::CreateCaptureRequest.new(
|
|
1408
|
+
x_idempotency_key: x_idempotency_key,
|
|
1409
|
+
account_id: account_id,
|
|
1410
|
+
transfer_id: transfer_id,
|
|
1411
|
+
create_capture: create_capture
|
|
1412
|
+
)
|
|
1413
|
+
url, params = @sdk_configuration.get_server_details
|
|
1414
|
+
base_url = Utils.template_url(url, params)
|
|
1415
|
+
url = Utils.generate_url(
|
|
1416
|
+
Models::Operations::CreateCaptureRequest,
|
|
1417
|
+
base_url,
|
|
1418
|
+
'/accounts/{accountID}/transfers/{transferID}/captures',
|
|
1419
|
+
request
|
|
1420
|
+
)
|
|
1421
|
+
headers = Utils.get_headers(request)
|
|
1422
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
1423
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :create_capture, :json)
|
|
1424
|
+
headers['content-type'] = req_content_type
|
|
1425
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
|
1426
|
+
|
|
1427
|
+
if form && !form.empty?
|
|
1428
|
+
body = Utils.encode_form(form)
|
|
1429
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
1430
|
+
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
1431
|
+
else
|
|
1432
|
+
body = data
|
|
1433
|
+
end
|
|
1434
|
+
headers['Accept'] = 'application/json'
|
|
1435
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1436
|
+
|
|
1437
|
+
security = @sdk_configuration.security_source&.call
|
|
1438
|
+
|
|
1439
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1440
|
+
timeout ||= @sdk_configuration.timeout
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
connection = @sdk_configuration.client
|
|
1444
|
+
|
|
1445
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1446
|
+
config: @sdk_configuration,
|
|
1447
|
+
base_url: base_url,
|
|
1448
|
+
oauth2_scopes: nil,
|
|
1449
|
+
operation_id: 'createCapture',
|
|
1450
|
+
security_source: @sdk_configuration.security_source
|
|
1451
|
+
)
|
|
1452
|
+
|
|
1453
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1454
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
begin
|
|
1458
|
+
http_response = T.must(connection).post(url) do |req|
|
|
1459
|
+
req.body = body
|
|
1460
|
+
req.headers.merge!(headers)
|
|
1461
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1462
|
+
Utils.configure_request_security(req, security)
|
|
1463
|
+
http_headers&.each do |key, value|
|
|
1464
|
+
req.headers[key.to_s] = value
|
|
1465
|
+
end
|
|
1466
|
+
|
|
1467
|
+
@sdk_configuration.hooks.before_request(
|
|
1468
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1469
|
+
hook_ctx: hook_ctx
|
|
1470
|
+
),
|
|
1471
|
+
request: req
|
|
1472
|
+
)
|
|
1473
|
+
end
|
|
1474
|
+
rescue StandardError => e
|
|
1475
|
+
error = e
|
|
1476
|
+
ensure
|
|
1477
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
1478
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
1479
|
+
error: error,
|
|
1480
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1481
|
+
hook_ctx: hook_ctx
|
|
1482
|
+
),
|
|
1483
|
+
response: http_response
|
|
1484
|
+
)
|
|
1485
|
+
else
|
|
1486
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1487
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1488
|
+
hook_ctx: hook_ctx
|
|
1489
|
+
),
|
|
1490
|
+
response: http_response
|
|
1491
|
+
)
|
|
1492
|
+
end
|
|
1493
|
+
|
|
1494
|
+
if http_response.nil?
|
|
1495
|
+
raise error if !error.nil?
|
|
1496
|
+
raise 'no response'
|
|
1497
|
+
end
|
|
1498
|
+
end
|
|
1499
|
+
|
|
1500
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
1501
|
+
if Utils.match_status_code(http_response.status, ['201'])
|
|
1502
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1503
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1504
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1505
|
+
hook_ctx: hook_ctx
|
|
1506
|
+
),
|
|
1507
|
+
response: http_response
|
|
1508
|
+
)
|
|
1509
|
+
response_data = http_response.env.response_body
|
|
1510
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::Capture)
|
|
1511
|
+
response = Models::Operations::CreateCaptureResponse.new(
|
|
1512
|
+
status_code: http_response.status,
|
|
1513
|
+
content_type: content_type,
|
|
1514
|
+
raw_response: http_response,
|
|
1515
|
+
headers: http_response.headers,
|
|
1516
|
+
capture: T.unsafe(obj)
|
|
1517
|
+
)
|
|
1518
|
+
|
|
1519
|
+
return response
|
|
1520
|
+
else
|
|
1521
|
+
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'
|
|
1522
|
+
end
|
|
1523
|
+
elsif Utils.match_status_code(http_response.status, ['400', '409'])
|
|
1524
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1525
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1526
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1527
|
+
hook_ctx: hook_ctx
|
|
1528
|
+
),
|
|
1529
|
+
response: http_response
|
|
1530
|
+
)
|
|
1531
|
+
response_data = http_response.env.response_body
|
|
1532
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::GenericError)
|
|
1533
|
+
obj.raw_response = http_response
|
|
1534
|
+
raise obj
|
|
1535
|
+
else
|
|
1536
|
+
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'
|
|
1537
|
+
end
|
|
1538
|
+
elsif Utils.match_status_code(http_response.status, ['422'])
|
|
1539
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1540
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1541
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1542
|
+
hook_ctx: hook_ctx
|
|
1543
|
+
),
|
|
1544
|
+
response: http_response
|
|
1545
|
+
)
|
|
1546
|
+
response_data = http_response.env.response_body
|
|
1547
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::CaptureValidationError)
|
|
1548
|
+
obj.raw_response = http_response
|
|
1549
|
+
raise obj
|
|
1550
|
+
else
|
|
1551
|
+
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'
|
|
1552
|
+
end
|
|
1553
|
+
elsif Utils.match_status_code(http_response.status, ['401', '403', '404', '429'])
|
|
1554
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1555
|
+
elsif Utils.match_status_code(http_response.status, ['500', '504'])
|
|
1556
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1557
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1558
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1559
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1560
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1561
|
+
else
|
|
1562
|
+
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'
|
|
1563
|
+
|
|
1564
|
+
end
|
|
1565
|
+
end
|
|
1566
|
+
|
|
1567
|
+
|
|
1568
|
+
sig { params(account_id: ::String, transfer_id: ::String, timeout_ms: T.nilable(Integer), http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])).returns(Models::Operations::ListCapturesResponse) }
|
|
1569
|
+
def list_captures(account_id:, transfer_id:, timeout_ms: nil, http_headers: nil)
|
|
1570
|
+
# list_captures - Get a list of captures for a transfer.
|
|
1571
|
+
#
|
|
1572
|
+
# To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
|
1573
|
+
# you'll need to specify the `/accounts/{accountID}/transfers.read` scope.
|
|
1574
|
+
request = Models::Operations::ListCapturesRequest.new(
|
|
1575
|
+
account_id: account_id,
|
|
1576
|
+
transfer_id: transfer_id
|
|
1577
|
+
)
|
|
1578
|
+
url, params = @sdk_configuration.get_server_details
|
|
1579
|
+
base_url = Utils.template_url(url, params)
|
|
1580
|
+
url = Utils.generate_url(
|
|
1581
|
+
Models::Operations::ListCapturesRequest,
|
|
1582
|
+
base_url,
|
|
1583
|
+
'/accounts/{accountID}/transfers/{transferID}/captures',
|
|
1584
|
+
request
|
|
1585
|
+
)
|
|
1586
|
+
headers = {}
|
|
1587
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
1588
|
+
headers['Accept'] = 'application/json'
|
|
1589
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1590
|
+
|
|
1591
|
+
security = @sdk_configuration.security_source&.call
|
|
1592
|
+
|
|
1593
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1594
|
+
timeout ||= @sdk_configuration.timeout
|
|
1595
|
+
|
|
1596
|
+
|
|
1597
|
+
connection = @sdk_configuration.client
|
|
1598
|
+
|
|
1599
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1600
|
+
config: @sdk_configuration,
|
|
1601
|
+
base_url: base_url,
|
|
1602
|
+
oauth2_scopes: nil,
|
|
1603
|
+
operation_id: 'listCaptures',
|
|
1604
|
+
security_source: @sdk_configuration.security_source
|
|
1605
|
+
)
|
|
1606
|
+
|
|
1607
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1608
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
1609
|
+
|
|
1610
|
+
|
|
1611
|
+
begin
|
|
1612
|
+
http_response = T.must(connection).get(url) do |req|
|
|
1613
|
+
req.headers.merge!(headers)
|
|
1614
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1615
|
+
Utils.configure_request_security(req, security)
|
|
1616
|
+
http_headers&.each do |key, value|
|
|
1617
|
+
req.headers[key.to_s] = value
|
|
1618
|
+
end
|
|
1619
|
+
|
|
1620
|
+
@sdk_configuration.hooks.before_request(
|
|
1621
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1622
|
+
hook_ctx: hook_ctx
|
|
1623
|
+
),
|
|
1624
|
+
request: req
|
|
1625
|
+
)
|
|
1626
|
+
end
|
|
1627
|
+
rescue StandardError => e
|
|
1628
|
+
error = e
|
|
1629
|
+
ensure
|
|
1630
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
1631
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
1632
|
+
error: error,
|
|
1633
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1634
|
+
hook_ctx: hook_ctx
|
|
1635
|
+
),
|
|
1636
|
+
response: http_response
|
|
1637
|
+
)
|
|
1638
|
+
else
|
|
1639
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1640
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1641
|
+
hook_ctx: hook_ctx
|
|
1642
|
+
),
|
|
1643
|
+
response: http_response
|
|
1644
|
+
)
|
|
1645
|
+
end
|
|
1646
|
+
|
|
1647
|
+
if http_response.nil?
|
|
1648
|
+
raise error if !error.nil?
|
|
1649
|
+
raise 'no response'
|
|
1650
|
+
end
|
|
1651
|
+
end
|
|
1652
|
+
|
|
1653
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
1654
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
1655
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1656
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1657
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1658
|
+
hook_ctx: hook_ctx
|
|
1659
|
+
),
|
|
1660
|
+
response: http_response
|
|
1661
|
+
)
|
|
1662
|
+
response_data = http_response.env.response_body
|
|
1663
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Crystalline::Array.new(Models::Components::Capture))
|
|
1664
|
+
response = Models::Operations::ListCapturesResponse.new(
|
|
1665
|
+
status_code: http_response.status,
|
|
1666
|
+
content_type: content_type,
|
|
1667
|
+
raw_response: http_response,
|
|
1668
|
+
headers: http_response.headers,
|
|
1669
|
+
captures: T.unsafe(obj)
|
|
1670
|
+
)
|
|
1671
|
+
|
|
1672
|
+
return response
|
|
1673
|
+
else
|
|
1674
|
+
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'
|
|
1675
|
+
end
|
|
1676
|
+
elsif Utils.match_status_code(http_response.status, ['401', '403', '429'])
|
|
1677
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1678
|
+
elsif Utils.match_status_code(http_response.status, ['500', '504'])
|
|
1679
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1680
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1681
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1682
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1683
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1684
|
+
else
|
|
1685
|
+
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'
|
|
1686
|
+
|
|
1687
|
+
end
|
|
1688
|
+
end
|
|
1689
|
+
|
|
1690
|
+
|
|
1691
|
+
sig { params(account_id: ::String, transfer_id: ::String, capture_id: ::String, timeout_ms: T.nilable(Integer), http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])).returns(Models::Operations::GetCaptureResponse) }
|
|
1692
|
+
def get_capture(account_id:, transfer_id:, capture_id:, timeout_ms: nil, http_headers: nil)
|
|
1693
|
+
# get_capture - Get details of a capture for a transfer.
|
|
1694
|
+
#
|
|
1695
|
+
# To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
|
1696
|
+
# you'll need to specify the `/accounts/{accountID}/transfers.read` scope.
|
|
1697
|
+
request = Models::Operations::GetCaptureRequest.new(
|
|
1698
|
+
account_id: account_id,
|
|
1699
|
+
transfer_id: transfer_id,
|
|
1700
|
+
capture_id: capture_id
|
|
1701
|
+
)
|
|
1702
|
+
url, params = @sdk_configuration.get_server_details
|
|
1703
|
+
base_url = Utils.template_url(url, params)
|
|
1704
|
+
url = Utils.generate_url(
|
|
1705
|
+
Models::Operations::GetCaptureRequest,
|
|
1706
|
+
base_url,
|
|
1707
|
+
'/accounts/{accountID}/transfers/{transferID}/captures/{captureID}',
|
|
1708
|
+
request
|
|
1709
|
+
)
|
|
1710
|
+
headers = {}
|
|
1711
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
1712
|
+
headers['Accept'] = 'application/json'
|
|
1713
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1714
|
+
|
|
1715
|
+
security = @sdk_configuration.security_source&.call
|
|
1716
|
+
|
|
1717
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1718
|
+
timeout ||= @sdk_configuration.timeout
|
|
1719
|
+
|
|
1720
|
+
|
|
1721
|
+
connection = @sdk_configuration.client
|
|
1722
|
+
|
|
1723
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1724
|
+
config: @sdk_configuration,
|
|
1725
|
+
base_url: base_url,
|
|
1726
|
+
oauth2_scopes: nil,
|
|
1727
|
+
operation_id: 'getCapture',
|
|
1728
|
+
security_source: @sdk_configuration.security_source
|
|
1729
|
+
)
|
|
1730
|
+
|
|
1731
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1732
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
1733
|
+
|
|
1734
|
+
|
|
1735
|
+
begin
|
|
1736
|
+
http_response = T.must(connection).get(url) do |req|
|
|
1737
|
+
req.headers.merge!(headers)
|
|
1738
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1739
|
+
Utils.configure_request_security(req, security)
|
|
1740
|
+
http_headers&.each do |key, value|
|
|
1741
|
+
req.headers[key.to_s] = value
|
|
1742
|
+
end
|
|
1743
|
+
|
|
1744
|
+
@sdk_configuration.hooks.before_request(
|
|
1745
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1746
|
+
hook_ctx: hook_ctx
|
|
1747
|
+
),
|
|
1748
|
+
request: req
|
|
1749
|
+
)
|
|
1750
|
+
end
|
|
1751
|
+
rescue StandardError => e
|
|
1752
|
+
error = e
|
|
1753
|
+
ensure
|
|
1754
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
1755
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
1756
|
+
error: error,
|
|
1757
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1758
|
+
hook_ctx: hook_ctx
|
|
1759
|
+
),
|
|
1760
|
+
response: http_response
|
|
1761
|
+
)
|
|
1762
|
+
else
|
|
1763
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1764
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1765
|
+
hook_ctx: hook_ctx
|
|
1766
|
+
),
|
|
1767
|
+
response: http_response
|
|
1768
|
+
)
|
|
1769
|
+
end
|
|
1770
|
+
|
|
1771
|
+
if http_response.nil?
|
|
1772
|
+
raise error if !error.nil?
|
|
1773
|
+
raise 'no response'
|
|
1774
|
+
end
|
|
1775
|
+
end
|
|
1776
|
+
|
|
1777
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
1778
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
1779
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1780
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1781
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1782
|
+
hook_ctx: hook_ctx
|
|
1783
|
+
),
|
|
1784
|
+
response: http_response
|
|
1785
|
+
)
|
|
1786
|
+
response_data = http_response.env.response_body
|
|
1787
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::Capture)
|
|
1788
|
+
response = Models::Operations::GetCaptureResponse.new(
|
|
1789
|
+
status_code: http_response.status,
|
|
1790
|
+
content_type: content_type,
|
|
1791
|
+
raw_response: http_response,
|
|
1792
|
+
headers: http_response.headers,
|
|
1793
|
+
capture: T.unsafe(obj)
|
|
1794
|
+
)
|
|
1795
|
+
|
|
1796
|
+
return response
|
|
1797
|
+
else
|
|
1798
|
+
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'
|
|
1799
|
+
end
|
|
1800
|
+
elsif Utils.match_status_code(http_response.status, ['401', '403', '404', '429'])
|
|
1801
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1802
|
+
elsif Utils.match_status_code(http_response.status, ['500', '504'])
|
|
1803
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1804
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1805
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1806
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1807
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1808
|
+
else
|
|
1809
|
+
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'
|
|
1810
|
+
|
|
1811
|
+
end
|
|
1812
|
+
end
|
|
1813
|
+
|
|
1814
|
+
|
|
1388
1815
|
sig { params(request: Models::Operations::InitiateRefundRequest, timeout_ms: T.nilable(Integer), http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])).returns(Models::Operations::InitiateRefundResponse) }
|
|
1389
1816
|
def initiate_refund(request:, timeout_ms: nil, http_headers: nil)
|
|
1390
1817
|
# initiate_refund - Initiate a refund for a card transfer.
|
|
@@ -1406,6 +1833,7 @@ module Moov
|
|
|
1406
1833
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1407
1834
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :create_refund, :json)
|
|
1408
1835
|
headers['content-type'] = req_content_type
|
|
1836
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
|
1409
1837
|
|
|
1410
1838
|
if form && !form.empty?
|
|
1411
1839
|
body = Utils.encode_form(form)
|
|
@@ -1832,8 +2260,8 @@ module Moov
|
|
|
1832
2260
|
end
|
|
1833
2261
|
|
|
1834
2262
|
|
|
1835
|
-
sig { params(
|
|
1836
|
-
def create_reversal(x_idempotency_key:, account_id:, transfer_id:,
|
|
2263
|
+
sig { params(create_reversal: Models::Components::CreateReversal, x_idempotency_key: ::String, account_id: ::String, transfer_id: ::String, timeout_ms: T.nilable(Integer), http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])).returns(Models::Operations::CreateReversalResponse) }
|
|
2264
|
+
def create_reversal(create_reversal:, x_idempotency_key:, account_id:, transfer_id:, timeout_ms: nil, http_headers: nil)
|
|
1837
2265
|
# create_reversal - Reverses a card transfer by initiating a cancellation or refund depending on the transaction status.
|
|
1838
2266
|
# Read our [reversals guide](https://docs.moov.io/guides/money-movement/accept-payments/card-acceptance/reversals/)
|
|
1839
2267
|
# to learn more.
|
|
@@ -1858,6 +2286,7 @@ module Moov
|
|
|
1858
2286
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1859
2287
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :create_reversal, :json)
|
|
1860
2288
|
headers['content-type'] = req_content_type
|
|
2289
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
|
1861
2290
|
|
|
1862
2291
|
if form && !form.empty?
|
|
1863
2292
|
body = Utils.encode_form(form)
|
data/lib/moov_ruby.rb
CHANGED
|
@@ -40,8 +40,8 @@ module Moov
|
|
|
40
40
|
autoload :Webhooks, 'moov/webhooks'
|
|
41
41
|
autoload :Industries, 'moov/industries'
|
|
42
42
|
autoload :Institutions, 'moov/institutions'
|
|
43
|
-
autoload :IssuingTransactions, 'moov/issuing_transactions'
|
|
44
43
|
autoload :CardIssuing, 'moov/card_issuing'
|
|
44
|
+
autoload :IssuingTransactions, 'moov/issuing_transactions'
|
|
45
45
|
autoload :Authentication, 'moov/authentication'
|
|
46
46
|
autoload :Onboarding, 'moov/onboarding'
|
|
47
47
|
autoload :Ping, 'moov/ping'
|