fintoc 1.5.0 → 1.7.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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +109 -4
  4. data/fintoc.gemspec +3 -3
  5. data/lib/fintoc/base_client.rb +8 -4
  6. data/lib/fintoc/errors.rb +67 -0
  7. data/lib/fintoc/v1/client/client.rb +80 -0
  8. data/lib/fintoc/v1/managers/accounts_manager.rb +30 -0
  9. data/lib/fintoc/v1/managers/charges_manager.rb +48 -0
  10. data/lib/fintoc/v1/managers/disputes_manager.rb +43 -0
  11. data/lib/fintoc/v1/managers/institutions_manager.rb +19 -0
  12. data/lib/fintoc/v1/managers/invoices_manager.rb +30 -0
  13. data/lib/fintoc/v1/managers/link_intents_manager.rb +25 -0
  14. data/lib/fintoc/v1/managers/links_manager.rb +17 -0
  15. data/lib/fintoc/v1/managers/movements_manager.rb +31 -0
  16. data/lib/fintoc/v1/managers/payment_intents_manager.rb +42 -0
  17. data/lib/fintoc/v1/managers/payment_links_manager.rb +42 -0
  18. data/lib/fintoc/v1/managers/payouts_manager.rb +50 -0
  19. data/lib/fintoc/v1/managers/refresh_intents_manager.rb +39 -0
  20. data/lib/fintoc/v1/managers/refunds_manager.rb +47 -0
  21. data/lib/fintoc/v1/managers/subscription_intents_manager.rb +36 -0
  22. data/lib/fintoc/v1/managers/subscriptions_manager.rb +30 -0
  23. data/lib/fintoc/v1/managers/tax_returns_manager.rb +30 -0
  24. data/lib/fintoc/v1/managers/tax_statements_manager.rb +30 -0
  25. data/lib/fintoc/v1/managers/webhook_endpoints_manager.rb +1 -2
  26. data/lib/fintoc/v1/resources/account.rb +9 -2
  27. data/lib/fintoc/v1/resources/charge.rb +39 -0
  28. data/lib/fintoc/v1/resources/dispute.rb +41 -0
  29. data/lib/fintoc/v1/resources/dispute_document.rb +30 -0
  30. data/lib/fintoc/v1/resources/institution.rb +4 -2
  31. data/lib/fintoc/v1/resources/invoice.rb +43 -0
  32. data/lib/fintoc/v1/resources/link.rb +2 -2
  33. data/lib/fintoc/v1/resources/link_intent.rb +39 -0
  34. data/lib/fintoc/v1/resources/payment_intent.rb +72 -0
  35. data/lib/fintoc/v1/resources/payment_link.rb +43 -0
  36. data/lib/fintoc/v1/resources/payout.rb +37 -0
  37. data/lib/fintoc/v1/resources/refresh_intent.rb +37 -0
  38. data/lib/fintoc/v1/resources/refund.rb +43 -0
  39. data/lib/fintoc/v1/resources/subscription.rb +30 -0
  40. data/lib/fintoc/v1/resources/subscription_intent.rb +39 -0
  41. data/lib/fintoc/v1/resources/tax_return.rb +33 -0
  42. data/lib/fintoc/v1/resources/tax_statement.rb +39 -0
  43. data/lib/fintoc/v1/resources/webhook_endpoint.rb +10 -4
  44. data/lib/fintoc/v2/client/client.rb +50 -0
  45. data/lib/fintoc/v2/managers/checkout_sessions_manager.rb +42 -0
  46. data/lib/fintoc/v2/managers/customers_manager.rb +36 -0
  47. data/lib/fintoc/v2/managers/entities_manager.rb +6 -0
  48. data/lib/fintoc/v2/managers/events_manager.rb +30 -0
  49. data/lib/fintoc/v2/managers/invoice_lines_manager.rb +30 -0
  50. data/lib/fintoc/v2/managers/invoices_manager.rb +78 -0
  51. data/lib/fintoc/v2/managers/onboardings_manager.rb +14 -0
  52. data/lib/fintoc/v2/managers/payment_intents_manager.rb +53 -0
  53. data/lib/fintoc/v2/managers/payment_methods_manager.rb +68 -0
  54. data/lib/fintoc/v2/managers/products_manager.rb +42 -0
  55. data/lib/fintoc/v2/managers/recipients_manager.rb +47 -0
  56. data/lib/fintoc/v2/managers/setup_intents_manager.rb +24 -0
  57. data/lib/fintoc/v2/managers/subscription_items_manager.rb +41 -0
  58. data/lib/fintoc/v2/managers/subscriptions_manager.rb +54 -0
  59. data/lib/fintoc/v2/managers/transfers_manager.rb +4 -0
  60. data/lib/fintoc/v2/resources/checkout_session.rb +81 -0
  61. data/lib/fintoc/v2/resources/customer.rb +37 -0
  62. data/lib/fintoc/v2/resources/entity.rb +5 -1
  63. data/lib/fintoc/v2/resources/event.rb +28 -0
  64. data/lib/fintoc/v2/resources/invoice.rb +63 -0
  65. data/lib/fintoc/v2/resources/invoice_line.rb +35 -0
  66. data/lib/fintoc/v2/resources/payment_intent.rb +68 -0
  67. data/lib/fintoc/v2/resources/payment_method.rb +37 -0
  68. data/lib/fintoc/v2/resources/product.rb +32 -0
  69. data/lib/fintoc/v2/resources/recipient.rb +62 -0
  70. data/lib/fintoc/v2/resources/settlement_account.rb +30 -0
  71. data/lib/fintoc/v2/resources/setup_intent.rb +24 -0
  72. data/lib/fintoc/v2/resources/subscription.rb +51 -0
  73. data/lib/fintoc/v2/resources/subscription_item.rb +24 -0
  74. data/lib/fintoc/version.rb +1 -1
  75. metadata +56 -1
