fintoc 1.13.0 → 1.15.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 +1 -1
- data/README.md +15 -0
- data/lib/fintoc/errors.rb +6 -0
- data/lib/fintoc/v2/managers/crossborder_beneficiaries_manager.rb +2 -6
- data/lib/fintoc/v2/managers/crossborder_transfers_manager.rb +13 -0
- data/lib/fintoc/v2/managers/payment_methods_manager.rb +5 -0
- data/lib/fintoc/v2/resources/crossborder_beneficiary.rb +15 -4
- data/lib/fintoc/v2/resources/crossborder_quote.rb +4 -2
- data/lib/fintoc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d791f2eeb81b30aef86b926cefc80928702fbbeb01f8d36b719963bf0bad44cc
|
|
4
|
+
data.tar.gz: b19fdc5e8f05a792ba812ab43ba552e2e01628badee044a13fffbd58efaa86a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b83d81e62a2d8923db706b9144d7a5a4a971415bd6f87ee036a31ead050460c1a1d84dc52df49932c9da8db3f1523f76b58a499e6a45ff8de8d321bd1b6971df
|
|
7
|
+
data.tar.gz: 19d324de1240f7e64f7f691c2dd6dd31f79f582ab6175e08874fd1f15dd0d021b1fd202826f77529032f7d0ef3f91babc31791771c059aa299edbb05c4026b00
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -248,6 +248,8 @@ customer = client.v2.customers.create(email: 'customer@example.com', name: 'Jon
|
|
|
248
248
|
payment_methods = client.v2.payment_methods.list(customer: 'customer_id')
|
|
249
249
|
client.v2.payment_methods.cancel('payment_method_id')
|
|
250
250
|
mandate = client.v2.payment_methods.mandate_document('payment_method_id')
|
|
251
|
+
installments = client.v2.payment_methods.installments('payment_method_id', amount: 1000, currency: 'CLP')
|
|
252
|
+
# => { available_installments: [3, 6, 12] }
|
|
251
253
|
# Mexican direct debit mandates are sent as multipart. Nested fields are sent in
|
|
252
254
|
# bracket notation and consent documents accept a path or an IO.
|
|
253
255
|
payment_method = client.v2.payment_methods.create(
|
|
@@ -596,6 +598,14 @@ beneficiary = client.v2.crossborder.beneficiaries.create(
|
|
|
596
598
|
beneficiaries = client.v2.crossborder.beneficiaries.list(limit: 10)
|
|
597
599
|
client.v2.crossborder.beneficiaries.delete(beneficiary.id) # archives the beneficiary
|
|
598
600
|
|
|
601
|
+
wallet = client.v2.crossborder.beneficiaries.create(
|
|
602
|
+
holder_type: 'business',
|
|
603
|
+
business_name: 'Acme LLC',
|
|
604
|
+
account_scheme: 'evm_address',
|
|
605
|
+
network: 'polygon',
|
|
606
|
+
account_identifier: '0x52908400098527886E0F7030069857D2E4169EE7'
|
|
607
|
+
)
|
|
608
|
+
|
|
599
609
|
quote = client.v2.crossborder.quotes.create(direction: 'mx_to_usd', source_amount: 200001)
|
|
600
610
|
quote = client.v2.crossborder.quotes.get(quote.id)
|
|
601
611
|
|
|
@@ -605,6 +615,11 @@ transfer = client.v2.crossborder.transfers.create(
|
|
|
605
615
|
transfer.funding_instructions[:clabe]
|
|
606
616
|
transfers = client.v2.crossborder.transfers.list(status: %w[pending_funds failed], direction: 'mx_to_usd')
|
|
607
617
|
transfer = client.v2.crossborder.transfers.get('crossborder_transfer_id')
|
|
618
|
+
|
|
619
|
+
# usdt_to_mx transfers waiting for their USDT can be canceled
|
|
620
|
+
client.v2.crossborder.transfers.cancel('crossborder_transfer_id')
|
|
621
|
+
# Test mode only: simulates the arrival of the pesos of a usdt_to_mx transfer
|
|
622
|
+
client.v2.crossborder.transfers.simulate_credit('crossborder_transfer_id')
|
|
608
623
|
```
|
|
609
624
|
|
|
610
625
|
#### Simulate
|
data/lib/fintoc/errors.rb
CHANGED
|
@@ -96,6 +96,7 @@ module Fintoc
|
|
|
96
96
|
class SplitFlatNotAllowedInIndexedSubscriptionError < FintocError; end
|
|
97
97
|
class SplitNotAvailableError < FintocError; end
|
|
98
98
|
class SplitSumMismatchError < FintocError; end
|
|
99
|
+
class CreditSimulationUnavailableError < FintocError; end
|
|
99
100
|
|
|
100
101
|
# 401 Unauthorized Errors
|
|
101
102
|
class AuthenticationError < FintocError; end
|
|
@@ -185,6 +186,9 @@ module Fintoc
|
|
|
185
186
|
class CheckoutSessionNotInProgressError < FintocError; end
|
|
186
187
|
class NoCardSubmittedError < FintocError; end
|
|
187
188
|
class QuoteAlreadyAcceptedError < FintocError; end
|
|
189
|
+
class CreditAlreadySimulatedError < FintocError; end
|
|
190
|
+
class TransferNotCancellableError < FintocError; end
|
|
191
|
+
class UsdtCollectionAlreadyOpenError < FintocError; end
|
|
188
192
|
|
|
189
193
|
# 422 Unprocessable Entity Errors
|
|
190
194
|
class AccountBlockedForDirectDebitError < FintocError; end
|
|
@@ -210,6 +214,7 @@ module Fintoc
|
|
|
210
214
|
class RejectedRefreshIntentError < FintocError; end
|
|
211
215
|
class SenderBlockedAccountError < FintocError; end
|
|
212
216
|
class AmountOutOfRangeError < FintocError; end
|
|
217
|
+
class ChargeProcessingFeeNotAllowedError < FintocError; end
|
|
213
218
|
class CountryNotSupportedError < FintocError; end
|
|
214
219
|
class DirectDebitSuspendedError < FintocError; end
|
|
215
220
|
class FileTooLargeError < FintocError; end
|
|
@@ -231,6 +236,7 @@ module Fintoc
|
|
|
231
236
|
class OrganizationWithoutOperationalRootEntityError < FintocError; end
|
|
232
237
|
class PaymentCancellationNotSupportedError < FintocError; end
|
|
233
238
|
class PaymentMethodInactiveError < FintocError; end
|
|
239
|
+
class PaymentMethodCanceledError < FintocError; end
|
|
234
240
|
class PaymentMethodTypeNotAvailableError < FintocError; end
|
|
235
241
|
class PaymentMethodTypeNotSupportedError < FintocError; end
|
|
236
242
|
class PaymentMethodUnavailableError < FintocError; end
|
|
@@ -8,13 +8,9 @@ module Fintoc
|
|
|
8
8
|
@client = client
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
def create(
|
|
12
|
-
holder_type:, account_identifier:, routing_number:, bank_name:, address:,
|
|
13
|
-
idempotency_key: nil, **params
|
|
14
|
-
)
|
|
11
|
+
def create(holder_type:, account_identifier:, idempotency_key: nil, **params)
|
|
15
12
|
data = @client.post(version: :v2, idempotency_key:).call(
|
|
16
|
-
'crossborder/beneficiaries',
|
|
17
|
-
holder_type:, account_identifier:, routing_number:, bank_name:, address:, **params
|
|
13
|
+
'crossborder/beneficiaries', holder_type:, account_identifier:, **params
|
|
18
14
|
)
|
|
19
15
|
build_beneficiary(data)
|
|
20
16
|
end
|
|
@@ -27,6 +27,19 @@ module Fintoc
|
|
|
27
27
|
build_transfer(data)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
def cancel(transfer_id, idempotency_key: nil)
|
|
31
|
+
data = @client.post(version: :v2, idempotency_key:)
|
|
32
|
+
.call("crossborder/transfers/#{transfer_id}/cancel")
|
|
33
|
+
build_transfer(data)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Test mode only.
|
|
37
|
+
def simulate_credit(transfer_id, idempotency_key: nil)
|
|
38
|
+
data = @client.post(version: :v2, idempotency_key:)
|
|
39
|
+
.call("crossborder/transfers/#{transfer_id}/simulate_credit")
|
|
40
|
+
build_transfer(data)
|
|
41
|
+
end
|
|
42
|
+
|
|
30
43
|
private
|
|
31
44
|
|
|
32
45
|
def build_transfer(data)
|
|
@@ -36,6 +36,11 @@ module Fintoc
|
|
|
36
36
|
@client.get(version: :v2).call("payment_methods/#{payment_method_id}/mandate_document")
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
def installments(payment_method_id, amount:, currency:)
|
|
40
|
+
@client.get(version: :v2)
|
|
41
|
+
.call("payment_methods/#{payment_method_id}/installments", amount:, currency:)
|
|
42
|
+
end
|
|
43
|
+
|
|
39
44
|
private
|
|
40
45
|
|
|
41
46
|
def flatten_form(fields, prefix = nil)
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
module Fintoc
|
|
2
2
|
module V2
|
|
3
3
|
class CrossborderBeneficiary
|
|
4
|
-
attr_reader :id, :object, :mode, :
|
|
5
|
-
:
|
|
6
|
-
:created_at
|
|
4
|
+
attr_reader :id, :object, :mode, :account_scheme, :currency, :network, :holder_type,
|
|
5
|
+
:business_name, :first_name, :last_name, :bank_name, :routing_number,
|
|
6
|
+
:account_identifier, :account_last4, :address, :archived_at, :created_at
|
|
7
7
|
|
|
8
|
-
def initialize(
|
|
8
|
+
def initialize( # rubocop:disable Metrics/MethodLength
|
|
9
9
|
id:,
|
|
10
10
|
object:,
|
|
11
11
|
mode: nil,
|
|
12
|
+
account_scheme: nil,
|
|
13
|
+
currency: nil,
|
|
14
|
+
network: nil,
|
|
12
15
|
holder_type: nil,
|
|
13
16
|
business_name: nil,
|
|
14
17
|
first_name: nil,
|
|
15
18
|
last_name: nil,
|
|
16
19
|
bank_name: nil,
|
|
17
20
|
routing_number: nil,
|
|
21
|
+
account_identifier: nil,
|
|
18
22
|
account_last4: nil,
|
|
19
23
|
address: nil,
|
|
20
24
|
archived_at: nil,
|
|
@@ -24,12 +28,16 @@ module Fintoc
|
|
|
24
28
|
@id = id
|
|
25
29
|
@object = object
|
|
26
30
|
@mode = mode
|
|
31
|
+
@account_scheme = account_scheme
|
|
32
|
+
@currency = currency
|
|
33
|
+
@network = network
|
|
27
34
|
@holder_type = holder_type
|
|
28
35
|
@business_name = business_name
|
|
29
36
|
@first_name = first_name
|
|
30
37
|
@last_name = last_name
|
|
31
38
|
@bank_name = bank_name
|
|
32
39
|
@routing_number = routing_number
|
|
40
|
+
@account_identifier = account_identifier
|
|
33
41
|
@account_last4 = account_last4
|
|
34
42
|
@address = address
|
|
35
43
|
@archived_at = archived_at
|
|
@@ -41,6 +49,9 @@ module Fintoc
|
|
|
41
49
|
end
|
|
42
50
|
|
|
43
51
|
def to_s
|
|
52
|
+
return "Crossborder beneficiary (#{@id}) - #{@network} #{@account_identifier}" if
|
|
53
|
+
@account_scheme == 'evm_address'
|
|
54
|
+
|
|
44
55
|
"Crossborder beneficiary (#{@id}) - #{@bank_name} ****#{@account_last4}"
|
|
45
56
|
end
|
|
46
57
|
end
|
|
@@ -2,8 +2,8 @@ module Fintoc
|
|
|
2
2
|
module V2
|
|
3
3
|
class CrossborderQuote
|
|
4
4
|
attr_reader :id, :object, :mode, :status, :direction, :source_amount, :source_currency,
|
|
5
|
-
:target_amount, :target_currency, :exchange_rate, :fees, :
|
|
6
|
-
:expires_at, :created_at
|
|
5
|
+
:target_amount, :target_currency, :exchange_rate, :fees, :kind,
|
|
6
|
+
:transfer_id, :expires_at, :created_at
|
|
7
7
|
|
|
8
8
|
def initialize(
|
|
9
9
|
id:,
|
|
@@ -17,6 +17,7 @@ module Fintoc
|
|
|
17
17
|
target_currency: nil,
|
|
18
18
|
exchange_rate: nil,
|
|
19
19
|
fees: nil,
|
|
20
|
+
kind: nil,
|
|
20
21
|
transfer_id: nil,
|
|
21
22
|
expires_at: nil,
|
|
22
23
|
created_at: nil,
|
|
@@ -33,6 +34,7 @@ module Fintoc
|
|
|
33
34
|
@target_currency = target_currency
|
|
34
35
|
@exchange_rate = exchange_rate
|
|
35
36
|
@fees = fees
|
|
37
|
+
@kind = kind
|
|
36
38
|
@transfer_id = transfer_id
|
|
37
39
|
@expires_at = expires_at
|
|
38
40
|
@created_at = created_at
|
data/lib/fintoc/version.rb
CHANGED