fintoc 1.7.0 → 1.9.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: 64cdfca14464289a89d38a2693912d7b54791261e25c76851a59b5fd26664b37
4
- data.tar.gz: '049af1d5371b2a8ec247dcb434299a619b456f069e3db27abb378011748ac2ba'
3
+ metadata.gz: da4a9b4fedf94553216b95ab3f9b82836530bec85cedf2975a5796eb06b509aa
4
+ data.tar.gz: 990ac87930fab9e5bfaaa832e9eb5e45eb2f0380f612017f005e86dbc443ec84
5
5
  SHA512:
6
- metadata.gz: '089cf2234d2fb65530c6ad3ee1b8e9b7798563db02fb546fdc98bf34220bad5e4d8d62fd48e7100de2286e6684c1daa00baca9bd7db96e48496af481324948ca'
7
- data.tar.gz: 5572417e3bbf04894ce218ab87c85e58456b46c974b9914a5e8bc58928c1b5d1416799a9f02e1a512e48bc30f5b32f95c0dcab70e1c5f3bff5d299b6f63fd55a
6
+ metadata.gz: ffdc7c130de48280a1c39da9edeed0eec1d4eac65b2a52855a663a8b7fcd9e967835ca0f75f415fb66795911d154ed5b0682be0caba9555b4120ba4424a0849a
7
+ data.tar.gz: 38c4644259c6fd97d3877e465f10ac47d95c813962dd287acbe1eaf192cbed1d7e64c5461c05a67ea6a1fa1f00c058ef97acde4f19ae6ab300e23a515742d59d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fintoc (1.7.0)
4
+ fintoc (1.9.0)
5
5
  http
6
6
  money-rails
7
7
  tabulate