@@ -0,0 +1,35 @@
1
+ module Fintoc
2
+ module V2
3
+ class InvoiceLine
4
+ attr_reader :id, :object, :amount, :currency, :description, :name, :period_end, :period_start,
5
+ :quantity
6
+
7
+ def initialize(
8
+ id:,
9
+ object:,
10
+ amount: nil,
11
+ currency: nil,
12
+ description: nil,
13
+ name: nil,
14
+ period_end: nil,
15
+ period_start: nil,
16
+ quantity: nil,
17
+ **
18
+ )
19
+ @id = id
20
+ @object = object
21
+ @amount = amount
22
+ @currency = currency
23
+ @description = description
24
+ @name = name
25
+ @period_end = period_end
26
+ @period_start = period_start
27
+ @quantity = quantity
28
+ end
29
+
30
+ def to_s
31
+ "Invoice line (#{@id})"
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,68 @@
1
+ module Fintoc
2
+ module V2
3
+ class PaymentIntent
4
+ attr_reader :id, :object, :amount, :business_profile, :created_at, :currency, :customer,
5
+ :customer_email, :customer_phone, :error_reason, :expires_at, :invoices,
6
+ :metadata, :mode, :next_action, :payment_method, :payment_type,
7
+ :payment_type_options, :recipient_account, :reference_id, :sender_account,
8
+ :status, :transaction_date, :widget_token
9
+
10
+ def initialize( # rubocop:disable Metrics/MethodLength
11
+ id:,
12
+ object:,
13
+ amount: nil,
14
+ business_profile: nil,
15
+ created_at: nil,
16
+ currency: nil,
17
+ customer: nil,
18
+ customer_email: nil,
19
+ customer_phone: nil,
20
+ error_reason: nil,
21
+ expires_at: nil,
22
+ invoices: nil,
23
+ metadata: nil,
24
+ mode: nil,
25
+ next_action: nil,
26
+ payment_method: nil,
27
+ payment_type: nil,
28
+ payment_type_options: nil,
29
+ recipient_account: nil,
30
+ reference_id: nil,
31
+ sender_account: nil,
32
+ status: nil,
33
+ transaction_date: nil,
34
+ widget_token: nil,
35
+ **
36
+ )
37
+ @id = id
38
+ @object = object
39
+ @amount = amount
40
+ @business_profile = business_profile
41
+ @created_at = created_at
42
+ @currency = currency
43
+ @customer = customer
44
+ @customer_email = customer_email
45
+ @customer_phone = customer_phone
46
+ @error_reason = error_reason
47
+ @expires_at = expires_at
48
+ @invoices = invoices
49
+ @metadata = metadata
50
+ @mode = mode
51
+ @next_action = next_action
52
+ @payment_method = payment_method
53
+ @payment_type = payment_type
54
+ @payment_type_options = payment_type_options
55
+ @recipient_account = recipient_account
56
+ @reference_id = reference_id
57
+ @sender_account = sender_account
58
+ @status = status
59
+ @transaction_date = transaction_date
60
+ @widget_token = widget_token
61
+ end
62
+
63
+ def to_s
64
+ "Payment intent (#{@id}) - #{@status}"
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,37 @@
1
+ module Fintoc
2
+ module V2
3
+ class PaymentMethod
4
+ attr_reader :id, :object, :bank_transfer, :created_at, :customer, :mode, :type, :card,
5
+ :mx_direct_debit, :pac
6
+
7
+ def initialize(
8
+ id: nil,
9
+ object: nil,
10
+ bank_transfer: nil,
11
+ created_at: nil,
12
+ customer: nil,
13
+ mode: nil,
14
+ type: nil,
15
+ card: nil,
16
+ mx_direct_debit: nil,
17
+ pac: nil,
18
+ **
19
+ )
20
+ @id = id
21
+ @object = object
22
+ @bank_transfer = bank_transfer
23
+ @created_at = created_at
24
+ @customer = customer
25
+ @mode = mode
26
+ @type = type
27
+ @card = card
28
+ @mx_direct_debit = mx_direct_debit
29
+ @pac = pac
30
+ end
31
+
32
+ def to_s
33
+ "Payment method (#{@id})"
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,32 @@
1
+ module Fintoc
2
+ module V2
3
+ class Product
4
+ attr_reader :id, :object, :created_at, :description, :image_url, :metadata, :mode, :name
5
+
6
+ def initialize(
7
+ id:,
8
+ object:,
9
+ created_at: nil,
10
+ description: nil,
11
+ image_url: nil,
12
+ metadata: nil,
13
+ mode: nil,
14
+ name: nil,
15
+ **
16
+ )
17
+ @id = id
18
+ @object = object
19
+ @created_at = created_at
20
+ @description = description
21
+ @image_url = image_url
22
+ @metadata = metadata
23
+ @mode = mode
24
+ @name = name
25
+ end
26
+
27
+ def to_s
28
+ "Product (#{@id})"
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,62 @@
1
+ module Fintoc
2
+ module V2
3
+ class Recipient
4
+ attr_reader :id, :object, :account_number, :account_type, :alias, :created_at,
5
+ :email, :holder_id, :holder_name, :holder_type, :updated_at, :institution
6
+
7
+ def initialize(
8
+ id:, object:, account_number:, account_type:, holder_name:, institution:,
9
+ created_at: nil, email: nil, holder_id: nil, holder_type: nil,
10
+ updated_at: nil, client: nil, **attributes
11
+ )
12
+ @id = id
13
+ @object = object
14
+ @account_number = account_number
15
+ @account_type = account_type
16
+ @alias = attributes[:alias]
17
+ @created_at = created_at
18
+ @email = email
19
+ @holder_id = holder_id
20
+ @holder_name = holder_name
21
+ @holder_type = holder_type
22
+ @updated_at = updated_at
23
+ @institution = institution
24
+ @client = client
25
+ end
26
+
27
+ def refresh
28
+ refresh_from_recipient(@client.recipients.get(@id))
29
+ end
30
+
31
+ def update(idempotency_key: nil, **params)
32
+ refresh_from_recipient(@client.recipients.update(@id, idempotency_key:, **params))
33
+ end
34
+
35
+ def delete
36
+ @client.recipients.delete(@id)
37
+ end
38
+
39
+ private
40
+
41
+ def refresh_from_recipient(recipient)
42
+ unless recipient.id == @id
43
+ raise ArgumentError, 'Recipient must be the same instance'
44
+ end
45
+
46
+ @object = recipient.object
47
+ @account_number = recipient.account_number
48
+ @account_type = recipient.account_type
49
+ @alias = recipient.alias
50
+ @created_at = recipient.created_at
51
+ @email = recipient.email
52
+ @holder_id = recipient.holder_id
53
+ @holder_name = recipient.holder_name
54
+ @holder_type = recipient.holder_type
55
+ @updated_at = recipient.updated_at
56
+ @institution = recipient.institution
57
+
58
+ self
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,30 @@
1
+ module Fintoc
2
+ module V2
3
+ class SettlementAccount
4
+ attr_reader :id, :object, :account_number, :account_type, :entity_id, :institution_id, :mode
5
+
6
+ def initialize(
7
+ id:,
8
+ object:,
9
+ account_number: nil,
10
+ account_type: nil,
11
+ entity_id: nil,
12
+ institution_id: nil,
13
+ mode: nil,
14
+ **
15
+ )
16
+ @id = id
17
+ @object = object
18
+ @account_number = account_number
19
+ @account_type = account_type
20
+ @entity_id = entity_id
21
+ @institution_id = institution_id
22
+ @mode = mode
23
+ end
24
+
25
+ def to_s
26
+ "Settlement account (#{@id})"
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,24 @@
1
+ module Fintoc
2
+ module V2
3
+ class SetupIntent
4
+ attr_reader :id, :object, :error_reason, :status
5
+
6
+ def initialize(
7
+ id:,
8
+ object:,
9
+ error_reason: nil,
10
+ status: nil,
11
+ **
12
+ )
13
+ @id = id
14
+ @object = object
15
+ @error_reason = error_reason
16
+ @status = status
17
+ end
18
+
19
+ def to_s
20
+ "Setup intent (#{@id}) - #{@status}"
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,51 @@
1
+ require 'fintoc/v2/managers/subscription_items_manager'
2
+
3
+ module Fintoc
4
+ module V2
5
+ class Subscription
6
+ attr_reader :id, :object, :billing_cycle_anchor, :cancel_at, :collection_method, :created_at,
7
+ :customer, :items, :metadata, :mode, :payment_method, :status, :trial_end
8
+
9
+ def initialize(
10
+ id:,
11
+ object:,
12
+ billing_cycle_anchor: nil,
13
+ cancel_at: nil,
14
+ collection_method: nil,
15
+ created_at: nil,
16
+ customer: nil,
17
+ items: nil,
18
+ metadata: nil,
19
+ mode: nil,
20
+ payment_method: nil,
21
+ status: nil,
22
+ trial_end: nil,
23
+ client: nil,
24
+ **
25
+ )
26
+ @id = id
27
+ @object = object
28
+ @billing_cycle_anchor = billing_cycle_anchor
29
+ @cancel_at = cancel_at
30
+ @collection_method = collection_method
31
+ @created_at = created_at
32
+ @customer = customer
33
+ @items = items
34
+ @metadata = metadata
35
+ @mode = mode
36
+ @payment_method = payment_method
37
+ @status = status
38
+ @trial_end = trial_end
39
+ @client = client
40
+ end
41
+
42
+ def to_s
43
+ "Subscription (#{@id}) - #{@status}"
44
+ end
45
+
46
+ def subscription_items
47
+ @subscription_items ||= Managers::SubscriptionItemsManager.new(@client, @id)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,24 @@
1
+ module Fintoc
2
+ module V2
3
+ class SubscriptionItem
4
+ attr_reader :id, :object, :price, :quantity
5
+
6
+ def initialize(
7
+ id:,
8
+ object:,
9
+ price: nil,
10
+ quantity: nil,
11
+ **
12
+ )
13
+ @id = id
14
+ @object = object
15
+ @price = price
16
+ @quantity = quantity
17
+ end
18
+
19
+ def to_s
20
+ "Subscription item (#{@id})"
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Fintoc
2
- VERSION = '1.5.0'
2
+ VERSION = '1.7.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.5.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Ca Sardin
@@ -83,13 +83,43 @@ files:
83
83
  - lib/fintoc/jws.rb
