fintoc 1.13.0 → 1.14.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efae9a9d7ad4d6e8d0068265230e79590107d1632777b32ff8439ab61b94a3e4
4
- data.tar.gz: f71ecb0b65ba407fdbdf5abf1aaaa46b00ed4feea0d7c1cd8fab3152d717f82d
3
+ metadata.gz: f276c501caff1bac32cb8a15915a2896a1128c34e37aefb76712ae1f711a668b
4
+ data.tar.gz: 7190c09cab66eb18662c998392470ccb14af900014d359e5561c035bd1f873f9
5
5
  SHA512:
6
- metadata.gz: '039fe386bc7ae041e6e64d2deb4e21c8ed9c6f8ec69d167db9f793b1a77f1438705316c5b8d95510682c386ca57fdee642e64310875b72c48e8c6e60e2291fee'
7
- data.tar.gz: 1c0d7b909a3e72b18039a04328aec460107d6ee4036018068d64e89a58cf45a8a4bdfa4765ee91baeb09b41872e5a3fdd6b7ce704bb316479fc3ec029ace29b7
6
+ metadata.gz: 7c0b8e7f9dd50a5e68b4ef01b893f43e7689ad5d81d1146e65df62f2828673104599fec6b3d307ba1379c42e25215f1d055d22496a11aab0b16975421d0b7e8e
7
+ data.tar.gz: 07a3b314e53f67a9d3253c0a7edd5b3df7cd04dd5c8768e89850a442e7d93644094533b3f415ff471356c578f6365958946289512d1d13bdea1b65ec23de4f35
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fintoc (1.13.0)
4
+ fintoc (1.14.0)
5
5
  http
6
6
  money-rails
7
7
  tabulate
data/README.md CHANGED
@@ -596,6 +596,14 @@ beneficiary = client.v2.crossborder.beneficiaries.create(
596
596
  beneficiaries = client.v2.crossborder.beneficiaries.list(limit: 10)
597
597
  client.v2.crossborder.beneficiaries.delete(beneficiary.id) # archives the beneficiary
598
598
 
599
+ wallet = client.v2.crossborder.beneficiaries.create(
600
+ holder_type: 'business',
601
+ business_name: 'Acme LLC',
602
+ account_scheme: 'evm_address',
603
+ network: 'polygon',
604
+ account_identifier: '0x52908400098527886E0F7030069857D2E4169EE7'
605
+ )
606
+
599
607
  quote = client.v2.crossborder.quotes.create(direction: 'mx_to_usd', source_amount: 200001)
600
608
  quote = client.v2.crossborder.quotes.get(quote.id)
601
609
 
@@ -605,6 +613,11 @@ transfer = client.v2.crossborder.transfers.create(
605
613
  transfer.funding_instructions[:clabe]
606
614
  transfers = client.v2.crossborder.transfers.list(status: %w[pending_funds failed], direction: 'mx_to_usd')
607
615
  transfer = client.v2.crossborder.transfers.get('crossborder_transfer_id')
616
+
617
+ # usdt_to_mx transfers waiting for their USDT can be canceled
618
+ client.v2.crossborder.transfers.cancel('crossborder_transfer_id')
619
+ # Test mode only: simulates the arrival of the pesos of a usdt_to_mx transfer
620
+ client.v2.crossborder.transfers.simulate_credit('crossborder_transfer_id')
608
621
  ```
609
622
 
610
623
  #### 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
@@ -231,6 +235,7 @@ module Fintoc
231
235
  class OrganizationWithoutOperationalRootEntityError < FintocError; end
232
236
  class PaymentCancellationNotSupportedError < FintocError; end
233
237
  class PaymentMethodInactiveError < FintocError; end
238
+ class PaymentMethodCanceledError < FintocError; end
234
239
  class PaymentMethodTypeNotAvailableError < FintocError; end
235
240
  class PaymentMethodTypeNotSupportedError < FintocError; end
236
241
  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)
@@ -1,20 +1,24 @@
1
1
  module Fintoc
2
2
  module V2
3
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
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, :transfer_id,
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
@@ -1,3 +1,3 @@
1
1
  module Fintoc
2
- VERSION = '1.13.0'
2
+ VERSION = '1.14.0'
3
3
  end
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.13.0
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Ca Sardin