fintoc 1.11.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +25 -23
- data/README.md +43 -0
- data/lib/fintoc/errors.rb +15 -0
- data/lib/fintoc/v2/client/client.rb +5 -0
- data/lib/fintoc/v2/managers/account_numbers_manager.rb +6 -0
- data/lib/fintoc/v2/managers/accounts_manager.rb +6 -0
- data/lib/fintoc/v2/managers/checkout_sessions_manager.rb +6 -0
- data/lib/fintoc/v2/managers/crossborder_beneficiaries_manager.rb +46 -0
- data/lib/fintoc/v2/managers/crossborder_manager.rb +27 -0
- data/lib/fintoc/v2/managers/crossborder_quotes_manager.rb +30 -0
- data/lib/fintoc/v2/managers/crossborder_transfers_manager.rb +38 -0
- data/lib/fintoc/v2/resources/account.rb +4 -0
- data/lib/fintoc/v2/resources/account_certificate.rb +26 -0
- data/lib/fintoc/v2/resources/account_number.rb +4 -0
- data/lib/fintoc/v2/resources/crossborder_beneficiary.rb +48 -0
- data/lib/fintoc/v2/resources/crossborder_quote.rb +46 -0
- data/lib/fintoc/v2/resources/crossborder_transfer.rb +63 -0
- data/lib/fintoc/version.rb +1 -1
- metadata +9 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: efae9a9d7ad4d6e8d0068265230e79590107d1632777b32ff8439ab61b94a3e4
|
|
4
|
+
data.tar.gz: f71ecb0b65ba407fdbdf5abf1aaaa46b00ed4feea0d7c1cd8fab3152d717f82d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '039fe386bc7ae041e6e64d2deb4e21c8ed9c6f8ec69d167db9f793b1a77f1438705316c5b8d95510682c386ca57fdee642e64310875b72c48e8c6e60e2291fee'
|
|
7
|
+
data.tar.gz: 1c0d7b909a3e72b18039a04328aec460107d6ee4036018068d64e89a58cf45a8a4bdfa4765ee91baeb09b41872e5a3fdd6b7ce704bb316479fc3ec029ace29b7
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
fintoc (1.
|
|
4
|
+
fintoc (1.13.0)
|
|
5
5
|
http
|
|
6
6
|
money-rails
|
|
7
7
|
tabulate
|
|
@@ -9,9 +9,9 @@ PATH
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
actionpack (8.0.2
|
|
13
|
-
actionview (= 8.0.2
|
|
14
|
-
activesupport (= 8.0.2
|
|
12
|
+
actionpack (8.0.5.2)
|
|
13
|
+
actionview (= 8.0.5.2)
|
|
14
|
+
activesupport (= 8.0.5.2)
|
|
15
15
|
nokogiri (>= 1.8.5)
|
|
16
16
|
rack (>= 2.2.4)
|
|
17
17
|
rack-session (>= 1.0.1)
|
|
@@ -19,13 +19,13 @@ GEM
|
|
|
19
19
|
rails-dom-testing (~> 2.2)
|
|
20
20
|
rails-html-sanitizer (~> 1.6)
|
|
21
21
|
useragent (~> 0.16)
|
|
22
|
-
actionview (8.0.2
|
|
23
|
-
activesupport (= 8.0.2
|
|
22
|
+
actionview (8.0.5.2)
|
|
23
|
+
activesupport (= 8.0.5.2)
|
|
24
24
|
builder (~> 3.1)
|
|
25
25
|
erubi (~> 1.11)
|
|
26
26
|
rails-dom-testing (~> 2.2)
|
|
27
|
-
rails-html-sanitizer (~> 1.6)
|
|
28
|
-
activesupport (8.0.2
|
|
27
|
+
rails-html-sanitizer (~> 1.6, >= 1.7.2)
|
|
28
|
+
activesupport (8.0.5.2)
|
|
29
29
|
base64
|
|
30
30
|
benchmark (>= 0.3)
|
|
31
31
|
bigdecimal
|
|
@@ -76,9 +76,9 @@ GEM
|
|
|
76
76
|
lint_roller (1.1.0)
|
|
77
77
|
llhttp (0.6.2)
|
|
78
78
|
logger (1.7.0)
|
|
79
|
-
loofah (2.
|
|
79
|
+
loofah (2.25.3)
|
|
80
80
|
crass (~> 1.0.2)
|
|
81
|
-
nokogiri (>= 1.
|
|
81
|
+
nokogiri (>= 1.19.5)
|
|
82
82
|
minitest (5.25.5)
|
|
83
83
|
monetize (1.13.0)
|
|
84
84
|
money (~> 6.12)
|
|
@@ -89,21 +89,21 @@ GEM
|
|
|
89
89
|
monetize (~> 1.9)
|
|
90
90
|
money (~> 6.13)
|
|
91
91
|
railties (>= 3.0)
|
|
92
|
-
nokogiri (1.
|
|
92
|
+
nokogiri (1.19.7-aarch64-linux-gnu)
|
|
93
93
|
racc (~> 1.4)
|
|
94
|
-
nokogiri (1.
|
|
94
|
+
nokogiri (1.19.7-aarch64-linux-musl)
|
|
95
95
|
racc (~> 1.4)
|
|
96
|
-
nokogiri (1.
|
|
96
|
+
nokogiri (1.19.7-arm-linux-gnu)
|
|
97
97
|
racc (~> 1.4)
|
|
98
|
-
nokogiri (1.
|
|
98
|
+
nokogiri (1.19.7-arm-linux-musl)
|
|
99
99
|
racc (~> 1.4)
|
|
100
|
-
nokogiri (1.
|
|
100
|
+
nokogiri (1.19.7-arm64-darwin)
|
|
101
101
|
racc (~> 1.4)
|
|
102
|
-
nokogiri (1.
|
|
102
|
+
nokogiri (1.19.7-x86_64-darwin)
|
|
103
103
|
racc (~> 1.4)
|
|
104
|
-
nokogiri (1.
|
|
104
|
+
nokogiri (1.19.7-x86_64-linux-gnu)
|
|
105
105
|
racc (~> 1.4)
|
|
106
|
-
nokogiri (1.
|
|
106
|
+
nokogiri (1.19.7-x86_64-linux-musl)
|
|
107
107
|
racc (~> 1.4)
|
|
108
108
|
parallel (1.27.0)
|
|
109
109
|
parser (3.3.9.0)
|
|
@@ -130,16 +130,17 @@ GEM
|
|
|
130
130
|
activesupport (>= 5.0.0)
|
|
131
131
|
minitest
|
|
132
132
|
nokogiri (>= 1.6)
|
|
133
|
-
rails-html-sanitizer (1.
|
|
134
|
-
loofah (~> 2.
|
|
133
|
+
rails-html-sanitizer (1.7.2)
|
|
134
|
+
loofah (~> 2.25, >= 2.25.3)
|
|
135
135
|
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
136
|
-
railties (8.0.2
|
|
137
|
-
actionpack (= 8.0.2
|
|
138
|
-
activesupport (= 8.0.2
|
|
136
|
+
railties (8.0.5.2)
|
|
137
|
+
actionpack (= 8.0.5.2)
|
|
138
|
+
activesupport (= 8.0.5.2)
|
|
139
139
|
irb (~> 1.13)
|
|
140
140
|
rackup (>= 1.0.0)
|
|
141
141
|
rake (>= 12.2)
|
|
142
142
|
thor (~> 1.0, >= 1.2.2)
|
|
143
|
+
tsort (>= 0.2)
|
|
143
144
|
zeitwerk (~> 2.6)
|
|
144
145
|
rainbow (3.1.1)
|
|
145
146
|
rake (13.4.2)
|
|
@@ -207,6 +208,7 @@ GEM
|
|
|
207
208
|
stringio (3.1.7)
|
|
208
209
|
tabulate (0.1.2)
|
|
209
210
|
thor (1.4.0)
|
|
211
|
+
tsort (0.2.0)
|
|
210
212
|
tzinfo (2.0.6)
|
|
211
213
|
concurrent-ruby (~> 1.0)
|
|
212
214
|
unicode-display_width (3.1.5)
|
data/README.md
CHANGED
|
@@ -34,6 +34,7 @@ Do yourself a favor: go grab some ice cubes by installing this refreshing librar
|
|
|
34
34
|
- [Transfers](#transfers)
|
|
35
35
|
- [Transfer Batches](#transfer-batches)
|
|
36
36
|
- [Recipients](#recipients)
|
|
37
|
+
- [Crossborder](#crossborder)
|
|
37
38
|
- [Simulate](#simulate)
|
|
38
39
|
- [Account Verifications](#account-verifications)
|
|
39
40
|
- [Entity onboardings API Examples](#entity-onboardings-api-examples)
|
|
@@ -273,6 +274,9 @@ eligibility = client.v2.payment_intents.check_eligibility(
|
|
|
273
274
|
)
|
|
274
275
|
checkout_session = client.v2.checkout_sessions.create(currency: 'CLP', flow: 'payment', amount: 5000)
|
|
275
276
|
client.v2.checkout_sessions.expire('checkout_session_id')
|
|
277
|
+
# Charge the card submitted to a `ui_mode: 'fields'` session. Call it again while
|
|
278
|
+
# the session is still `in_progress` (202 Accepted) to get the result.
|
|
279
|
+
checkout_session = client.v2.checkout_sessions.confirm('checkout_session_id')
|
|
276
280
|
setup_intent = client.v2.setup_intents.get('setup_intent_id')
|
|
277
281
|
|
|
278
282
|
# Products, subscriptions and invoices
|
|
@@ -435,6 +439,10 @@ accounts = client.v2.accounts.list
|
|
|
435
439
|
|
|
436
440
|
# Update an account
|
|
437
441
|
updated_account = client.v2.accounts.update('account_id', description: 'Updated Description')
|
|
442
|
+
|
|
443
|
+
# Get the account certificate (signed download URL)
|
|
444
|
+
certificate = client.v2.accounts.certificate('account_id')
|
|
445
|
+
certificate.download_url
|
|
438
446
|
```
|
|
439
447
|
|
|
440
448
|
#### Account Numbers
|
|
@@ -461,6 +469,9 @@ updated_account_number = client.v2.account_numbers.update(
|
|
|
461
469
|
'account_number_id',
|
|
462
470
|
description: 'Updated account number'
|
|
463
471
|
)
|
|
472
|
+
|
|
473
|
+
# Get the certificate for an account number
|
|
474
|
+
certificate = client.v2.account_numbers.certificate('account_number_id')
|
|
464
475
|
```
|
|
465
476
|
|
|
466
477
|
#### Transfers
|
|
@@ -564,6 +575,38 @@ recipient = client.v2.recipients.update('recipient_id', alias: 'Lord Snow')
|
|
|
564
575
|
client.v2.recipients.delete('recipient_id')
|
|
565
576
|
```
|
|
566
577
|
|
|
578
|
+
#### Crossborder
|
|
579
|
+
|
|
580
|
+
Crossborder beneficiaries, quotes and transfers are under the `v2.crossborder` namespace.
|
|
581
|
+
Create a quote to lock the exchange rate, and accept it with a transfer to a beneficiary:
|
|
582
|
+
|
|
583
|
+
```ruby
|
|
584
|
+
require 'fintoc'
|
|
585
|
+
|
|
586
|
+
client = Fintoc::Client.new('api_key')
|
|
587
|
+
|
|
588
|
+
beneficiary = client.v2.crossborder.beneficiaries.create(
|
|
589
|
+
holder_type: 'business',
|
|
590
|
+
business_name: 'Acme LLC',
|
|
591
|
+
account_identifier: '123456789',
|
|
592
|
+
routing_number: '021000021',
|
|
593
|
+
bank_name: 'JPMorgan Chase Bank, N.A.',
|
|
594
|
+
address: { street_line1: '100 Main St', city: 'New York', state: 'NY', postal_code: '10001' }
|
|
595
|
+
)
|
|
596
|
+
beneficiaries = client.v2.crossborder.beneficiaries.list(limit: 10)
|
|
597
|
+
client.v2.crossborder.beneficiaries.delete(beneficiary.id) # archives the beneficiary
|
|
598
|
+
|
|
599
|
+
quote = client.v2.crossborder.quotes.create(direction: 'mx_to_usd', source_amount: 200001)
|
|
600
|
+
quote = client.v2.crossborder.quotes.get(quote.id)
|
|
601
|
+
|
|
602
|
+
transfer = client.v2.crossborder.transfers.create(
|
|
603
|
+
quote_id: quote.id, beneficiary_id: beneficiary.id, reference: 'Factura 123'
|
|
604
|
+
)
|
|
605
|
+
transfer.funding_instructions[:clabe]
|
|
606
|
+
transfers = client.v2.crossborder.transfers.list(status: %w[pending_funds failed], direction: 'mx_to_usd')
|
|
607
|
+
transfer = client.v2.crossborder.transfers.get('crossborder_transfer_id')
|
|
608
|
+
```
|
|
609
|
+
|
|
567
610
|
#### Simulate
|
|
568
611
|
|
|
569
612
|
```ruby
|
data/lib/fintoc/errors.rb
CHANGED
|
@@ -88,6 +88,8 @@ module Fintoc
|
|
|
88
88
|
class InvalidRutError < FintocError; end
|
|
89
89
|
class InvalidShareholderStructureError < FintocError; end
|
|
90
90
|
class InvalidWebhookEventTypeError < FintocError; end
|
|
91
|
+
class QuoteExpiredError < FintocError; end
|
|
92
|
+
class SettlementNotConfiguredError < FintocError; end
|
|
91
93
|
class MinimumAmountError < FintocError; end
|
|
92
94
|
class MutuallyExclusiveParamsError < FintocError; end
|
|
93
95
|
class NotSupportedRefundableResourceTypeError < FintocError; end
|
|
@@ -115,6 +117,7 @@ module Fintoc
|
|
|
115
117
|
|
|
116
118
|
# 402 Payment Required Errors
|
|
117
119
|
class PaymentRequiredError < FintocError; end
|
|
120
|
+
class CardDeclinedError < FintocError; end
|
|
118
121
|
|
|
119
122
|
# 403 Forbidden Errors
|
|
120
123
|
class InvalidAccountError < FintocError; end
|
|
@@ -176,9 +179,17 @@ module Fintoc
|
|
|
176
179
|
class PaymentNonCancelableError < FintocError; end
|
|
177
180
|
class PaymentNonExpirableError < FintocError; end
|
|
178
181
|
class SubscriptionNotEditableError < FintocError; end
|
|
182
|
+
class BeneficiaryAlreadyExistsError < FintocError; end
|
|
183
|
+
class CardConfirmationExpiredError < FintocError; end
|
|
184
|
+
class ChargeInProgressError < FintocError; end
|
|
185
|
+
class CheckoutSessionNotInProgressError < FintocError; end
|
|
186
|
+
class NoCardSubmittedError < FintocError; end
|
|
187
|
+
class QuoteAlreadyAcceptedError < FintocError; end
|
|
179
188
|
|
|
180
189
|
# 422 Unprocessable Entity Errors
|
|
181
190
|
class AccountBlockedForDirectDebitError < FintocError; end
|
|
191
|
+
class AccountCertificateUnavailableError < FintocError; end
|
|
192
|
+
class ProviderRejectedError < FintocError; end
|
|
182
193
|
class FounderEmailChangeLimitReachedError < FintocError; end
|
|
183
194
|
class InvalidHolderNameError < FintocError; end
|
|
184
195
|
class InvalidOtpCodeError < FintocError; end
|
|
@@ -245,6 +256,10 @@ module Fintoc
|
|
|
245
256
|
# 501 Not Implemented Errors
|
|
246
257
|
class OperationNotImplementedError < FintocError; end
|
|
247
258
|
|
|
259
|
+
# 503 Service Unavailable Errors
|
|
260
|
+
class ProviderOutcomeUnknownError < FintocError; end
|
|
261
|
+
class ProviderUnavailableError < FintocError; end
|
|
262
|
+
|
|
248
263
|
# Webhook Errors
|
|
249
264
|
class WebhookSignatureError < FintocError; end
|
|
250
265
|
|
|
@@ -16,6 +16,7 @@ require 'fintoc/v2/managers/setup_intents_manager'
|
|
|
16
16
|
require 'fintoc/v2/managers/events_manager'
|
|
17
17
|
require 'fintoc/v2/managers/invoices_manager'
|
|
18
18
|
require 'fintoc/v2/managers/subscriptions_manager'
|
|
19
|
+
require 'fintoc/v2/managers/crossborder_manager'
|
|
19
20
|
|
|
20
21
|
module Fintoc
|
|
21
22
|
module V2
|
|
@@ -87,6 +88,10 @@ module Fintoc
|
|
|
87
88
|
def subscriptions
|
|
88
89
|
@subscriptions ||= Managers::SubscriptionsManager.new(self)
|
|
89
90
|
end
|
|
91
|
+
|
|
92
|
+
def crossborder
|
|
93
|
+
@crossborder ||= Managers::CrossborderManager.new(self)
|
|
94
|
+
end
|
|
90
95
|
end
|
|
91
96
|
end
|
|
92
97
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'fintoc/v2/resources/account_number'
|
|
2
|
+
require 'fintoc/v2/resources/account_certificate'
|
|
2
3
|
|
|
3
4
|
module Fintoc
|
|
4
5
|
module V2
|
|
@@ -33,6 +34,11 @@ module Fintoc
|
|
|
33
34
|
_delete_account_number(account_number_id)
|
|
34
35
|
end
|
|
35
36
|
|
|
37
|
+
def certificate(account_number_id)
|
|
38
|
+
data = @client.get(version: :v2).call("account_numbers/#{account_number_id}/certificate")
|
|
39
|
+
Fintoc::V2::AccountCertificate.new(**data)
|
|
40
|
+
end
|
|
41
|
+
|
|
36
42
|
private
|
|
37
43
|
|
|
38
44
|
def _create_account_number(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'fintoc/v2/resources/account'
|
|
2
|
+
require 'fintoc/v2/resources/account_certificate'
|
|
2
3
|
|
|
3
4
|
module Fintoc
|
|
4
5
|
module V2
|
|
@@ -27,6 +28,11 @@ module Fintoc
|
|
|
27
28
|
build_account(data)
|
|
28
29
|
end
|
|
29
30
|
|
|
31
|
+
def certificate(account_id)
|
|
32
|
+
data = @client.get(version: :v2).call("accounts/#{account_id}/certificate")
|
|
33
|
+
Fintoc::V2::AccountCertificate.new(**data)
|
|
34
|
+
end
|
|
35
|
+
|
|
30
36
|
private
|
|
31
37
|
|
|
32
38
|
def _create_account(entity_id:, description:, idempotency_key: nil, **params)
|
|
@@ -31,6 +31,12 @@ module Fintoc
|
|
|
31
31
|
build_checkout_session(data)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
def confirm(checkout_session_id, idempotency_key: nil)
|
|
35
|
+
data = @client.post(version: :v2, idempotency_key:)
|
|
36
|
+
.call("checkout_sessions/#{checkout_session_id}/confirm")
|
|
37
|
+
build_checkout_session(data)
|
|
38
|
+
end
|
|
39
|
+
|
|
34
40
|
private
|
|
35
41
|
|
|
36
42
|
def build_checkout_session(data)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require 'fintoc/v2/resources/crossborder_beneficiary'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V2
|
|
5
|
+
module Managers
|
|
6
|
+
class CrossborderBeneficiariesManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(
|
|
12
|
+
holder_type:, account_identifier:, routing_number:, bank_name:, address:,
|
|
13
|
+
idempotency_key: nil, **params
|
|
14
|
+
)
|
|
15
|
+
data = @client.post(version: :v2, idempotency_key:).call(
|
|
16
|
+
'crossborder/beneficiaries',
|
|
17
|
+
holder_type:, account_identifier:, routing_number:, bank_name:, address:, **params
|
|
18
|
+
)
|
|
19
|
+
build_beneficiary(data)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def list(**params)
|
|
23
|
+
@client.get(version: :v2).call('crossborder/beneficiaries', **params).map do |data|
|
|
24
|
+
build_beneficiary(data)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def get(beneficiary_id)
|
|
29
|
+
data = @client.get(version: :v2).call("crossborder/beneficiaries/#{beneficiary_id}")
|
|
30
|
+
build_beneficiary(data)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def delete(beneficiary_id)
|
|
34
|
+
data = @client.delete(version: :v2).call("crossborder/beneficiaries/#{beneficiary_id}")
|
|
35
|
+
build_beneficiary(data)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def build_beneficiary(data)
|
|
41
|
+
Fintoc::V2::CrossborderBeneficiary.new(**data)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'fintoc/v2/managers/crossborder_beneficiaries_manager'
|
|
2
|
+
require 'fintoc/v2/managers/crossborder_quotes_manager'
|
|
3
|
+
require 'fintoc/v2/managers/crossborder_transfers_manager'
|
|
4
|
+
|
|
5
|
+
module Fintoc
|
|
6
|
+
module V2
|
|
7
|
+
module Managers
|
|
8
|
+
class CrossborderManager
|
|
9
|
+
def initialize(client)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def beneficiaries
|
|
14
|
+
@beneficiaries ||= CrossborderBeneficiariesManager.new(@client)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def quotes
|
|
18
|
+
@quotes ||= CrossborderQuotesManager.new(@client)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def transfers
|
|
22
|
+
@transfers ||= CrossborderTransfersManager.new(@client)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'fintoc/v2/resources/crossborder_quote'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V2
|
|
5
|
+
module Managers
|
|
6
|
+
class CrossborderQuotesManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(direction:, source_amount:, idempotency_key: nil)
|
|
12
|
+
data = @client.post(version: :v2, idempotency_key:)
|
|
13
|
+
.call('crossborder/quotes', direction:, source_amount:)
|
|
14
|
+
build_quote(data)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get(quote_id)
|
|
18
|
+
data = @client.get(version: :v2).call("crossborder/quotes/#{quote_id}")
|
|
19
|
+
build_quote(data)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def build_quote(data)
|
|
25
|
+
Fintoc::V2::CrossborderQuote.new(**data)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require 'fintoc/v2/resources/crossborder_transfer'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V2
|
|
5
|
+
module Managers
|
|
6
|
+
class CrossborderTransfersManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(quote_id:, idempotency_key: nil, **params)
|
|
12
|
+
data = @client.post(version: :v2, idempotency_key:)
|
|
13
|
+
.call('crossborder/transfers', quote_id:, **params)
|
|
14
|
+
build_transfer(data)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The API expects the status filter as `status[]`; `status:` accepts a string or an array.
|
|
18
|
+
def list(status: nil, **params)
|
|
19
|
+
params[:'status[]'] = Array(status) unless status.nil?
|
|
20
|
+
@client.get(version: :v2).call('crossborder/transfers', **params).map do |data|
|
|
21
|
+
build_transfer(data)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def get(transfer_id)
|
|
26
|
+
data = @client.get(version: :v2).call("crossborder/transfers/#{transfer_id}")
|
|
27
|
+
build_transfer(data)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def build_transfer(data)
|
|
33
|
+
Fintoc::V2::CrossborderTransfer.new(**data)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V2
|
|
3
|
+
class AccountCertificate
|
|
4
|
+
attr_reader :object, :account_id, :account_number_id, :download_url, :expires_at
|
|
5
|
+
|
|
6
|
+
def initialize(
|
|
7
|
+
object:,
|
|
8
|
+
account_id:,
|
|
9
|
+
account_number_id:,
|
|
10
|
+
download_url:,
|
|
11
|
+
expires_at: nil,
|
|
12
|
+
**
|
|
13
|
+
)
|
|
14
|
+
@object = object
|
|
15
|
+
@account_id = account_id
|
|
16
|
+
@account_number_id = account_number_id
|
|
17
|
+
@download_url = download_url
|
|
18
|
+
@expires_at = expires_at
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def to_s
|
|
22
|
+
"📄 Account certificate (#{@account_number_id})"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V2
|
|
3
|
+
class CrossborderBeneficiary
|
|
4
|
+
attr_reader :id, :object, :mode, :holder_type, :business_name, :first_name, :last_name,
|
|
5
|
+
:bank_name, :routing_number, :account_last4, :address, :archived_at,
|
|
6
|
+
:created_at
|
|
7
|
+
|
|
8
|
+
def initialize(
|
|
9
|
+
id:,
|
|
10
|
+
object:,
|
|
11
|
+
mode: nil,
|
|
12
|
+
holder_type: nil,
|
|
13
|
+
business_name: nil,
|
|
14
|
+
first_name: nil,
|
|
15
|
+
last_name: nil,
|
|
16
|
+
bank_name: nil,
|
|
17
|
+
routing_number: nil,
|
|
18
|
+
account_last4: nil,
|
|
19
|
+
address: nil,
|
|
20
|
+
archived_at: nil,
|
|
21
|
+
created_at: nil,
|
|
22
|
+
**
|
|
23
|
+
)
|
|
24
|
+
@id = id
|
|
25
|
+
@object = object
|
|
26
|
+
@mode = mode
|
|
27
|
+
@holder_type = holder_type
|
|
28
|
+
@business_name = business_name
|
|
29
|
+
@first_name = first_name
|
|
30
|
+
@last_name = last_name
|
|
31
|
+
@bank_name = bank_name
|
|
32
|
+
@routing_number = routing_number
|
|
33
|
+
@account_last4 = account_last4
|
|
34
|
+
@address = address
|
|
35
|
+
@archived_at = archived_at
|
|
36
|
+
@created_at = created_at
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def archived?
|
|
40
|
+
!@archived_at.nil?
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def to_s
|
|
44
|
+
"Crossborder beneficiary (#{@id}) - #{@bank_name} ****#{@account_last4}"
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V2
|
|
3
|
+
class CrossborderQuote
|
|
4
|
+
attr_reader :id, :object, :mode, :status, :direction, :source_amount, :source_currency,
|
|
5
|
+
:target_amount, :target_currency, :exchange_rate, :fees, :transfer_id,
|
|
6
|
+
:expires_at, :created_at
|
|
7
|
+
|
|
8
|
+
def initialize(
|
|
9
|
+
id:,
|
|
10
|
+
object:,
|
|
11
|
+
mode: nil,
|
|
12
|
+
status: nil,
|
|
13
|
+
direction: nil,
|
|
14
|
+
source_amount: nil,
|
|
15
|
+
source_currency: nil,
|
|
16
|
+
target_amount: nil,
|
|
17
|
+
target_currency: nil,
|
|
18
|
+
exchange_rate: nil,
|
|
19
|
+
fees: nil,
|
|
20
|
+
transfer_id: nil,
|
|
21
|
+
expires_at: nil,
|
|
22
|
+
created_at: nil,
|
|
23
|
+
**
|
|
24
|
+
)
|
|
25
|
+
@id = id
|
|
26
|
+
@object = object
|
|
27
|
+
@mode = mode
|
|
28
|
+
@status = status
|
|
29
|
+
@direction = direction
|
|
30
|
+
@source_amount = source_amount
|
|
31
|
+
@source_currency = source_currency
|
|
32
|
+
@target_amount = target_amount
|
|
33
|
+
@target_currency = target_currency
|
|
34
|
+
@exchange_rate = exchange_rate
|
|
35
|
+
@fees = fees
|
|
36
|
+
@transfer_id = transfer_id
|
|
37
|
+
@expires_at = expires_at
|
|
38
|
+
@created_at = created_at
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def to_s
|
|
42
|
+
"Crossborder quote (#{@id}) - #{@direction} #{@status}"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
require 'fintoc/v2/resources/crossborder_beneficiary'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V2
|
|
5
|
+
class CrossborderTransfer
|
|
6
|
+
attr_reader :id, :object, :mode, :status, :direction, :quote_id, :source_amount,
|
|
7
|
+
:source_currency, :target_amount, :target_currency, :exchange_rate, :fees,
|
|
8
|
+
:beneficiary, :reference, :funding_instructions, :credit, :funds_received_at,
|
|
9
|
+
:succeeded_at, :canceled_at, :failed_at, :created_at
|
|
10
|
+
|
|
11
|
+
def initialize( # rubocop:disable Metrics/MethodLength
|
|
12
|
+
id:,
|
|
13
|
+
object:,
|
|
14
|
+
mode: nil,
|
|
15
|
+
status: nil,
|
|
16
|
+
direction: nil,
|
|
17
|
+
quote_id: nil,
|
|
18
|
+
source_amount: nil,
|
|
19
|
+
source_currency: nil,
|
|
20
|
+
target_amount: nil,
|
|
21
|
+
target_currency: nil,
|
|
22
|
+
exchange_rate: nil,
|
|
23
|
+
fees: nil,
|
|
24
|
+
beneficiary: nil,
|
|
25
|
+
reference: nil,
|
|
26
|
+
funding_instructions: nil,
|
|
27
|
+
credit: nil,
|
|
28
|
+
funds_received_at: nil,
|
|
29
|
+
succeeded_at: nil,
|
|
30
|
+
canceled_at: nil,
|
|
31
|
+
failed_at: nil,
|
|
32
|
+
created_at: nil,
|
|
33
|
+
**
|
|
34
|
+
)
|
|
35
|
+
@id = id
|
|
36
|
+
@object = object
|
|
37
|
+
@mode = mode
|
|
38
|
+
@status = status
|
|
39
|
+
@direction = direction
|
|
40
|
+
@quote_id = quote_id
|
|
41
|
+
@source_amount = source_amount
|
|
42
|
+
@source_currency = source_currency
|
|
43
|
+
@target_amount = target_amount
|
|
44
|
+
@target_currency = target_currency
|
|
45
|
+
@exchange_rate = exchange_rate
|
|
46
|
+
@fees = fees
|
|
47
|
+
@beneficiary = beneficiary && CrossborderBeneficiary.new(**beneficiary)
|
|
48
|
+
@reference = reference
|
|
49
|
+
@funding_instructions = funding_instructions
|
|
50
|
+
@credit = credit
|
|
51
|
+
@funds_received_at = funds_received_at
|
|
52
|
+
@succeeded_at = succeeded_at
|
|
53
|
+
@canceled_at = canceled_at
|
|
54
|
+
@failed_at = failed_at
|
|
55
|
+
@created_at = created_at
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def to_s
|
|
59
|
+
"Crossborder transfer (#{@id}) - #{@direction} #{@status}"
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
data/lib/fintoc/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fintoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juan Ca Sardin
|
|
@@ -132,6 +132,10 @@ files:
|
|
|
132
132
|
- lib/fintoc/v2/managers/account_verifications_manager.rb
|
|
133
133
|
- lib/fintoc/v2/managers/accounts_manager.rb
|
|
134
134
|
- lib/fintoc/v2/managers/checkout_sessions_manager.rb
|
|
135
|
+
- lib/fintoc/v2/managers/crossborder_beneficiaries_manager.rb
|
|
136
|
+
- lib/fintoc/v2/managers/crossborder_manager.rb
|
|
137
|
+
- lib/fintoc/v2/managers/crossborder_quotes_manager.rb
|
|
138
|
+
- lib/fintoc/v2/managers/crossborder_transfers_manager.rb
|
|
135
139
|
- lib/fintoc/v2/managers/customers_manager.rb
|
|
136
140
|
- lib/fintoc/v2/managers/entities_manager.rb
|
|
137
141
|
- lib/fintoc/v2/managers/events_manager.rb
|
|
@@ -150,10 +154,14 @@ files:
|
|
|
150
154
|
- lib/fintoc/v2/managers/transfer_batches_manager.rb
|
|
151
155
|
- lib/fintoc/v2/managers/transfers_manager.rb
|
|
152
156
|
- lib/fintoc/v2/resources/account.rb
|
|
157
|
+
- lib/fintoc/v2/resources/account_certificate.rb
|
|
153
158
|
- lib/fintoc/v2/resources/account_number.rb
|
|
154
159
|
- lib/fintoc/v2/resources/account_statement.rb
|
|
155
160
|
- lib/fintoc/v2/resources/account_verification.rb
|
|
156
161
|
- lib/fintoc/v2/resources/checkout_session.rb
|
|
162
|
+
- lib/fintoc/v2/resources/crossborder_beneficiary.rb
|
|
163
|
+
- lib/fintoc/v2/resources/crossborder_quote.rb
|
|
164
|
+
- lib/fintoc/v2/resources/crossborder_transfer.rb
|
|
157
165
|
- lib/fintoc/v2/resources/customer.rb
|
|
158
166
|
- lib/fintoc/v2/resources/entity.rb
|
|
159
167
|
- lib/fintoc/v2/resources/event.rb
|