84
84
  - lib/fintoc/utils.rb
85
85
  - lib/fintoc/v1/client/client.rb
86
+ - lib/fintoc/v1/managers/accounts_manager.rb
87
+ - lib/fintoc/v1/managers/charges_manager.rb
88
+ - lib/fintoc/v1/managers/disputes_manager.rb
89
+ - lib/fintoc/v1/managers/institutions_manager.rb
90
+ - lib/fintoc/v1/managers/invoices_manager.rb
91
+ - lib/fintoc/v1/managers/link_intents_manager.rb
86
92
  - lib/fintoc/v1/managers/links_manager.rb
93
+ - lib/fintoc/v1/managers/movements_manager.rb
94
+ - lib/fintoc/v1/managers/payment_intents_manager.rb
95
+ - lib/fintoc/v1/managers/payment_links_manager.rb
96
+ - lib/fintoc/v1/managers/payouts_manager.rb
97
+ - lib/fintoc/v1/managers/refresh_intents_manager.rb
98
+ - lib/fintoc/v1/managers/refunds_manager.rb
99
+ - lib/fintoc/v1/managers/subscription_intents_manager.rb
100
+ - lib/fintoc/v1/managers/subscriptions_manager.rb
101
+ - lib/fintoc/v1/managers/tax_returns_manager.rb
102
+ - lib/fintoc/v1/managers/tax_statements_manager.rb
87
103
  - lib/fintoc/v1/managers/webhook_endpoints_manager.rb
