fintoc 1.6.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 +6 -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 +45 -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/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/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 +54 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'fintoc/v1/resources/movement'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V1
|
|
5
|
+
module Managers
|
|
6
|
+
class MovementsManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def list(account_id, link_token:, **params)
|
|
12
|
+
@client.get(version: :v1)
|
|
13
|
+
.call("accounts/#{account_id}/movements", link_token:, **params)
|
|
14
|
+
.map { |data| build_movement(data) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get(account_id, movement_id, link_token:)
|
|
18
|
+
data = @client.get(version: :v1)
|
|
19
|
+
.call("accounts/#{account_id}/movements/#{movement_id}", link_token:)
|
|
20
|
+
build_movement(data)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def build_movement(data)
|
|
26
|
+
Fintoc::V1::Movement.new(**data, client: @client)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'fintoc/v1/resources/payment_intent'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V1
|
|
5
|
+
module Managers
|
|
6
|
+
class PaymentIntentsManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(amount:, currency:, idempotency_key: nil, **params)
|
|
12
|
+
data = @client.post(version: :v1, idempotency_key:)
|
|
13
|
+
.call('payment_intents', amount:, currency:, **params)
|
|
14
|
+
build_payment_intent(data)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def list(**params)
|
|
18
|
+
@client.get(version: :v1).call('payment_intents', **params).map do |data|
|
|
19
|
+
build_payment_intent(data)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def get(payment_intent_id)
|
|
24
|
+
data = @client.get(version: :v1).call("payment_intents/#{payment_intent_id}")
|
|
25
|
+
build_payment_intent(data)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def expire(payment_intent_id, idempotency_key: nil)
|
|
29
|
+
data = @client.post(version: :v1, idempotency_key:)
|
|
30
|
+
.call("payment_intents/#{payment_intent_id}/expire")
|
|
31
|
+
build_payment_intent(data)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def build_payment_intent(data)
|
|
37
|
+
Fintoc::V1::PaymentIntent.new(**data)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'fintoc/v1/resources/payment_link'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V1
|
|
5
|
+
module Managers
|
|
6
|
+
class PaymentLinksManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(amount:, currency:, idempotency_key: nil, **params)
|
|
12
|
+
data = @client.post(version: :v1, idempotency_key:)
|
|
13
|
+
.call('payment_links', amount:, currency:, **params)
|
|
14
|
+
build_payment_link(data)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def list(**params)
|
|
18
|
+
@client.get(version: :v1).call('payment_links', **params).map do |data|
|
|
19
|
+
build_payment_link(data)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def get(payment_link_id)
|
|
24
|
+
data = @client.get(version: :v1).call("payment_links/#{payment_link_id}")
|
|
25
|
+
build_payment_link(data)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def cancel(payment_link_id, idempotency_key: nil)
|
|
29
|
+
data = @client.patch(version: :v1, idempotency_key:)
|
|
30
|
+
.call("payment_links/#{payment_link_id}/cancel")
|
|
31
|
+
build_payment_link(data)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def build_payment_link(data)
|
|
37
|
+
Fintoc::V1::PaymentLink.new(**data)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'fintoc/v1/resources/payout'
|
|
2
|
+
require 'fintoc/v1/resources/payment_intent'
|
|
3
|
+
require 'fintoc/v1/resources/charge'
|
|
4
|
+
require 'fintoc/v1/resources/refund'
|
|
5
|
+
|
|
6
|
+
module Fintoc
|
|
7
|
+
module V1
|
|
8
|
+
module Managers
|
|
9
|
+
class PayoutsManager
|
|
10
|
+
RESOURCE_CLASSES = {
|
|
11
|
+
'payment_intent' => Fintoc::V1::PaymentIntent,
|
|
12
|
+
'charge' => Fintoc::V1::Charge,
|
|
13
|
+
'refund' => Fintoc::V1::Refund
|
|
14
|
+
}.freeze
|
|
15
|
+
|
|
16
|
+
def initialize(client)
|
|
17
|
+
@client = client
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def list(**params)
|
|
21
|
+
@client.get(version: :v1).call('payouts', **params).map do |data|
|
|
22
|
+
build_payout(data)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def get(payout_id)
|
|
27
|
+
data = @client.get(version: :v1).call("payouts/#{payout_id}")
|
|
28
|
+
build_payout(data)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def list_resources(payout_id, resource_type:, **params)
|
|
32
|
+
@client.get(version: :v1)
|
|
33
|
+
.call("payouts/#{payout_id}/resources", resource_type:, **params)
|
|
34
|
+
.map { |data| build_resource(data) }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def build_payout(data)
|
|
40
|
+
Fintoc::V1::Payout.new(**data)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def build_resource(data)
|
|
44
|
+
resource_class = RESOURCE_CLASSES[data[:object]]
|
|
45
|
+
resource_class ? resource_class.new(**data) : data
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'uri'
|
|
2
|
+
require 'fintoc/v1/resources/refresh_intent'
|
|
3
|
+
|
|
4
|
+
module Fintoc
|
|
5
|
+
module V1
|
|
6
|
+
module Managers
|
|
7
|
+
class RefreshIntentsManager
|
|
8
|
+
def initialize(client)
|
|
9
|
+
@client = client
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# The API reads every create parameter from the query string, not the body.
|
|
13
|
+
def create(link_token:, idempotency_key: nil, **params)
|
|
14
|
+
query = URI.encode_www_form(link_token:, **params)
|
|
15
|
+
data = @client.post(version: :v1, idempotency_key:).call("refresh_intents?#{query}")
|
|
16
|
+
build_refresh_intent(data)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def list(link_token:, **params)
|
|
20
|
+
@client.get(version: :v1).call('refresh_intents', link_token:, **params).map do |data|
|
|
21
|
+
build_refresh_intent(data)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def get(refresh_intent_id, link_token:)
|
|
26
|
+
data = @client.get(version: :v1)
|
|
27
|
+
.call("refresh_intents/#{refresh_intent_id}", link_token:)
|
|
28
|
+
build_refresh_intent(data)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def build_refresh_intent(data)
|
|
34
|
+
Fintoc::V1::RefreshIntent.new(**data)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require 'fintoc/v1/resources/refund'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V1
|
|
5
|
+
module Managers
|
|
6
|
+
class RefundsManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(resource_id:, resource_type:, idempotency_key: nil, **params)
|
|
12
|
+
data = @client.post(version: :v1, idempotency_key:)
|
|
13
|
+
.call('refunds', resource_id:, resource_type:, **params)
|
|
14
|
+
build_refund(data)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def list(**params)
|
|
18
|
+
@client.get(version: :v1).call('refunds', **params).map do |data|
|
|
19
|
+
build_refund(data)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def get(refund_id)
|
|
24
|
+
data = @client.get(version: :v1).call("refunds/#{refund_id}")
|
|
25
|
+
build_refund(data)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def cancel(refund_id, idempotency_key: nil)
|
|
29
|
+
data = @client.post(version: :v1, idempotency_key:)
|
|
30
|
+
.call("refunds/#{refund_id}/cancel")
|
|
31
|
+
build_refund(data)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def voucher_url(refund_id)
|
|
35
|
+
@client.get(version: :v1)
|
|
36
|
+
.call("refunds/#{refund_id}/voucher_url")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def build_refund(data)
|
|
42
|
+
Fintoc::V1::Refund.new(**data)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'fintoc/v1/resources/subscription_intent'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V1
|
|
5
|
+
module Managers
|
|
6
|
+
class SubscriptionIntentsManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(idempotency_key: nil, **params)
|
|
12
|
+
data = @client.post(version: :v1, idempotency_key:)
|
|
13
|
+
.call('subscription_intents', **params)
|
|
14
|
+
build_subscription_intent(data)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def list(**params)
|
|
18
|
+
@client.get(version: :v1).call('subscription_intents', **params).map do |data|
|
|
19
|
+
build_subscription_intent(data)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def get(subscription_intent_id)
|
|
24
|
+
data = @client.get(version: :v1).call("subscription_intents/#{subscription_intent_id}")
|
|
25
|
+
build_subscription_intent(data)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def build_subscription_intent(data)
|
|
31
|
+
Fintoc::V1::SubscriptionIntent.new(**data)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'fintoc/v1/resources/subscription'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V1
|
|
5
|
+
module Managers
|
|
6
|
+
class SubscriptionsManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def list(**params)
|
|
12
|
+
@client.get(version: :v1).call('subscriptions', **params).map do |data|
|
|
13
|
+
build_subscription(data)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get(subscription_id)
|
|
18
|
+
data = @client.get(version: :v1).call("subscriptions/#{subscription_id}")
|
|
19
|
+
build_subscription(data)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def build_subscription(data)
|
|
25
|
+
Fintoc::V1::Subscription.new(**data)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'fintoc/v1/resources/tax_return'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V1
|
|
5
|
+
module Managers
|
|
6
|
+
class TaxReturnsManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def list(link_token:, **params)
|
|
12
|
+
@client.get(version: :v1).call('tax_returns', link_token:, **params).map do |data|
|
|
13
|
+
build_tax_return(data)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get(tax_return_id, link_token:)
|
|
18
|
+
data = @client.get(version: :v1).call("tax_returns/#{tax_return_id}", link_token:)
|
|
19
|
+
build_tax_return(data)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def build_tax_return(data)
|
|
25
|
+
Fintoc::V1::TaxReturn.new(**data)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'fintoc/v1/resources/tax_statement'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V1
|
|
5
|
+
module Managers
|
|
6
|
+
class TaxStatementsManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def list(link_token:, **params)
|
|
12
|
+
@client.get(version: :v1).call('tax_statements', link_token:, **params).map do |data|
|
|
13
|
+
build_tax_statement(data)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get(tax_statement_id, link_token:)
|
|
18
|
+
data = @client.get(version: :v1).call("tax_statements/#{tax_statement_id}", link_token:)
|
|
19
|
+
build_tax_statement(data)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def build_tax_statement(data)
|
|
25
|
+
Fintoc::V1::TaxStatement.new(**data)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -25,6 +25,7 @@ module Fintoc
|
|
|
25
25
|
refreshed_at: nil,
|
|
26
26
|
balance: nil,
|
|
27
27
|
movements: nil,
|
|
28
|
+
link_token: nil,
|
|
28
29
|
client: nil,
|
|
29
30
|
**
|
|
30
31
|
)
|
|
@@ -39,6 +40,7 @@ module Fintoc
|
|
|
39
40
|
@refreshed_at = DateTime.iso8601(refreshed_at) if refreshed_at
|
|
40
41
|
@balance = Fintoc::V1::Balance.new(**balance)
|
|
41
42
|
@movements = movements || []
|
|
43
|
+
@link_token = link_token
|
|
42
44
|
@client = client
|
|
43
45
|
end
|
|
44
46
|
|
|
@@ -81,15 +83,20 @@ module Fintoc
|
|
|
81
83
|
private
|
|
82
84
|
|
|
83
85
|
def get_account
|
|
84
|
-
@client.get(version: :v1).call("accounts/#{@id}")
|
|
86
|
+
@client.get(version: :v1).call("accounts/#{@id}", **link_token_param)
|
|
85
87
|
end
|
|
86
88
|
|
|
87
89
|
def _get_movements(**params)
|
|
88
|
-
first = @client.get(version: :v1)
|
|
90
|
+
first = @client.get(version: :v1)
|
|
91
|
+
.call("accounts/#{@id}/movements", **link_token_param, **params)
|
|
89
92
|
return first if params.empty?
|
|
90
93
|
|
|
91
94
|
first + Utils.flatten(@client.fetch_next)
|
|
92
95
|
end
|
|
96
|
+
|
|
97
|
+
def link_token_param
|
|
98
|
+
@link_token ? { link_token: @link_token } : {}
|
|
99
|
+
end
|
|
93
100
|
end
|
|
94
101
|
end
|
|
95
102
|
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class Charge
|
|
4
|
+
attr_reader :id, :object, :amount, :created_at, :currency, :failure_code, :metadata, :mode,
|
|
5
|
+
:recipient_account, :status, :subscription_id
|
|
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
|
+
status: nil,
|
|
18
|
+
subscription_id: nil,
|
|
19
|
+
**
|
|
20
|
+
)
|
|
21
|
+
@id = id
|
|
22
|
+
@object = object
|
|
23
|
+
@amount = amount
|
|
24
|
+
@created_at = created_at
|
|
25
|
+
@currency = currency
|
|
26
|
+
@failure_code = failure_code
|
|
27
|
+
@metadata = metadata
|
|
28
|
+
@mode = mode
|
|
29
|
+
@recipient_account = recipient_account
|
|
30
|
+
@status = status
|
|
31
|
+
@subscription_id = subscription_id
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def to_s
|
|
35
|
+
"Charge (#{@id}) - #{@status}"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class Dispute
|
|
4
|
+
attr_reader :id, :object, :amount, :created_at, :currency, :documentation_upload_deadline,
|
|
5
|
+
:documents, :mode, :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
|
+
documentation_upload_deadline: nil,
|
|
14
|
+
documents: nil,
|
|
15
|
+
mode: nil,
|
|
16
|
+
resource_id: nil,
|
|
17
|
+
resource_type: nil,
|
|
18
|
+
status: nil,
|
|
19
|
+
updated_at: nil,
|
|
20
|
+
**
|
|
21
|
+
)
|
|
22
|
+
@id = id
|
|
23
|
+
@object = object
|
|
24
|
+
@amount = amount
|
|
25
|
+
@created_at = created_at
|
|
26
|
+
@currency = currency
|
|
27
|
+
@documentation_upload_deadline = documentation_upload_deadline
|
|
28
|
+
@documents = documents
|
|
29
|
+
@mode = mode
|
|
30
|
+
@resource_id = resource_id
|
|
31
|
+
@resource_type = resource_type
|
|
32
|
+
@status = status
|
|
33
|
+
@updated_at = updated_at
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def to_s
|
|
37
|
+
"Dispute (#{@id}) - #{@status}"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class DisputeDocument
|
|
4
|
+
attr_reader :id, :object, :content_type, :created_at, :dispute_id, :filename, :size
|
|
5
|
+
|
|
6
|
+
def initialize(
|
|
7
|
+
id:,
|
|
8
|
+
object:,
|
|
9
|
+
content_type: nil,
|
|
10
|
+
created_at: nil,
|
|
11
|
+
dispute_id: nil,
|
|
12
|
+
filename: nil,
|
|
13
|
+
size: nil,
|
|
14
|
+
**
|
|
15
|
+
)
|
|
16
|
+
@id = id
|
|
17
|
+
@object = object
|
|
18
|
+
@content_type = content_type
|
|
19
|
+
@created_at = created_at
|
|
20
|
+
@dispute_id = dispute_id
|
|
21
|
+
@filename = filename
|
|
22
|
+
@size = size
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_s
|
|
26
|
+
"Dispute document (#{@id})"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
module Fintoc
|
|
2
2
|
module V1
|
|
3
3
|
class Institution
|
|
4
|
-
attr_reader :id, :name, :country
|
|
4
|
+
attr_reader :id, :name, :country, :type, :products
|
|
5
5
|
|
|
6
|
-
def initialize(id:, name:, country:, **)
|
|
6
|
+
def initialize(id:, name:, country:, type: nil, products: nil, **)
|
|
7
7
|
@id = id
|
|
8
8
|
@name = name
|
|
9
9
|
@country = country
|
|
10
|
+
@type = type
|
|
11
|
+
@products = products
|
|
10
12
|
end
|
|
11
13
|
|
|
12
14
|
def to_s
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class Invoice
|
|
4
|
+
attr_reader :id, :object, :currency, :date, :institution_id, :institution_invoice,
|
|
5
|
+
:issue_type, :issuer, :net_amount, :number, :receiver, :tax_period, :total_amount
|
|
6
|
+
|
|
7
|
+
def initialize(
|
|
8
|
+
id:,
|
|
9
|
+
object:,
|
|
10
|
+
currency: nil,
|
|
11
|
+
date: nil,
|
|
12
|
+
institution_id: nil,
|
|
13
|
+
institution_invoice: nil,
|
|
14
|
+
issue_type: nil,
|
|
15
|
+
issuer: nil,
|
|
16
|
+
net_amount: nil,
|
|
17
|
+
number: nil,
|
|
18
|
+
receiver: nil,
|
|
19
|
+
tax_period: nil,
|
|
20
|
+
total_amount: nil,
|
|
21
|
+
**
|
|
22
|
+
)
|
|
23
|
+
@id = id
|
|
24
|
+
@object = object
|
|
25
|
+
@currency = currency
|
|
26
|
+
@date = date
|
|
27
|
+
@institution_id = institution_id
|
|
28
|
+
@institution_invoice = institution_invoice
|
|
29
|
+
@issue_type = issue_type
|
|
30
|
+
@issuer = issuer
|
|
31
|
+
@net_amount = net_amount
|
|
32
|
+
@number = number
|
|
33
|
+
@receiver = receiver
|
|
34
|
+
@tax_period = tax_period
|
|
35
|
+
@total_amount = total_amount
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def to_s
|
|
39
|
+
"Invoice (#{@id})"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -33,9 +33,9 @@ module Fintoc
|
|
|
33
33
|
@accounts = if accounts.nil?
|
|
34
34
|
[]
|
|
35
35
|
else
|
|
36
|
-
accounts.map { |data| Fintoc::V1::Account.new(**data, client:) }
|
|
36
|
+
accounts.map { |data| Fintoc::V1::Account.new(**data, link_token:, client:) }
|
|
37
37
|
end
|
|
38
|
-
@
|
|
38
|
+
@link_token = link_token
|
|
39
39
|
@client = client
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class LinkIntent
|
|
4
|
+
attr_reader :id, :object, :country, :created_at, :exchange_token, :exchange_token_expires_at,
|
|
5
|
+
:holder_type, :mode, :product, :status, :widget_token
|
|
6
|
+
|
|
7
|
+
def initialize(
|
|
8
|
+
id:,
|
|
9
|
+
object:,
|
|
10
|
+
country: nil,
|
|
11
|
+
created_at: nil,
|
|
12
|
+
exchange_token: nil,
|
|
13
|
+
exchange_token_expires_at: nil,
|
|
14
|
+
holder_type: nil,
|
|
15
|
+
mode: nil,
|
|
16
|
+
product: nil,
|
|
17
|
+
status: nil,
|
|
18
|
+
widget_token: nil,
|
|
19
|
+
**
|
|
20
|
+
)
|
|
21
|
+
@id = id
|
|
22
|
+
@object = object
|
|
23
|
+
@country = country
|
|
24
|
+
@created_at = created_at
|
|
25
|
+
@exchange_token = exchange_token
|
|
26
|
+
@exchange_token_expires_at = exchange_token_expires_at
|
|
27
|
+
@holder_type = holder_type
|
|
28
|
+
@mode = mode
|
|
29
|
+
@product = product
|
|
30
|
+
@status = status
|
|
31
|
+
@widget_token = widget_token
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def to_s
|
|
35
|
+
"Link intent (#{@id}) - #{@status}"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|