data/README.md CHANGED
@@ -33,6 +33,7 @@ Do yourself a favor: go grab some ice cubes by installing this refreshing librar
33
33
  - [Account Numbers](#account-numbers)
34
34
  - [Transfers](#transfers)
35
35
  - [Transfer Batches](#transfer-batches)
36
+ - [Recipients](#recipients)
36
37
  - [Simulate](#simulate)
37
38
  - [Account Verifications](#account-verifications)
38
39
  - [Entity onboardings API Examples](#entity-onboardings-api-examples)
@@ -148,6 +149,15 @@ resources = client.v1.payouts.list_resources('payout_id', resource_type: 'paymen
148
149
  disputes = client.v1.disputes.list(status: 'needs_response')
149
150
  client.v1.disputes.create_document('dispute_id', file: 'path/to/evidence.pdf')
150
151
  client.v1.disputes.submit_for_review('dispute_id')
152
+
153
+ # Referred organizations (live mode only). The request is signed with the JWS private key
154
+ organization = client.v1.organizations.create(
155
+ name: 'Empresa SpA',
156
+ tax_id: '11.111.111-1',
157
+ founder_email: 'founder@example.com',
158
+ products: { business_accounts: {} },
159
+ external_reference: 'SOL-123'
160
+ )
151
161
  ```
152
162
 
153
163
  ### **API V2 Client**
@@ -193,6 +203,17 @@ transfer_batch = client.v2.transfer_batches.create(
193
203
  transfers: [{...}]
194
204
  )
195
205
 
206
+ # Recipients
207
+ recipients = client.v2.recipients.list(entity_id: 'entity_id')
208
+ recipient = client.v2.recipients.get('recipient_id')
209
+ recipient = client.v2.recipients.create(
210
+ entity_id: 'entity_id',
211
+ account_number: 'account_number',
212
+ holder_name: 'Jon Snow'
213
+ )
214
+ recipient = client.v2.recipients.update('recipient_id', alias: 'Jon')
215
+ client.v2.recipients.delete('recipient_id')
216
+
196
217
  # Simulate
197
218
  simulated_transfer = client.v2.simulate.receive_transfer(
198
219
  account_number_id: 'account_number_id',
@@ -505,6 +526,39 @@ transfer_batches = client.v2.transfer_batches.list(
505
526
  transfers = client.v2.transfers.list(transfer_batch_id: 'transfer_batch_id')
506
527
  ```
507
528
 
529
+ #### Recipients
530
+
531
+ ```ruby
532
+ require 'fintoc'
533
+
534
+ client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')
535
+
536
+ # Create a recipient
537
+ recipient = client.v2.recipients.create(
538
+ entity_id: 'entity_id',
539
+ account_number: '000000001',
540
+ holder_name: 'Jon Snow',
541
+ account_type: 'checking_account',
542
+ holder_id: '11.111.111-1',
543
+ holder_type: 'person',
544
+ institution_id: 'cl_banco_de_chile',
545
+ alias: 'Jon',
546
+ email: 'jon.snow@example.com'
547
+ )
548
+
549
+ # Get a specific recipient
550
+ recipient = client.v2.recipients.get('recipient_id')
551
+
552
+ # List recipients, optionally filtered
553
+ recipients = client.v2.recipients.list(entity_id: 'entity_id', holder_type: 'person')
554
+
555
+ # Update a recipient
556
+ recipient = client.v2.recipients.update('recipient_id', alias: 'Lord Snow')
557
+
558
+ # Delete a recipient
559
+ client.v2.recipients.delete('recipient_id')
560
+ ```
561
+
508
562
  #### Simulate
509
563
 
510
564
  ```ruby
@@ -530,6 +584,14 @@ client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')
530
584
  # Create an account verification
531
585
  account_verification = client.v2.account_verifications.create(account_number: 'account_number')
532
586
 
587
+ # Create an account verification for a Chilean account
588
+ account_verification = client.v2.account_verifications.create(
589
+ account_number: '000000001',
590
+ institution_id: 'cl_banco_de_chile',
591
+ account_type: 'checking_account',
592
+ holder_id: '11.111.111-1'
593
+ )
594
+
533
595
  # Get a specific account verification
534
596
  account_verification = client.v2.account_verifications.get('account_verification_id')
535
597
 
data/lib/fintoc/client.rb CHANGED
@@ -9,7 +9,7 @@ module Fintoc
9
9
  end
10
10
 
11
11
  def v1
12
- @v1 ||= Fintoc::V1::Client.new(@api_key)
12
+ @v1 ||= Fintoc::V1::Client.new(@api_key, jws_private_key: @jws_private_key)
13
13
  end
14
14
 
15
15
  def v2
data/lib/fintoc/errors.rb CHANGED
@@ -83,6 +83,8 @@ module Fintoc
83
83
  class MinimumAmountError < FintocError; end
84
84
  class MutuallyExclusiveParamsError < FintocError; end
85
85
  class NotSupportedRefundableResourceTypeError < FintocError; end
86
+ class SplitFlatNotAllowedInIndexedSubscriptionError < FintocError; end
87
+ class SplitNotAvailableError < FintocError; end
86
88
  class SplitSumMismatchError < FintocError; end
87
89
 
88
90
  # 401 Unauthorized Errors
@@ -159,13 +161,17 @@ module Fintoc
159
161
  class InvoiceNotFinalizableError < FintocError; end
160
162
  class InvoiceNotMarkableUncollectibleError < FintocError; end
161
163
  class NoDocumentsToSubmitError < FintocError; end
164
+ class OrganizationAlreadyExistsError < FintocError; end
162
165
  class PaymentMethodNonCancelableError < FintocError; end
163
166
  class PaymentNonCancelableError < FintocError; end
164
167
  class PaymentNonExpirableError < FintocError; end
165
168
  class SubscriptionNotEditableError < FintocError; end
166
169
 
167
170
  # 422 Unprocessable Entity Errors
171
+ class AccountBlockedForDirectDebitError < FintocError; end
168
172
  class InvalidOtpCodeError < FintocError; end
173
+ class InvalidProductsError < FintocError; end
174
+ class InvalidTaxIdError < FintocError; end
169
175
  class OtpNotFoundError < FintocError; end
170
176
  class OtpBlockedError < FintocError; end
171
177
  class OtpVerificationFailedError < FintocError; end
@@ -191,6 +197,8 @@ module Fintoc
191
197
  class InvoiceNotPayableError < FintocError; end
192
198
  class InvoiceNotVoidableError < FintocError; end
193
199
  class LegalRepresentativeRequiredError < FintocError; end
200
+ class MandateLimitExceededError < FintocError; end
201
+ class MaximumAmountLimitError < FintocError; end
194
202
  class MerchantChargeLimitExceededError < FintocError; end
195
203
  class MerchantVolumeLimitExceededError < FintocError; end
196
204
  class NotOneDayCompanyError < FintocError; end
@@ -17,6 +17,7 @@ require 'fintoc/v1/managers/charges_manager'
17
17
  require 'fintoc/v1/managers/refunds_manager'
18
18
  require 'fintoc/v1/managers/payouts_manager'
19
19
  require 'fintoc/v1/managers/disputes_manager'
20
+ require 'fintoc/v1/managers/organizations_manager'
20
21
 
21
22
  module Fintoc
22
23
  module V1
@@ -92,6 +93,10 @@ module Fintoc
92
93
  def disputes
93
94
  @disputes ||= Managers::DisputesManager.new(self)
94
95
  end
96
+
97
+ def organizations
98
+ @organizations ||= Managers::OrganizationsManager.new(self)
99
+ end
95
100
  end
96
101
  end
97
102
  end
@@ -0,0 +1,25 @@
1
+ require 'fintoc/v1/resources/organization'
2
+
3
+ module Fintoc
4
+ module V1
5
+ module Managers
6
+ class OrganizationsManager
7
+ def initialize(client)
8
+ @client = client
9
+ end
10
+
11
+ def create(name:, tax_id:, founder_email:, products:, **params)
12
+ data = @client.post(version: :v1, use_jws: true)
13
+ .call('organizations', name:, tax_id:, founder_email:, products:, **params)
14
+ build_organization(data)
15
+ end
16
+
17
+ private
18
+
19
+ def build_organization(data)
20
+ Fintoc::V1::Organization.new(**data)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -2,7 +2,8 @@ module Fintoc
2
2
  module V1
3
3
  class Dispute
4
4
  attr_reader :id, :object, :amount, :created_at, :currency, :documentation_upload_deadline,
5
- :documents, :mode, :resource_id, :resource_type, :status, :updated_at
5
+ :documents, :mode, :payment_method_type, :resource_id, :resource_type, :status,
6
+ :updated_at
6
7
 
7
8
  def initialize(
8
9
  id:,
@@ -13,6 +14,7 @@ module Fintoc
13
14
  documentation_upload_deadline: nil,
14
15
  documents: nil,
15
16
  mode: nil,
17
+ payment_method_type: nil,
16
18
  resource_id: nil,
17
19
  resource_type: nil,
18
20
  status: nil,
@@ -27,6 +29,7 @@ module Fintoc
27
29
  @documentation_upload_deadline = documentation_upload_deadline
28
30
  @documents = documents
29
31
  @mode = mode
32
+ @payment_method_type = payment_method_type
30
33
  @resource_id = resource_id
31
34
  @resource_type = resource_type
32
35
  @status = status
@@ -0,0 +1,31 @@
1
+ module Fintoc
2
+ module V1
3
+ class Organization
4
+ attr_reader :id, :object, :external_reference, :interested_products, :metadata, :name,
5
+ :tax_id
6
+
7
+ def initialize(
8
+ id:,
9
+ object:,
10
+ external_reference: nil,
11
+ interested_products: nil,
12
+ metadata: nil,
13
+ name: nil,
14
+ tax_id: nil,
15
+ **
16
+ )
17
+ @id = id
18
+ @object = object
19
+ @external_reference = external_reference
20
+ @interested_products = interested_products
21
+ @metadata = metadata
22
+ @name = name
23
+ @tax_id = tax_id
24
+ end
25
+
26
+ def to_s
27
+ "Organization (#{@id}) - #{@name}"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -2,7 +2,8 @@ module Fintoc
2
2
  module V1
3
3
  class PaymentLink
4
4
  attr_reader :id, :object, :amount, :checkout, :created_at, :currency, :customer_email,
5
- :expires_at, :metadata, :mode, :recipient_account, :status, :url
5
+ :expires_at, :max_completed_sessions, :metadata, :mode, :recipient_account,
6
+ :status, :url
6
7
 
7
8
  def initialize(
8
9
  id:,
@@ -13,6 +14,7 @@ module Fintoc
13
14
  currency: nil,
14
15
  customer_email: nil,
15
16
  expires_at: nil,
17
+ max_completed_sessions: nil,
16
18
  metadata: nil,
17
19
  mode: nil,
18
20
  recipient_account: nil,
@@ -28,6 +30,7 @@ module Fintoc
28
30
  @currency = currency
29
31
  @customer_email = customer_email
30
32
  @expires_at = expires_at
33
+ @max_completed_sessions = max_completed_sessions
31
34
  @metadata = metadata
32
35
  @mode = mode
33
36
  @recipient_account = recipient_account
@@ -8,8 +8,8 @@ module Fintoc
8
8
  @client = client
9
9
  end
10
10
 
11
- def create(account_number:, idempotency_key: nil)
12
- data = _create_account_verification(account_number:, idempotency_key:)
11
+ def create(account_number:, idempotency_key: nil, **params)
12
+ data = _create_account_verification(account_number:, idempotency_key:, **params)
13
13
  build_account_verification(data)
14
14
  end
15
15
 
@@ -24,9 +24,9 @@ module Fintoc
24
24
 
25
25
  private
26
26
 
27
- def _create_account_verification(account_number:, idempotency_key: nil)
27
+ def _create_account_verification(account_number:, idempotency_key: nil, **params)
28
28
  @client.post(version: :v2, use_jws: true, idempotency_key:)
29
- .call('account_verifications', account_number:)
29
+ .call('account_verifications', account_number:, **params)
30
30
  end
31
31
 
32
32
  def _get_account_verification(account_verification_id)
@@ -5,8 +5,8 @@ module Fintoc
5
5
  class Invoice
6
6
  attr_reader :id, :object, :attempt_count, :collection_method, :created_at, :currency,
7
7
  :customer, :default_payment_method, :external_payment, :hosted_invoice_url,
8
- :lines, :metadata, :mode, :next_payment_attempt_at, :payments, :status,
9
- :subscription, :total
8
+ :lines, :metadata, :mode, :next_payment_attempt_at, :payments, :reason,
9
+ :split, :split_applied, :status, :subscription, :total
10
10
 
11
11
  def initialize( # rubocop:disable Metrics/MethodLength
12
12
  id:,
@@ -24,6 +24,9 @@ module Fintoc
24
24
  mode: nil,
25
25
  next_payment_attempt_at: nil,
26
26
  payments: nil,
27
+ reason: nil,
28
+ split: nil,
29
+ split_applied: nil,
27
30
  status: nil,
28
31
  subscription: nil,
29
32
  total: nil,
@@ -45,6 +48,9 @@ module Fintoc
45
48
  @mode = mode
46
49
  @next_payment_attempt_at = next_payment_attempt_at
47
50
  @payments = payments
51
+ @reason = reason
52
+ @split = split
53
+ @split_applied = split_applied
48
54
  @status = status
49
55
  @subscription = subscription
50
56
  @total = total
@@ -5,9 +5,9 @@ module Fintoc
5
5
  :customer_email, :customer_phone, :error_reason, :expires_at, :invoices,
6
6
  :metadata, :mode, :next_action, :payment_method, :payment_type,
7
7
  :payment_type_options, :recipient_account, :reference_id, :sender_account,
8
- :status, :transaction_date, :widget_token
8
+ :split, :split_applied, :status, :transaction_date, :widget_token
9
9
 
10
- def initialize( # rubocop:disable Metrics/MethodLength
10
+ def initialize( # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
11
11
  id:,
12
12
  object:,
13
13
  amount: nil,
@@ -29,6 +29,8 @@ module Fintoc
29
29
  recipient_account: nil,
30
30
  reference_id: nil,
31
31
  sender_account: nil,
32
+ split: nil,
33
+ split_applied: nil,
32
34
  status: nil,
33
35
  transaction_date: nil,
34
36
  widget_token: nil,
@@ -55,6 +57,8 @@ module Fintoc
55
57
  @recipient_account = recipient_account
56
58
  @reference_id = reference_id
57
59
  @sender_account = sender_account
60
+ @split = split
61
+ @split_applied = split_applied
58
62
  @status = status
59
63
  @transaction_date = transaction_date
60
64
  @widget_token = widget_token
@@ -4,9 +4,10 @@ module Fintoc
4
4
  module V2
5
5
  class Subscription
6
6
  attr_reader :id, :object, :billing_cycle_anchor, :cancel_at, :collection_method, :created_at,
7
- :customer, :items, :metadata, :mode, :payment_method, :status, :trial_end
7
+ :customer, :items, :metadata, :mode, :payment_method, :reason, :split, :status,
8
+ :trial_end
8
9
 
9
- def initialize(
10
+ def initialize( # rubocop:disable Metrics/MethodLength
10
11
  id:,
11
12
  object:,
12
13
  billing_cycle_anchor: nil,
@@ -18,6 +19,8 @@ module Fintoc
18
19
  metadata: nil,
19
20
  mode: nil,
20
21
  payment_method: nil,
22
+ reason: nil,
23
+ split: nil,
21
24
  status: nil,
22
25
  trial_end: nil,
23
26
  client: nil,
@@ -34,6 +37,8 @@ module Fintoc
34
37
  @metadata = metadata
35
38
  @mode = mode
36
39
  @payment_method = payment_method
40
+ @reason = reason
41
+ @split = split
37
42
  @status = status
38
43
  @trial_end = trial_end
39
44
  @client = client
@@ -1,3 +1,3 @@
1
1
  module Fintoc
2
- VERSION = '1.7.0'
2
+ VERSION = '1.9.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.7.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Ca Sardin
@@ -91,6 +91,7 @@ files:
91
91
  - lib/fintoc/v1/managers/link_intents_manager.rb
92
92
  - lib/fintoc/v1/managers/links_manager.rb
93
93
  - lib/fintoc/v1/managers/movements_manager.rb
94
+ - lib/fintoc/v1/managers/organizations_manager.rb
94
95
  - lib/fintoc/v1/managers/payment_intents_manager.rb
95
96
  - lib/fintoc/v1/managers/payment_links_manager.rb
96
97
  - lib/fintoc/v1/managers/payouts_manager.rb
@@ -111,6 +112,7 @@ files:
111
112
  - lib/fintoc/v1/resources/link.rb
112
113
  - lib/fintoc/v1/resources/link_intent.rb
113
114
  - lib/fintoc/v1/resources/movement.rb
115
+ - lib/fintoc/v1/resources/organization.rb
114
116
  - lib/fintoc/v1/resources/payment_intent.rb
115
117
  - lib/fintoc/v1/resources/payment_link.rb
116
118
  - lib/fintoc/v1/resources/payout.rb