88
104
  - lib/fintoc/v1/resources/account.rb
89
105
  - lib/fintoc/v1/resources/balance.rb
106
+ - lib/fintoc/v1/resources/charge.rb
107
+ - lib/fintoc/v1/resources/dispute.rb
108
+ - lib/fintoc/v1/resources/dispute_document.rb
90
109
  - lib/fintoc/v1/resources/institution.rb
110
+ - lib/fintoc/v1/resources/invoice.rb
91
111
  - lib/fintoc/v1/resources/link.rb
112
+ - lib/fintoc/v1/resources/link_intent.rb
92
113
  - lib/fintoc/v1/resources/movement.rb
114
+ - lib/fintoc/v1/resources/payment_intent.rb
115
+ - lib/fintoc/v1/resources/payment_link.rb
116
+ - lib/fintoc/v1/resources/payout.rb
117
+ - lib/fintoc/v1/resources/refresh_intent.rb
118
+ - lib/fintoc/v1/resources/refund.rb
119
+ - lib/fintoc/v1/resources/subscription.rb
120
+ - lib/fintoc/v1/resources/subscription_intent.rb
121
+ - lib/fintoc/v1/resources/tax_return.rb
122
+ - lib/fintoc/v1/resources/tax_statement.rb
93
123
  - lib/fintoc/v1/resources/transfer_account.rb
