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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +109 -4
- data/fintoc.gemspec +3 -3
- data/lib/fintoc/base_client.rb +8 -4
- data/lib/fintoc/errors.rb +67 -0
- data/lib/fintoc/v1/client/client.rb +80 -0
- data/lib/fintoc/v1/managers/accounts_manager.rb +30 -0
- data/lib/fintoc/v1/managers/charges_manager.rb +48 -0
- data/lib/fintoc/v1/managers/disputes_manager.rb +43 -0
- data/lib/fintoc/v1/managers/institutions_manager.rb +19 -0
- data/lib/fintoc/v1/managers/invoices_manager.rb +30 -0
- data/lib/fintoc/v1/managers/link_intents_manager.rb +25 -0
- data/lib/fintoc/v1/managers/links_manager.rb +17 -0
- data/lib/fintoc/v1/managers/movements_manager.rb +31 -0
- data/lib/fintoc/v1/managers/payment_intents_manager.rb +42 -0
- data/lib/fintoc/v1/managers/payment_links_manager.rb +42 -0
- data/lib/fintoc/v1/managers/payouts_manager.rb +50 -0
- data/lib/fintoc/v1/managers/refresh_intents_manager.rb +39 -0
- data/lib/fintoc/v1/managers/refunds_manager.rb +47 -0
- data/lib/fintoc/v1/managers/subscription_intents_manager.rb +36 -0
- data/lib/fintoc/v1/managers/subscriptions_manager.rb +30 -0
- data/lib/fintoc/v1/managers/tax_returns_manager.rb +30 -0
- data/lib/fintoc/v1/managers/tax_statements_manager.rb +30 -0
- data/lib/fintoc/v1/managers/webhook_endpoints_manager.rb +1 -2
- data/lib/fintoc/v1/resources/account.rb +9 -2
- data/lib/fintoc/v1/resources/charge.rb +39 -0
- data/lib/fintoc/v1/resources/dispute.rb +41 -0
- data/lib/fintoc/v1/resources/dispute_document.rb +30 -0
- data/lib/fintoc/v1/resources/institution.rb +4 -2
- data/lib/fintoc/v1/resources/invoice.rb +43 -0
- data/lib/fintoc/v1/resources/link.rb +2 -2
- data/lib/fintoc/v1/resources/link_intent.rb +39 -0
- data/lib/fintoc/v1/resources/payment_intent.rb +72 -0
- data/lib/fintoc/v1/resources/payment_link.rb +43 -0
- data/lib/fintoc/v1/resources/payout.rb +37 -0
- data/lib/fintoc/v1/resources/refresh_intent.rb +37 -0
- data/lib/fintoc/v1/resources/refund.rb +43 -0
- data/lib/fintoc/v1/resources/subscription.rb +30 -0
- data/lib/fintoc/v1/resources/subscription_intent.rb +39 -0
- data/lib/fintoc/v1/resources/tax_return.rb +33 -0
- data/lib/fintoc/v1/resources/tax_statement.rb +39 -0
- data/lib/fintoc/v1/resources/webhook_endpoint.rb +10 -4
- data/lib/fintoc/v2/client/client.rb +50 -0
- data/lib/fintoc/v2/managers/checkout_sessions_manager.rb +42 -0
- data/lib/fintoc/v2/managers/customers_manager.rb +36 -0
- data/lib/fintoc/v2/managers/entities_manager.rb +6 -0
- data/lib/fintoc/v2/managers/events_manager.rb +30 -0
- data/lib/fintoc/v2/managers/invoice_lines_manager.rb +30 -0
- data/lib/fintoc/v2/managers/invoices_manager.rb +78 -0
- data/lib/fintoc/v2/managers/onboardings_manager.rb +14 -0
- data/lib/fintoc/v2/managers/payment_intents_manager.rb +53 -0
- data/lib/fintoc/v2/managers/payment_methods_manager.rb +68 -0
- data/lib/fintoc/v2/managers/products_manager.rb +42 -0
- data/lib/fintoc/v2/managers/recipients_manager.rb +47 -0
- data/lib/fintoc/v2/managers/setup_intents_manager.rb +24 -0
- data/lib/fintoc/v2/managers/subscription_items_manager.rb +41 -0
- data/lib/fintoc/v2/managers/subscriptions_manager.rb +54 -0
- data/lib/fintoc/v2/managers/transfers_manager.rb +4 -0
- data/lib/fintoc/v2/resources/checkout_session.rb +81 -0
- data/lib/fintoc/v2/resources/customer.rb +37 -0
- data/lib/fintoc/v2/resources/entity.rb +5 -1
- data/lib/fintoc/v2/resources/event.rb +28 -0
- data/lib/fintoc/v2/resources/invoice.rb +63 -0
- data/lib/fintoc/v2/resources/invoice_line.rb +35 -0
- data/lib/fintoc/v2/resources/payment_intent.rb +68 -0
- data/lib/fintoc/v2/resources/payment_method.rb +37 -0
- data/lib/fintoc/v2/resources/product.rb +32 -0
- data/lib/fintoc/v2/resources/recipient.rb +62 -0
- data/lib/fintoc/v2/resources/settlement_account.rb +30 -0
- data/lib/fintoc/v2/resources/setup_intent.rb +24 -0
- data/lib/fintoc/v2/resources/subscription.rb +51 -0
- data/lib/fintoc/v2/resources/subscription_item.rb +24 -0
- data/lib/fintoc/version.rb +1 -1
- metadata +56 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
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, :split,
|
|
8
|
+
:split_applied, :status, :transaction_date, :widget_token
|
|
9
|
+
|
|
10
|
+
def initialize( # rubocop:disable Metrics/AbcSize, 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
|
+
split: nil,
|
|
33
|
+
split_applied: nil,
|
|
34
|
+
status: nil,
|
|
35
|
+
transaction_date: nil,
|
|
36
|
+
widget_token: nil,
|
|
37
|
+
**
|
|
38
|
+
)
|
|
39
|
+
@id = id
|
|
40
|
+
@object = object
|
|
41
|
+
@amount = amount
|
|
42
|
+
@business_profile = business_profile
|
|
43
|
+
@created_at = created_at
|
|
44
|
+
@currency = currency
|
|
45
|
+
@customer = customer
|
|
46
|
+
@customer_email = customer_email
|
|
47
|
+
@customer_phone = customer_phone
|
|
48
|
+
@error_reason = error_reason
|
|
49
|
+
@expires_at = expires_at
|
|
50
|
+
@invoices = invoices
|
|
51
|
+
@metadata = metadata
|
|
52
|
+
@mode = mode
|
|
53
|
+
@next_action = next_action
|
|
54
|
+
@payment_method = payment_method
|
|
55
|
+
@payment_type = payment_type
|
|
56
|
+
@payment_type_options = payment_type_options
|
|
57
|
+
@recipient_account = recipient_account
|
|
58
|
+
@reference_id = reference_id
|
|
59
|
+
@sender_account = sender_account
|
|
60
|
+
@split = split
|
|
61
|
+
@split_applied = split_applied
|
|
62
|
+
@status = status
|
|
63
|
+
@transaction_date = transaction_date
|
|
64
|
+
@widget_token = widget_token
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def to_s
|
|
68
|
+
"Payment intent (#{@id}) - #{@status}"
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class PaymentLink
|
|
4
|
+
attr_reader :id, :object, :amount, :checkout, :created_at, :currency, :customer_email,
|
|
5
|
+
:expires_at, :metadata, :mode, :recipient_account, :status, :url
|
|
6
|
+
|
|
7
|
+
def initialize(
|
|
8
|
+
id:,
|
|
9
|
+
object:,
|
|
10
|
+
amount: nil,
|
|
11
|
+
checkout: nil,
|
|
12
|
+
created_at: nil,
|
|
13
|
+
currency: nil,
|
|
14
|
+
customer_email: nil,
|
|
15
|
+
expires_at: nil,
|
|
16
|
+
metadata: nil,
|
|
17
|
+
mode: nil,
|
|
18
|
+
recipient_account: nil,
|
|
19
|
+
status: nil,
|
|
20
|
+
url: nil,
|
|
21
|
+
**
|
|
22
|
+
)
|
|
23
|
+
@id = id
|
|
24
|
+
@object = object
|
|
25
|
+
@amount = amount
|
|
26
|
+
@checkout = checkout
|
|
27
|
+
@created_at = created_at
|
|
28
|
+
@currency = currency
|
|
29
|
+
@customer_email = customer_email
|
|
30
|
+
@expires_at = expires_at
|
|
31
|
+
@metadata = metadata
|
|
32
|
+
@mode = mode
|
|
33
|
+
@recipient_account = recipient_account
|
|
34
|
+
@status = status
|
|
35
|
+
@url = url
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def to_s
|
|
39
|
+
"Payment link (#{@id}) - #{@status}"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class Payout
|
|
4
|
+
attr_reader :id, :object, :amount, :created_at, :currency, :mode, :recipient_account, :status,
|
|
5
|
+
:succeeded_at, :updated_at
|
|
6
|
+
|
|
7
|
+
def initialize(
|
|
8
|
+
id:,
|
|
9
|
+
object:,
|
|
10
|
+
amount: nil,
|
|
11
|
+
created_at: nil,
|
|
12
|
+
currency: nil,
|
|
13
|
+
mode: nil,
|
|
14
|
+
recipient_account: nil,
|
|
15
|
+
status: nil,
|
|
16
|
+
succeeded_at: nil,
|
|
17
|
+
updated_at: nil,
|
|
18
|
+
**
|
|
19
|
+
)
|
|
20
|
+
@id = id
|
|
21
|
+
@object = object
|
|
22
|
+
@amount = amount
|
|
23
|
+
@created_at = created_at
|
|
24
|
+
@currency = currency
|
|
25
|
+
@mode = mode
|
|
26
|
+
@recipient_account = recipient_account
|
|
27
|
+
@status = status
|
|
28
|
+
@succeeded_at = succeeded_at
|
|
29
|
+
@updated_at = updated_at
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def to_s
|
|
33
|
+
"Payout (#{@id}) - #{@status}"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class RefreshIntent
|
|
4
|
+
attr_reader :id, :object, :created_at, :new_movements, :public_error, :refreshed_object,
|
|
5
|
+
:refreshed_object_id, :requires_mfa, :status, :type
|
|
6
|
+
|
|
7
|
+
def initialize(
|
|
8
|
+
id:,
|
|
9
|
+
object:,
|
|
10
|
+
created_at: nil,
|
|
11
|
+
new_movements: nil,
|
|
12
|
+
public_error: nil,
|
|
13
|
+
refreshed_object: nil,
|
|
14
|
+
refreshed_object_id: nil,
|
|
15
|
+
requires_mfa: nil,
|
|
16
|
+
status: nil,
|
|
17
|
+
type: nil,
|
|
18
|
+
**
|
|
19
|
+
)
|
|
20
|
+
@id = id
|
|
21
|
+
@object = object
|
|
22
|
+
@created_at = created_at
|
|
23
|
+
@new_movements = new_movements
|
|
24
|
+
@public_error = public_error
|
|
25
|
+
@refreshed_object = refreshed_object
|
|
26
|
+
@refreshed_object_id = refreshed_object_id
|
|
27
|
+
@requires_mfa = requires_mfa
|
|
28
|
+
@status = status
|
|
29
|
+
@type = type
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def to_s
|
|
33
|
+
"Refresh intent (#{@id}) - #{@status}"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class Refund
|
|
4
|
+
attr_reader :id, :object, :amount, :created_at, :currency, :failure_code, :metadata, :mode,
|
|
5
|
+
:recipient_account, :resource_id, :resource_type, :status, :updated_at
|
|
6
|
+
|
|
7
|
+
def initialize(
|
|
8
|
+
id:,
|
|
9
|
+
object:,
|
|
10
|
+
amount: nil,
|
|
11
|
+
created_at: nil,
|
|
12
|
+
currency: nil,
|
|
13
|
+
failure_code: nil,
|
|
14
|
+
metadata: nil,
|
|
15
|
+
mode: nil,
|
|
16
|
+
recipient_account: nil,
|
|
17
|
+
resource_id: nil,
|
|
18
|
+
resource_type: nil,
|
|
19
|
+
status: nil,
|
|
20
|
+
updated_at: nil,
|
|
21
|
+
**
|
|
22
|
+
)
|
|
23
|
+
@id = id
|
|
24
|
+
@object = object
|
|
25
|
+
@amount = amount
|
|
26
|
+
@created_at = created_at
|
|
27
|
+
@currency = currency
|
|
28
|
+
@failure_code = failure_code
|
|
29
|
+
@metadata = metadata
|
|
30
|
+
@mode = mode
|
|
31
|
+
@recipient_account = recipient_account
|
|
32
|
+
@resource_id = resource_id
|
|
33
|
+
@resource_type = resource_type
|
|
34
|
+
@status = status
|
|
35
|
+
@updated_at = updated_at
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def to_s
|
|
39
|
+
"Refund (#{@id}) - #{@status}"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class Subscription
|
|
4
|
+
attr_reader :id, :object, :account, :created_at, :mode, :reference_id, :status
|
|
5
|
+
|
|
6
|
+
def initialize(
|
|
7
|
+
id:,
|
|
8
|
+
object:,
|
|
9
|
+
account: nil,
|
|
10
|
+
created_at: nil,
|
|
11
|
+
mode: nil,
|
|
12
|
+
reference_id: nil,
|
|
13
|
+
status: nil,
|
|
14
|
+
**
|
|
15
|
+
)
|
|
16
|
+
@id = id
|
|
17
|
+
@object = object
|
|
18
|
+
@account = account
|
|
19
|
+
@created_at = created_at
|
|
20
|
+
@mode = mode
|
|
21
|
+
@reference_id = reference_id
|
|
22
|
+
@status = status
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_s
|
|
26
|
+
"Subscription (#{@id}) - #{@status}"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class SubscriptionIntent
|
|
4
|
+
attr_reader :id, :object, :business_profile, :created_at, :customer_email, :mode,
|
|
5
|
+
:public_error, :reference_id, :status, :subscription, :widget_token
|
|
6
|
+
|
|
7
|
+
def initialize(
|
|
8
|
+
id:,
|
|
9
|
+
object:,
|
|
10
|
+
business_profile: nil,
|
|
11
|
+
created_at: nil,
|
|
12
|
+
customer_email: nil,
|
|
13
|
+
mode: nil,
|
|
14
|
+
public_error: nil,
|
|
15
|
+
reference_id: nil,
|
|
16
|
+
status: nil,
|
|
17
|
+
subscription: nil,
|
|
18
|
+
widget_token: nil,
|
|
19
|
+
**
|
|
20
|
+
)
|
|
21
|
+
@id = id
|
|
22
|
+
@object = object
|
|
23
|
+
@business_profile = business_profile
|
|
24
|
+
@created_at = created_at
|
|
25
|
+
@customer_email = customer_email
|
|
26
|
+
@mode = mode
|
|
27
|
+
@public_error = public_error
|
|
28
|
+
@reference_id = reference_id
|
|
29
|
+
@status = status
|
|
30
|
+
@subscription = subscription
|
|
31
|
+
@widget_token = widget_token
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def to_s
|
|
35
|
+
"Subscription intent (#{@id}) - #{@status}"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class TaxReturn
|
|
4
|
+
attr_reader :id, :object, :currency, :document_number, :fiscal_year, :institution_id,
|
|
5
|
+
:institution_tax_return, :taxpayer
|
|
6
|
+
|
|
7
|
+
def initialize(
|
|
8
|
+
id:,
|
|
9
|
+
object:,
|
|
10
|
+
currency: nil,
|
|
11
|
+
document_number: nil,
|
|
12
|
+
fiscal_year: nil,
|
|
13
|
+
institution_id: nil,
|
|
14
|
+
institution_tax_return: nil,
|
|
15
|
+
taxpayer: nil,
|
|
16
|
+
**
|
|
17
|
+
)
|
|
18
|
+
@id = id
|
|
19
|
+
@object = object
|
|
20
|
+
@currency = currency
|
|
21
|
+
@document_number = document_number
|
|
22
|
+
@fiscal_year = fiscal_year
|
|
23
|
+
@institution_id = institution_id
|
|
24
|
+
@institution_tax_return = institution_tax_return
|
|
25
|
+
@taxpayer = taxpayer
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def to_s
|
|
29
|
+
"Tax return (#{@id})"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class TaxStatement
|
|
4
|
+
attr_reader :id, :object, :currency, :document_number, :fiscal_year, :institution_id,
|
|
5
|
+
:institution_tax_statement, :interval_unit, :period, :status, :taxpayer
|
|
6
|
+
|
|
7
|
+
def initialize(
|
|
8
|
+
id:,
|
|
9
|
+
object:,
|
|
10
|
+
currency: nil,
|
|
11
|
+
document_number: nil,
|
|
12
|
+
fiscal_year: nil,
|
|
13
|
+
institution_id: nil,
|
|
14
|
+
institution_tax_statement: nil,
|
|
15
|
+
interval_unit: nil,
|
|
16
|
+
period: nil,
|
|
17
|
+
status: nil,
|
|
18
|
+
taxpayer: nil,
|
|
19
|
+
**
|
|
20
|
+
)
|
|
21
|
+
@id = id
|
|
22
|
+
@object = object
|
|
23
|
+
@currency = currency
|
|
24
|
+
@document_number = document_number
|
|
25
|
+
@fiscal_year = fiscal_year
|
|
26
|
+
@institution_id = institution_id
|
|
27
|
+
@institution_tax_statement = institution_tax_statement
|
|
28
|
+
@interval_unit = interval_unit
|
|
29
|
+
@period = period
|
|
30
|
+
@status = status
|
|
31
|
+
@taxpayer = taxpayer
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def to_s
|
|
35
|
+
"Tax statement (#{@id}) - #{@status}"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
module Fintoc
|
|
2
2
|
module V1
|
|
3
3
|
class WebhookEndpoint
|
|
4
|
-
attr_reader :id, :object, :url, :mode, :enabled_events, :secret, :
|
|
4
|
+
attr_reader :id, :object, :url, :mode, :enabled_events, :secret, :status, :description,
|
|
5
|
+
:name, :created_at
|
|
5
6
|
|
|
6
7
|
def initialize(
|
|
7
8
|
id:,
|
|
@@ -10,8 +11,10 @@ module Fintoc
|
|
|
10
11
|
mode:,
|
|
11
12
|
enabled_events:,
|
|
12
13
|
secret:,
|
|
13
|
-
|
|
14
|
+
status:,
|
|
14
15
|
created_at:,
|
|
16
|
+
description: nil,
|
|
17
|
+
name: nil,
|
|
15
18
|
client: nil,
|
|
16
19
|
**
|
|
17
20
|
)
|
|
@@ -21,7 +24,9 @@ module Fintoc
|
|
|
21
24
|
@mode = mode
|
|
22
25
|
@enabled_events = enabled_events
|
|
23
26
|
@secret = secret
|
|
24
|
-
@
|
|
27
|
+
@status = status
|
|
28
|
+
@description = description
|
|
29
|
+
@name = name
|
|
25
30
|
@created_at = created_at
|
|
26
31
|
@client = client
|
|
27
32
|
end
|
|
@@ -31,8 +36,9 @@ module Fintoc
|
|
|
31
36
|
end
|
|
32
37
|
|
|
33
38
|
def disabled?
|
|
34
|
-
@disabled
|
|
39
|
+
@status == 'disabled'
|
|
35
40
|
end
|
|
41
|
+
alias disabled disabled?
|
|
36
42
|
end
|
|
37
43
|
end
|
|
38
44
|
end
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
require 'fintoc/base_client'
|
|
2
2
|
require 'fintoc/v2/managers/entities_manager'
|
|
3
|
+
require 'fintoc/v2/managers/recipients_manager'
|
|
3
4
|
require 'fintoc/v2/managers/accounts_manager'
|
|
4
5
|
require 'fintoc/v2/managers/account_numbers_manager'
|
|
5
6
|
require 'fintoc/v2/managers/transfers_manager'
|
|
6
7
|
require 'fintoc/v2/managers/transfer_batches_manager'
|
|
7
8
|
require 'fintoc/v2/managers/simulate_manager'
|
|
8
9
|
require 'fintoc/v2/managers/account_verifications_manager'
|
|
10
|
+
require 'fintoc/v2/managers/customers_manager'
|
|
11
|
+
require 'fintoc/v2/managers/products_manager'
|
|
12
|
+
require 'fintoc/v2/managers/checkout_sessions_manager'
|
|
13
|
+
require 'fintoc/v2/managers/payment_intents_manager'
|
|
14
|
+
require 'fintoc/v2/managers/payment_methods_manager'
|
|
15
|
+
require 'fintoc/v2/managers/setup_intents_manager'
|
|
16
|
+
require 'fintoc/v2/managers/events_manager'
|
|
17
|
+
require 'fintoc/v2/managers/invoices_manager'
|
|
18
|
+
require 'fintoc/v2/managers/subscriptions_manager'
|
|
9
19
|
|
|
10
20
|
module Fintoc
|
|
11
21
|
module V2
|
|
@@ -14,6 +24,10 @@ module Fintoc
|
|
|
14
24
|
@entities ||= Managers::EntitiesManager.new(self)
|
|
15
25
|
end
|
|
16
26
|
|
|
27
|
+
def recipients
|
|
28
|
+
@recipients ||= Managers::RecipientsManager.new(self)
|
|
29
|
+
end
|
|
30
|
+
|
|
17
31
|
def accounts
|
|
18
32
|
@accounts ||= Managers::AccountsManager.new(self)
|
|
19
33
|
end
|
|
@@ -37,6 +51,42 @@ module Fintoc
|
|
|
37
51
|
def account_verifications
|
|
38
52
|
@account_verifications ||= Managers::AccountVerificationsManager.new(self)
|
|
39
53
|
end
|
|
54
|
+
|
|
55
|
+
def customers
|
|
56
|
+
@customers ||= Managers::CustomersManager.new(self)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def products
|
|
60
|
+
@products ||= Managers::ProductsManager.new(self)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def checkout_sessions
|
|
64
|
+
@checkout_sessions ||= Managers::CheckoutSessionsManager.new(self)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def payment_intents
|
|
68
|
+
@payment_intents ||= Managers::PaymentIntentsManager.new(self)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def payment_methods
|
|
72
|
+
@payment_methods ||= Managers::PaymentMethodsManager.new(self)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def setup_intents
|
|
76
|
+
@setup_intents ||= Managers::SetupIntentsManager.new(self)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def events
|
|
80
|
+
@events ||= Managers::EventsManager.new(self)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def invoices
|
|
84
|
+
@invoices ||= Managers::InvoicesManager.new(self)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def subscriptions
|
|
88
|
+
@subscriptions ||= Managers::SubscriptionsManager.new(self)
|
|
89
|
+
end
|
|
40
90
|
end
|
|
41
91
|
end
|
|
42
92
|
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'fintoc/v2/resources/checkout_session'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V2
|
|
5
|
+
module Managers
|
|
6
|
+
class CheckoutSessionsManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(currency:, idempotency_key: nil, **params)
|
|
12
|
+
data = @client.post(version: :v2, idempotency_key:)
|
|
13
|
+
.call('checkout_sessions', currency:, **params)
|
|
14
|
+
build_checkout_session(data)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def list(**params)
|
|
18
|
+
@client.get(version: :v2).call('checkout_sessions', **params).map do |data|
|
|
19
|
+
build_checkout_session(data)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def get(checkout_session_id)
|
|
24
|
+
data = @client.get(version: :v2).call("checkout_sessions/#{checkout_session_id}")
|
|
25
|
+
build_checkout_session(data)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def expire(checkout_session_id, idempotency_key: nil)
|
|
29
|
+
data = @client.post(version: :v2, idempotency_key:)
|
|
30
|
+
.call("checkout_sessions/#{checkout_session_id}/expire")
|
|
31
|
+
build_checkout_session(data)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def build_checkout_session(data)
|
|
37
|
+
Fintoc::V2::CheckoutSession.new(**data)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'fintoc/v2/resources/customer'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V2
|
|
5
|
+
module Managers
|
|
6
|
+
class CustomersManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(idempotency_key: nil, **params)
|
|
12
|
+
data = @client.post(version: :v2, idempotency_key:)
|
|
13
|
+
.call('customers', **params)
|
|
14
|
+
build_customer(data)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def list(**params)
|
|
18
|
+
@client.get(version: :v2).call('customers', **params).map do |data|
|
|
19
|
+
build_customer(data)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def get(customer_id)
|
|
24
|
+
data = @client.get(version: :v2).call("customers/#{customer_id}")
|
|
25
|
+
build_customer(data)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def build_customer(data)
|
|
31
|
+
Fintoc::V2::Customer.new(**data)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'fintoc/v2/resources/entity'
|
|
2
|
+
require 'fintoc/v2/resources/settlement_account'
|
|
2
3
|
|
|
3
4
|
module Fintoc
|
|
4
5
|
module V2
|
|
@@ -22,6 +23,11 @@ module Fintoc
|
|
|
22
23
|
_list_entities(**params).map { |data| build_entity(data) }
|
|
23
24
|
end
|
|
24
25
|
|
|
26
|
+
def settlement_account(entity_id)
|
|
27
|
+
data = @client.get(version: :v2).call("entities/#{entity_id}/settlement_account")
|
|
28
|
+
Fintoc::V2::SettlementAccount.new(**data)
|
|
29
|
+
end
|
|
30
|
+
|
|
25
31
|
private
|
|
26
32
|
|
|
27
33
|
def _create_entity(holder_name:, holder_id:, country_code:, idempotency_key: nil, **params)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'fintoc/v2/resources/event'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V2
|
|
5
|
+
module Managers
|
|
6
|
+
class EventsManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def list(**params)
|
|
12
|
+
@client.get(version: :v2).call('events', **params).map do |data|
|
|
13
|
+
build_event(data)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get(event_id)
|
|
18
|
+
data = @client.get(version: :v2).call("events/#{event_id}")
|
|
19
|
+
build_event(data)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def build_event(data)
|
|
25
|
+
Fintoc::V2::Event.new(**data)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'fintoc/v2/resources/invoice_line'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V2
|
|
5
|
+
module Managers
|
|
6
|
+
class InvoiceLinesManager
|
|
7
|
+
def initialize(client, invoice_id)
|
|
8
|
+
@client = client
|
|
9
|
+
@invoice_id = invoice_id
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def update(invoice_line_id, idempotency_key: nil, **params)
|
|
13
|
+
data = @client.patch(version: :v2, idempotency_key:)
|
|
14
|
+
.call("#{base_path}/#{invoice_line_id}", **params)
|
|
15
|
+
build_invoice_line(data)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def base_path
|
|
21
|
+
"invoices/#{@invoice_id}/lines"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def build_invoice_line(data)
|
|
25
|
+
Fintoc::V2::InvoiceLine.new(**data)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|