94
124
  - lib/fintoc/v1/resources/webhook_endpoint.rb
95
125
  - lib/fintoc/v2/client/client.rb
@@ -97,19 +127,44 @@ files:
97
127
  - lib/fintoc/v2/managers/account_statements_manager.rb
98
128
  - lib/fintoc/v2/managers/account_verifications_manager.rb
99
129
  - lib/fintoc/v2/managers/accounts_manager.rb
130
+ - lib/fintoc/v2/managers/checkout_sessions_manager.rb
131
+ - lib/fintoc/v2/managers/customers_manager.rb
100
132
  - lib/fintoc/v2/managers/entities_manager.rb
133
+ - lib/fintoc/v2/managers/events_manager.rb
134
+ - lib/fintoc/v2/managers/invoice_lines_manager.rb
135
+ - lib/fintoc/v2/managers/invoices_manager.rb
101
136
  - lib/fintoc/v2/managers/movements_manager.rb
102
137
  - lib/fintoc/v2/managers/onboardings_manager.rb
138
+ - lib/fintoc/v2/managers/payment_intents_manager.rb
139
+ - lib/fintoc/v2/managers/payment_methods_manager.rb
140
+ - lib/fintoc/v2/managers/products_manager.rb
141
+ - lib/fintoc/v2/managers/recipients_manager.rb
142
+ - lib/fintoc/v2/managers/setup_intents_manager.rb
103
143
  - lib/fintoc/v2/managers/simulate_manager.rb
144
+ - lib/fintoc/v2/managers/subscription_items_manager.rb
145
+ - lib/fintoc/v2/managers/subscriptions_manager.rb
104
146
  - lib/fintoc/v2/managers/transfer_batches_manager.rb
105
147
  - lib/fintoc/v2/managers/transfers_manager.rb
106
148
  - lib/fintoc/v2/resources/account.rb
107
149
  - lib/fintoc/v2/resources/account_number.rb
108
150
  - lib/fintoc/v2/resources/account_statement.rb
109
151
  - lib/fintoc/v2/resources/account_verification.rb
152
+ - lib/fintoc/v2/resources/checkout_session.rb
153
+ - lib/fintoc/v2/resources/customer.rb
110
154
  - lib/fintoc/v2/resources/entity.rb
155
+ - lib/fintoc/v2/resources/event.rb
156
+ - lib/fintoc/v2/resources/invoice.rb
157
+ - lib/fintoc/v2/resources/invoice_line.rb
111
158
  - lib/fintoc/v2/resources/movement.rb
112
159
  - lib/fintoc/v2/resources/onboarding.rb
160
+ - lib/fintoc/v2/resources/payment_intent.rb
161
+ - lib/fintoc/v2/resources/payment_method.rb
162
+ - lib/fintoc/v2/resources/product.rb
163
+ - lib/fintoc/v2/resources/recipient.rb
164
+ - lib/fintoc/v2/resources/settlement_account.rb
165
+ - lib/fintoc/v2/resources/setup_intent.rb
166
+ - lib/fintoc/v2/resources/subscription.rb
167
+ - lib/fintoc/v2/resources/subscription_item.rb
113
168
  - lib/fintoc/v2/resources/transfer.rb
114
169
  - lib/fintoc/v2/resources/transfer_batch.rb
115
170
  - lib/fintoc/version.rb