fintoc 1.2.0 → 1.4.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/.github/workflows/release.yml +53 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +14 -31
- data/README.md +90 -0
- data/lib/fintoc/base_client.rb +17 -3
- data/lib/fintoc/v1/client/client.rb +5 -0
- data/lib/fintoc/v1/managers/webhook_endpoints_manager.rb +77 -0
- data/lib/fintoc/v1/resources/webhook_endpoint.rb +38 -0
- data/lib/fintoc/v2/managers/entities_manager.rb +10 -0
- data/lib/fintoc/v2/managers/onboardings_manager.rb +105 -0
- data/lib/fintoc/v2/resources/entity.rb +13 -1
- data/lib/fintoc/v2/resources/onboarding.rb +46 -0
- data/lib/fintoc/version.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 125043d067ac8281433e37d16a8376d3b25f581b3a4fc7f31b30e1b96623e570
|
|
4
|
+
data.tar.gz: 909b347cacb35dfd8e495be517e7c6320ce8aa9930c592215651cd813636e256
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b4fe705e12286af83f27d6fbdae257f334f65b98122d16cb187b6d2c326b10c482356d30e4962faa2395e3e0199d83fc287b2d40a213cf8ff3f780eda714c7c7
|
|
7
|
+
data.tar.gz: 8ff1d5bb3d658081d9dc3086ab8a2c0b01051c7cd5a30776a150960365191c33879016f5fb2738e63e15c9ca767adc1a5ee48c915f92b40837351c284f988312
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
bump:
|
|
7
|
+
description: 'Tipo de bump'
|
|
8
|
+
type: choice
|
|
9
|
+
required: true
|
|
10
|
+
default: minor
|
|
11
|
+
options: [patch, minor, major]
|
|
12
|
+
release-notes:
|
|
13
|
+
description: 'Release notes (markdown, opcional)'
|
|
14
|
+
type: string
|
|
15
|
+
required: false
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
release:
|
|
19
|
+
if: github.ref == 'refs/heads/main'
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
permissions:
|
|
22
|
+
contents: write
|
|
23
|
+
id-token: write
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
|
|
27
|
+
- uses: ruby/setup-ruby@v1
|
|
28
|
+
with:
|
|
29
|
+
ruby-version: '3.4'
|
|
30
|
+
bundler-cache: true
|
|
31
|
+
|
|
32
|
+
- run: bundle exec rspec
|
|
33
|
+
|
|
34
|
+
# setup-ruby's bundler-cache sets BUNDLE_FROZEN; prepare needs to refresh Gemfile.lock
|
|
35
|
+
- run: bundle config unset --local deployment && bundle config unset --local frozen
|
|
36
|
+
|
|
37
|
+
- uses: fintoc-com/release-action/prepare@main
|
|
38
|
+
id: prep
|
|
39
|
+
with:
|
|
40
|
+
bump: ${{ inputs.bump }}
|
|
41
|
+
version-format: ruby
|
|
42
|
+
tag-prefix: v
|
|
43
|
+
app-id: ${{ vars.FIN_RELEASES_APP_ID }}
|
|
44
|
+
app-private-key: ${{ secrets.FIN_RELEASES_PRIVATE_KEY }}
|
|
45
|
+
|
|
46
|
+
- uses: rubygems/release-gem@v1
|
|
47
|
+
|
|
48
|
+
- uses: fintoc-com/release-action/finalize@main
|
|
49
|
+
with:
|
|
50
|
+
tag: ${{ steps.prep.outputs.tag }}
|
|
51
|
+
release-notes: ${{ inputs.release-notes }}
|
|
52
|
+
app-id: ${{ vars.FIN_RELEASES_APP_ID }}
|
|
53
|
+
app-private-key: ${{ secrets.FIN_RELEASES_PRIVATE_KEY }}
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.0 - 2026-08-25
|
|
4
|
+
|
|
5
|
+
### 🚀 New Features
|
|
6
|
+
|
|
7
|
+
- **Entity Onboardings**: Added `entities` resource with `create`, and `onboardings` under entities, including legal representative document upload
|
|
8
|
+
- **Webhook Endpoints**: Added `webhook_endpoints` manager
|
|
9
|
+
- **Multipart Uploads**: HTTP client now supports `multipart/form-data` requests
|
|
10
|
+
|
|
11
|
+
### 🐛 Bug Fixes
|
|
12
|
+
|
|
13
|
+
- **HTTP 6 Compatibility**: Request options are passed as keyword arguments
|
|
14
|
+
|
|
3
15
|
## 1.2.0 - 2026-04-08
|
|
4
16
|
|
|
5
17
|
### 🚀 New Features
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
fintoc (1.
|
|
4
|
+
fintoc (1.4.0)
|
|
5
5
|
http
|
|
6
6
|
money-rails
|
|
7
7
|
tabulate
|
|
@@ -38,16 +38,16 @@ GEM
|
|
|
38
38
|
securerandom (>= 0.3)
|
|
39
39
|
tzinfo (~> 2.0, >= 2.0.5)
|
|
40
40
|
uri (>= 0.13.1)
|
|
41
|
-
addressable (2.
|
|
42
|
-
public_suffix (>= 2.0.2, <
|
|
41
|
+
addressable (2.9.0)
|
|
42
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
43
43
|
ast (2.4.3)
|
|
44
44
|
base64 (0.3.0)
|
|
45
45
|
benchmark (0.4.1)
|
|
46
|
-
bigdecimal (
|
|
46
|
+
bigdecimal (4.1.2)
|
|
47
47
|
builder (3.3.0)
|
|
48
48
|
concurrent-ruby (1.3.5)
|
|
49
49
|
connection_pool (2.5.3)
|
|
50
|
-
crack (1.0.
|
|
50
|
+
crack (1.0.1)
|
|
51
51
|
bigdecimal
|
|
52
52
|
rexml
|
|
53
53
|
crass (1.0.6)
|
|
@@ -58,27 +58,12 @@ GEM
|
|
|
58
58
|
drb (2.2.3)
|
|
59
59
|
erb (5.0.2)
|
|
60
60
|
erubi (1.13.1)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
ffi (1.17.2-aarch64-linux-musl)
|
|
64
|
-
ffi (1.17.2-arm-linux-gnu)
|
|
65
|
-
ffi (1.17.2-arm-linux-musl)
|
|
66
|
-
ffi (1.17.2-arm64-darwin)
|
|
67
|
-
ffi (1.17.2-x86_64-darwin)
|
|
68
|
-
ffi (1.17.2-x86_64-linux-gnu)
|
|
69
|
-
ffi (1.17.2-x86_64-linux-musl)
|
|
70
|
-
ffi-compiler (1.3.2)
|
|
71
|
-
ffi (>= 1.15.5)
|
|
72
|
-
rake
|
|
73
|
-
hashdiff (1.2.0)
|
|
74
|
-
http (5.3.1)
|
|
75
|
-
addressable (~> 2.8)
|
|
61
|
+
hashdiff (1.2.1)
|
|
62
|
+
http (6.0.4)
|
|
76
63
|
http-cookie (~> 1.0)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
http-cookie (1.0.8)
|
|
64
|
+
llhttp (~> 0.6.1)
|
|
65
|
+
http-cookie (1.1.6)
|
|
80
66
|
domain_name (~> 0.5)
|
|
81
|
-
http-form_data (2.3.0)
|
|
82
67
|
i18n (1.14.7)
|
|
83
68
|
concurrent-ruby (~> 1.0)
|
|
84
69
|
io-console (0.8.1)
|
|
@@ -89,9 +74,7 @@ GEM
|
|
|
89
74
|
json (2.13.2)
|
|
90
75
|
language_server-protocol (3.17.0.5)
|
|
91
76
|
lint_roller (1.1.0)
|
|
92
|
-
llhttp
|
|
93
|
-
ffi-compiler (~> 1.0)
|
|
94
|
-
rake (~> 13.0)
|
|
77
|
+
llhttp (0.6.2)
|
|
95
78
|
logger (1.7.0)
|
|
96
79
|
loofah (2.24.1)
|
|
97
80
|
crass (~> 1.0.2)
|
|
@@ -133,7 +116,7 @@ GEM
|
|
|
133
116
|
psych (5.2.6)
|
|
134
117
|
date
|
|
135
118
|
stringio
|
|
136
|
-
public_suffix (
|
|
119
|
+
public_suffix (7.0.5)
|
|
137
120
|
racc (1.8.1)
|
|
138
121
|
rack (3.2.0)
|
|
139
122
|
rack-session (2.1.1)
|
|
@@ -159,14 +142,14 @@ GEM
|
|
|
159
142
|
thor (~> 1.0, >= 1.2.2)
|
|
160
143
|
zeitwerk (~> 2.6)
|
|
161
144
|
rainbow (3.1.1)
|
|
162
|
-
rake (13.
|
|
145
|
+
rake (13.4.2)
|
|
163
146
|
rdoc (6.14.2)
|
|
164
147
|
erb
|
|
165
148
|
psych (>= 4.0.0)
|
|
166
149
|
regexp_parser (2.11.2)
|
|
167
150
|
reline (0.6.2)
|
|
168
151
|
io-console (~> 0.5)
|
|
169
|
-
rexml (3.4.
|
|
152
|
+
rexml (3.4.4)
|
|
170
153
|
rspec (3.13.1)
|
|
171
154
|
rspec-core (~> 3.13.0)
|
|
172
155
|
rspec-expectations (~> 3.13.0)
|
|
@@ -233,7 +216,7 @@ GEM
|
|
|
233
216
|
useragent (0.16.11)
|
|
234
217
|
vcr (6.3.1)
|
|
235
218
|
base64
|
|
236
|
-
webmock (3.
|
|
219
|
+
webmock (3.26.2)
|
|
237
220
|
addressable (>= 2.8.0)
|
|
238
221
|
crack (>= 0.3.2)
|
|
239
222
|
hashdiff (>= 0.4.0, < 2.0.0)
|
data/README.md
CHANGED
|
@@ -33,6 +33,7 @@ Do yourself a favor: go grab some ice cubes by installing this refreshing librar
|
|
|
33
33
|
- [Transfers](#transfers)
|
|
34
34
|
- [Simulate](#simulate)
|
|
35
35
|
- [Account Verifications](#account-verifications)
|
|
36
|
+
- [Entity onboardings API Examples](#entity-onboardings-api-examples)
|
|
36
37
|
- [Idempotency Keys](#idempotency-keys)
|
|
37
38
|
- [Idempotency Examples](#idempotency-examples)
|
|
38
39
|
- [Account Methods with Idempotency Key](#account-methods-with-idempotency-key)
|
|
@@ -150,6 +151,11 @@ account_verifications = client.v2.account_verifications.list
|
|
|
150
151
|
account_verification = client.v2.account_verifications.get('account_verification_id')
|
|
151
152
|
account_verification = client.v2.account_verifications.create(account_number: 'account_number')
|
|
152
153
|
|
|
154
|
+
# Entity onboardings
|
|
155
|
+
entity = client.v2.entities.get('entity_id')
|
|
156
|
+
onboardings = entity.onboardings.list
|
|
157
|
+
onboarding = entity.onboardings.get('onboarding_id')
|
|
158
|
+
|
|
153
159
|
# TODO: Movements
|
|
154
160
|
```
|
|
155
161
|
|
|
@@ -386,6 +392,90 @@ account_verification = client.v2.account_verifications.get('account_verification
|
|
|
386
392
|
account_verifications = client.v2.account_verifications.list
|
|
387
393
|
```
|
|
388
394
|
|
|
395
|
+
### Entity onboardings API Examples
|
|
396
|
+
|
|
397
|
+
An entity onboarding represents the onboarding process for an entity. You access it from
|
|
398
|
+
an `Entity` instance (`entity.onboardings`); the full lifecycle is available: list,
|
|
399
|
+
retrieve, create, submit, and upload documents to a slot.
|
|
400
|
+
|
|
401
|
+
```ruby
|
|
402
|
+
require 'fintoc'
|
|
403
|
+
|
|
404
|
+
client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')
|
|
405
|
+
entity = client.v2.entities.get('entity_id')
|
|
406
|
+
|
|
407
|
+
# List the onboardings of an entity (cursor-paginated, light shape)
|
|
408
|
+
onboardings = entity.onboardings.list
|
|
409
|
+
|
|
410
|
+
# Retrieve a single onboarding (full shape, includes legal representatives,
|
|
411
|
+
# shareholders and documents)
|
|
412
|
+
onboarding = entity.onboardings.get('onboarding_id')
|
|
413
|
+
puts onboarding # 📋 Onboarding onbprc_0ujs... (in_progress)
|
|
414
|
+
onboarding.type # => 'account_holder'
|
|
415
|
+
onboarding.legal_representatives # => array of legal representative hashes
|
|
416
|
+
onboarding.shareholders # => array of shareholder hashes
|
|
417
|
+
onboarding.documents # => array of document hashes
|
|
418
|
+
|
|
419
|
+
# Create an onboarding. `type` selects the onboarding to run (`account_holder` or
|
|
420
|
+
# `settlement_recipient`) and `data` holds the nested structures, which are passed
|
|
421
|
+
# through as-is and validated by the API.
|
|
422
|
+
onboarding = entity.onboardings.create(
|
|
423
|
+
type: 'account_holder',
|
|
424
|
+
data: {
|
|
425
|
+
company_information: {
|
|
426
|
+
incorporation_date: '2020-01-15',
|
|
427
|
+
business_activity: 'Servicios financieros',
|
|
428
|
+
fiscal_address: 'Av. Reforma 123, CDMX',
|
|
429
|
+
business_address: 'Av. Insurgentes 456, CDMX',
|
|
430
|
+
settlement_account: '646180357600000013',
|
|
431
|
+
phone: '+521111111111'
|
|
432
|
+
},
|
|
433
|
+
legal_representatives: [
|
|
434
|
+
{
|
|
435
|
+
first_name: 'Jane',
|
|
436
|
+
last_name: 'Doe',
|
|
437
|
+
email: 'jane@acme.com',
|
|
438
|
+
nationality: 'mx',
|
|
439
|
+
identification_number: 'AAAA010101HDFAAA01',
|
|
440
|
+
position: 'Director General'
|
|
441
|
+
}
|
|
442
|
+
],
|
|
443
|
+
transactional_profile: {
|
|
444
|
+
resource_origins: %w[trusts investments],
|
|
445
|
+
monthly_amount_range: '1_500000',
|
|
446
|
+
monthly_operations_range: '1_15000'
|
|
447
|
+
},
|
|
448
|
+
shareholders: [
|
|
449
|
+
{
|
|
450
|
+
type: 'natural_person',
|
|
451
|
+
name: 'Jane',
|
|
452
|
+
last_name: 'Doe',
|
|
453
|
+
holder_id: 'AAAA010101AAA',
|
|
454
|
+
nationality: 'mx',
|
|
455
|
+
percentage: 100
|
|
456
|
+
}
|
|
457
|
+
]
|
|
458
|
+
}
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
# Upload a document for a given slot (multipart). `file:` accepts a path or an IO.
|
|
462
|
+
entity.onboardings.upload_document('onboarding_id', 'slot_key', file: 'path/to/file.pdf')
|
|
463
|
+
|
|
464
|
+
# Upload a document for a specific shareholder (multipart).
|
|
465
|
+
entity.onboardings.upload_shareholder_document(
|
|
466
|
+
'onboarding_id', 'shareholder_id', file: 'path/to/file.pdf'
|
|
467
|
+
)
|
|
468
|
+
|
|
469
|
+
# Upload a document for a specific legal representative (multipart).
|
|
470
|
+
# Slots: `identification` and `power_of_attorney`.
|
|
471
|
+
entity.onboardings.upload_legal_representative_document(
|
|
472
|
+
'onboarding_id', 'legal_representative_id', 'identification', file: 'path/to/file.pdf'
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
# Submit the onboarding for review.
|
|
476
|
+
onboarding = entity.onboardings.submit('onboarding_id')
|
|
477
|
+
```
|
|
478
|
+
|
|
389
479
|
## Idempotency Keys
|
|
390
480
|
|
|
391
481
|
The Fintoc API supports [idempotency](https://docs.fintoc.com/reference/idempotent-requests) for safely retrying requests without accidentally performing the same operation twice. This is particularly useful when creating transfers, account numbers, accounts, or other resources where you want to avoid duplicates due to network issues.
|
data/lib/fintoc/base_client.rb
CHANGED
|
@@ -38,9 +38,13 @@ module Fintoc
|
|
|
38
38
|
request('patch', version:, use_jws:, idempotency_key:)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
def put(version: :v1, use_jws: false, idempotency_key: nil)
|
|
42
|
+
request('put', version:, use_jws:, idempotency_key:)
|
|
43
|
+
end
|
|
44
|
+
|
|
41
45
|
def request(method, version: :v1, use_jws: false, idempotency_key: nil)
|
|
42
|
-
proc do |resource, **kwargs|
|
|
43
|
-
parameters = params(method, **kwargs)
|
|
46
|
+
proc do |resource, form: nil, **kwargs|
|
|
47
|
+
parameters = form ? { form: build_form(form) } : params(method, **kwargs)
|
|
44
48
|
response = make_request(method, resource, parameters, version:, use_jws:, idempotency_key:)
|
|
45
49
|
content = JSON.parse(response.body, symbolize_names: true)
|
|
46
50
|
|
|
@@ -118,7 +122,7 @@ module Fintoc
|
|
|
118
122
|
request_client = request_client.headers('Idempotency-Key' => idempotency_key)
|
|
119
123
|
end
|
|
120
124
|
|
|
121
|
-
request_client.send(method, url, parameters)
|
|
125
|
+
request_client.send(method, url, **parameters)
|
|
122
126
|
end
|
|
123
127
|
|
|
124
128
|
def params(method, **kwargs)
|
|
@@ -129,6 +133,16 @@ module Fintoc
|
|
|
129
133
|
end
|
|
130
134
|
end
|
|
131
135
|
|
|
136
|
+
def build_form(form)
|
|
137
|
+
form.transform_values do |value|
|
|
138
|
+
file?(value) ? HTTP::FormData::File.new(value) : value
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def file?(value)
|
|
143
|
+
value.respond_to?(:read) || (value.is_a?(String) && File.file?(value))
|
|
144
|
+
end
|
|
145
|
+
|
|
132
146
|
def raise_custom_error(error)
|
|
133
147
|
raise error_class(error[:code]).new(error[:message], error[:doc_url])
|
|
134
148
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'fintoc/base_client'
|
|
2
2
|
require 'fintoc/v1/managers/links_manager'
|
|
3
|
+
require 'fintoc/v1/managers/webhook_endpoints_manager'
|
|
3
4
|
|
|
4
5
|
module Fintoc
|
|
5
6
|
module V1
|
|
@@ -7,6 +8,10 @@ module Fintoc
|
|
|
7
8
|
def links
|
|
8
9
|
@links ||= Managers::LinksManager.new(self)
|
|
9
10
|
end
|
|
11
|
+
|
|
12
|
+
def webhook_endpoints
|
|
13
|
+
@webhook_endpoints ||= Managers::WebhookEndpointsManager.new(self)
|
|
14
|
+
end
|
|
10
15
|
end
|
|
11
16
|
end
|
|
12
17
|
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
require 'fintoc/v1/resources/webhook_endpoint'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V1
|
|
5
|
+
module Managers
|
|
6
|
+
class WebhookEndpointsManager
|
|
7
|
+
def initialize(client)
|
|
8
|
+
@client = client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(url:, enabled_events:, idempotency_key: nil, **params)
|
|
12
|
+
data = _create_webhook_endpoint(
|
|
13
|
+
url:, enabled_events:, idempotency_key:, **params
|
|
14
|
+
)
|
|
15
|
+
build_webhook_endpoint(data)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(webhook_endpoint_id)
|
|
19
|
+
data = _get_webhook_endpoint(webhook_endpoint_id)
|
|
20
|
+
build_webhook_endpoint(data)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def list(**params)
|
|
24
|
+
_list_webhook_endpoints(**params).map { |data| build_webhook_endpoint(data) }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def update(webhook_endpoint_id, idempotency_key: nil, **params)
|
|
28
|
+
data = _update_webhook_endpoint(webhook_endpoint_id, idempotency_key:, **params)
|
|
29
|
+
build_webhook_endpoint(data)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def delete(webhook_endpoint_id)
|
|
33
|
+
_delete_webhook_endpoint(webhook_endpoint_id)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test(webhook_endpoint_id, type:)
|
|
37
|
+
data = _test_webhook_endpoint(webhook_endpoint_id, type:)
|
|
38
|
+
build_webhook_endpoint(data)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
def _create_webhook_endpoint(url:, enabled_events:, idempotency_key: nil, **params)
|
|
44
|
+
request_params = { url:, enabled_events: }
|
|
45
|
+
request_params.merge!(params)
|
|
46
|
+
|
|
47
|
+
@client.post(version: :v1, idempotency_key:).call('webhook_endpoints', **request_params)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def _get_webhook_endpoint(webhook_endpoint_id)
|
|
51
|
+
@client.get(version: :v1).call("webhook_endpoints/#{webhook_endpoint_id}")
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def _list_webhook_endpoints(**params)
|
|
55
|
+
@client.get(version: :v1).call('webhook_endpoints', **params)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def _update_webhook_endpoint(webhook_endpoint_id, idempotency_key: nil, **params)
|
|
59
|
+
@client.patch(version: :v1, idempotency_key:)
|
|
60
|
+
.call("webhook_endpoints/#{webhook_endpoint_id}", **params)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def _delete_webhook_endpoint(webhook_endpoint_id)
|
|
64
|
+
@client.delete(version: :v1).call("webhook_endpoints/#{webhook_endpoint_id}")
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def _test_webhook_endpoint(webhook_endpoint_id, type:)
|
|
68
|
+
@client.post(version: :v1).call("webhook_endpoints/#{webhook_endpoint_id}/test", type:)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def build_webhook_endpoint(data)
|
|
72
|
+
Fintoc::V1::WebhookEndpoint.new(**data, client: @client)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V1
|
|
3
|
+
class WebhookEndpoint
|
|
4
|
+
attr_reader :id, :object, :url, :mode, :enabled_events, :secret, :disabled, :created_at
|
|
5
|
+
|
|
6
|
+
def initialize(
|
|
7
|
+
id:,
|
|
8
|
+
object:,
|
|
9
|
+
url:,
|
|
10
|
+
mode:,
|
|
11
|
+
enabled_events:,
|
|
12
|
+
secret:,
|
|
13
|
+
disabled:,
|
|
14
|
+
created_at:,
|
|
15
|
+
client: nil,
|
|
16
|
+
**
|
|
17
|
+
)
|
|
18
|
+
@id = id
|
|
19
|
+
@object = object
|
|
20
|
+
@url = url
|
|
21
|
+
@mode = mode
|
|
22
|
+
@enabled_events = enabled_events
|
|
23
|
+
@secret = secret
|
|
24
|
+
@disabled = disabled
|
|
25
|
+
@created_at = created_at
|
|
26
|
+
@client = client
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def to_s
|
|
30
|
+
"🔔 #{@url} (#{@id})"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def disabled?
|
|
34
|
+
@disabled
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -8,6 +8,11 @@ module Fintoc
|
|
|
8
8
|
@client = client
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
+
def create(holder_name:, holder_id:, country_code:, idempotency_key: nil, **params)
|
|
12
|
+
data = _create_entity(holder_name:, holder_id:, country_code:, idempotency_key:, **params)
|
|
13
|
+
build_entity(data)
|
|
14
|
+
end
|
|
15
|
+
|
|
11
16
|
def get(entity_id)
|
|
12
17
|
data = _get_entity(entity_id)
|
|
13
18
|
build_entity(data)
|
|
@@ -19,6 +24,11 @@ module Fintoc
|
|
|
19
24
|
|
|
20
25
|
private
|
|
21
26
|
|
|
27
|
+
def _create_entity(holder_name:, holder_id:, country_code:, idempotency_key: nil, **params)
|
|
28
|
+
@client.post(version: :v2, idempotency_key:)
|
|
29
|
+
.call('entities', holder_name:, holder_id:, country_code:, **params)
|
|
30
|
+
end
|
|
31
|
+
|
|
22
32
|
def _get_entity(entity_id)
|
|
23
33
|
@client.get(version: :v2).call("entities/#{entity_id}")
|
|
24
34
|
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
require 'fintoc/v2/resources/onboarding'
|
|
2
|
+
|
|
3
|
+
module Fintoc
|
|
4
|
+
module V2
|
|
5
|
+
module Managers
|
|
6
|
+
class OnboardingsManager
|
|
7
|
+
def initialize(client, entity_id)
|
|
8
|
+
@client = client
|
|
9
|
+
@entity_id = entity_id
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def list(**params)
|
|
13
|
+
_list_onboardings(**params).map { |data| build_onboarding(data) }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get(onboarding_id)
|
|
17
|
+
data = _get_onboarding(onboarding_id)
|
|
18
|
+
build_onboarding(data)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create(idempotency_key: nil, **params)
|
|
22
|
+
data = _create_onboarding(idempotency_key:, **params)
|
|
23
|
+
build_onboarding(data)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def submit(onboarding_id, idempotency_key: nil)
|
|
27
|
+
data = _submit_onboarding(onboarding_id, idempotency_key:)
|
|
28
|
+
build_onboarding(data)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def upload_document(onboarding_id, slot_key, file:, idempotency_key: nil)
|
|
32
|
+
data = _upload_document(onboarding_id, slot_key, file:, idempotency_key:)
|
|
33
|
+
build_onboarding(data)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def upload_shareholder_document(onboarding_id, shareholder_id, file:, idempotency_key: nil)
|
|
37
|
+
data = _upload_shareholder_document(
|
|
38
|
+
onboarding_id, shareholder_id, file:, idempotency_key:
|
|
39
|
+
)
|
|
40
|
+
build_onboarding(data)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def upload_legal_representative_document(
|
|
44
|
+
onboarding_id, legal_representative_id, slot_key, file:, idempotency_key: nil
|
|
45
|
+
)
|
|
46
|
+
data = _upload_legal_representative_document(
|
|
47
|
+
onboarding_id, legal_representative_id, slot_key, file:, idempotency_key:
|
|
48
|
+
)
|
|
49
|
+
build_onboarding(data)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
def base_path
|
|
55
|
+
"entities/#{@entity_id}/onboardings"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def _list_onboardings(**params)
|
|
59
|
+
@client.get(version: :v2).call(base_path, **params)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def _get_onboarding(onboarding_id)
|
|
63
|
+
@client.get(version: :v2).call("#{base_path}/#{onboarding_id}")
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def _create_onboarding(idempotency_key: nil, **params)
|
|
67
|
+
@client.post(version: :v2, idempotency_key:).call(base_path, **params)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def _submit_onboarding(onboarding_id, idempotency_key: nil)
|
|
71
|
+
@client.post(version: :v2, idempotency_key:)
|
|
72
|
+
.call("#{base_path}/#{onboarding_id}/submit")
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def _upload_document(onboarding_id, slot_key, file:, idempotency_key: nil)
|
|
76
|
+
@client.put(version: :v2, idempotency_key:).call(
|
|
77
|
+
"#{base_path}/#{onboarding_id}/documents/#{slot_key}",
|
|
78
|
+
form: { file: }
|
|
79
|
+
)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def _upload_shareholder_document(onboarding_id, shareholder_id, file:, idempotency_key: nil)
|
|
83
|
+
@client.put(version: :v2, idempotency_key:).call(
|
|
84
|
+
"#{base_path}/#{onboarding_id}/shareholders/#{shareholder_id}/document",
|
|
85
|
+
form: { file: }
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def _upload_legal_representative_document(
|
|
90
|
+
onboarding_id, legal_representative_id, slot_key, file:, idempotency_key: nil
|
|
91
|
+
)
|
|
92
|
+
@client.put(version: :v2, idempotency_key:).call(
|
|
93
|
+
"#{base_path}/#{onboarding_id}/legal_representatives" \
|
|
94
|
+
"/#{legal_representative_id}/documents/#{slot_key}",
|
|
95
|
+
form: { file: }
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def build_onboarding(data)
|
|
100
|
+
Fintoc::V2::Onboarding.new(**data, client: @client)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
require 'fintoc/v2/managers/onboardings_manager'
|
|
2
|
+
|
|
1
3
|
module Fintoc
|
|
2
4
|
module V2
|
|
3
5
|
class Entity
|
|
4
|
-
attr_reader :object, :mode, :id, :holder_name, :holder_id, :is_root
|
|
6
|
+
attr_reader :object, :mode, :id, :holder_name, :holder_id, :is_root, :status, :country_code
|
|
5
7
|
|
|
6
8
|
def initialize(
|
|
7
9
|
object:,
|
|
@@ -10,6 +12,8 @@ module Fintoc
|
|
|
10
12
|
holder_name:,
|
|
11
13
|
holder_id:,
|
|
12
14
|
is_root:,
|
|
15
|
+
status: nil,
|
|
16
|
+
country_code: nil,
|
|
13
17
|
client: nil,
|
|
14
18
|
**
|
|
15
19
|
)
|
|
@@ -19,6 +23,8 @@ module Fintoc
|
|
|
19
23
|
@holder_name = holder_name
|
|
20
24
|
@holder_id = holder_id
|
|
21
25
|
@is_root = is_root
|
|
26
|
+
@status = status
|
|
27
|
+
@country_code = country_code
|
|
22
28
|
@client = client
|
|
23
29
|
end
|
|
24
30
|
|
|
@@ -31,6 +37,10 @@ module Fintoc
|
|
|
31
37
|
refresh_from_entity(fresh_entity)
|
|
32
38
|
end
|
|
33
39
|
|
|
40
|
+
def onboardings
|
|
41
|
+
@onboardings ||= Managers::OnboardingsManager.new(@client, @id)
|
|
42
|
+
end
|
|
43
|
+
|
|
34
44
|
private
|
|
35
45
|
|
|
36
46
|
def refresh_from_entity(entity)
|
|
@@ -43,6 +53,8 @@ module Fintoc
|
|
|
43
53
|
@holder_name = entity.holder_name
|
|
44
54
|
@holder_id = entity.holder_id
|
|
45
55
|
@is_root = entity.is_root
|
|
56
|
+
@status = entity.status
|
|
57
|
+
@country_code = entity.country_code
|
|
46
58
|
|
|
47
59
|
self
|
|
48
60
|
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module Fintoc
|
|
2
|
+
module V2
|
|
3
|
+
class Onboarding
|
|
4
|
+
attr_reader :object, :id, :entity_id, :type, :status, :source, :submitted_at,
|
|
5
|
+
:reviewed_at, :submittable, :data, :legal_representatives, :shareholders,
|
|
6
|
+
:documents
|
|
7
|
+
|
|
8
|
+
def initialize(
|
|
9
|
+
object:,
|
|
10
|
+
id:,
|
|
11
|
+
entity_id: nil,
|
|
12
|
+
type: nil,
|
|
13
|
+
status: nil,
|
|
14
|
+
source: nil,
|
|
15
|
+
submitted_at: nil,
|
|
16
|
+
reviewed_at: nil,
|
|
17
|
+
submittable: nil,
|
|
18
|
+
data: nil,
|
|
19
|
+
legal_representatives: nil,
|
|
20
|
+
shareholders: nil,
|
|
21
|
+
documents: nil,
|
|
22
|
+
client: nil,
|
|
23
|
+
**
|
|
24
|
+
)
|
|
25
|
+
@object = object
|
|
26
|
+
@id = id
|
|
27
|
+
@entity_id = entity_id
|
|
28
|
+
@type = type
|
|
29
|
+
@status = status
|
|
30
|
+
@source = source
|
|
31
|
+
@submitted_at = submitted_at
|
|
32
|
+
@reviewed_at = reviewed_at
|
|
33
|
+
@submittable = submittable
|
|
34
|
+
@data = data
|
|
35
|
+
@legal_representatives = legal_representatives
|
|
36
|
+
@shareholders = shareholders
|
|
37
|
+
@documents = documents
|
|
38
|
+
@client = client
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def to_s
|
|
42
|
+
"📋 Onboarding #{@id} (#{@status})"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
data/lib/fintoc/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fintoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juan Ca Sardin
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: http
|
|
@@ -61,6 +60,7 @@ extra_rdoc_files: []
|
|
|
61
60
|
files:
|
|
62
61
|
- ".github/pull_request_template.md"
|
|
63
62
|
- ".github/workflows/ci.yml"
|
|
63
|
+
- ".github/workflows/release.yml"
|
|
64
64
|
- ".gitignore"
|
|
65
65
|
- ".rspec"
|
|
66
66
|
- ".rubocop.yml"
|
|
@@ -84,12 +84,14 @@ files:
|
|
|
84
84
|
- lib/fintoc/utils.rb
|
|
85
85
|
- lib/fintoc/v1/client/client.rb
|
|
86
86
|
- lib/fintoc/v1/managers/links_manager.rb
|
|
87
|
+
- lib/fintoc/v1/managers/webhook_endpoints_manager.rb
|
|
87
88
|
- lib/fintoc/v1/resources/account.rb
|
|
88
89
|
- lib/fintoc/v1/resources/balance.rb
|
|
89
90
|
- lib/fintoc/v1/resources/institution.rb
|
|
90
91
|
- lib/fintoc/v1/resources/link.rb
|
|
91
92
|
- lib/fintoc/v1/resources/movement.rb
|
|
92
93
|
- lib/fintoc/v1/resources/transfer_account.rb
|
|
94
|
+
- lib/fintoc/v1/resources/webhook_endpoint.rb
|
|
93
95
|
- lib/fintoc/v2/client/client.rb
|
|
94
96
|
- lib/fintoc/v2/managers/account_numbers_manager.rb
|
|
95
97
|
- lib/fintoc/v2/managers/account_statements_manager.rb
|
|
@@ -97,6 +99,7 @@ files:
|
|
|
97
99
|
- lib/fintoc/v2/managers/accounts_manager.rb
|
|
98
100
|
- lib/fintoc/v2/managers/entities_manager.rb
|
|
99
101
|
- lib/fintoc/v2/managers/movements_manager.rb
|
|
102
|
+
- lib/fintoc/v2/managers/onboardings_manager.rb
|
|
100
103
|
- lib/fintoc/v2/managers/simulate_manager.rb
|
|
101
104
|
- lib/fintoc/v2/managers/transfers_manager.rb
|
|
102
105
|
- lib/fintoc/v2/resources/account.rb
|
|
@@ -105,6 +108,7 @@ files:
|
|
|
105
108
|
- lib/fintoc/v2/resources/account_verification.rb
|
|
106
109
|
- lib/fintoc/v2/resources/entity.rb
|
|
107
110
|
- lib/fintoc/v2/resources/movement.rb
|
|
111
|
+
- lib/fintoc/v2/resources/onboarding.rb
|
|
108
112
|
- lib/fintoc/v2/resources/transfer.rb
|
|
109
113
|
- lib/fintoc/version.rb
|
|
110
114
|
- lib/fintoc/webhook_signature.rb
|
|
@@ -115,7 +119,6 @@ metadata:
|
|
|
115
119
|
homepage_uri: https://github.com/fintoc-com/fintoc-ruby
|
|
116
120
|
source_code_uri: https://github.com/fintoc-com/fintoc-ruby
|
|
117
121
|
rubygems_mfa_required: 'true'
|
|
118
|
-
post_install_message:
|
|
119
122
|
rdoc_options: []
|
|
120
123
|
require_paths:
|
|
121
124
|
- lib
|
|
@@ -130,8 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
130
133
|
- !ruby/object:Gem::Version
|
|
131
134
|
version: '0'
|
|
132
135
|
requirements: []
|
|
133
|
-
rubygems_version: 3.
|
|
134
|
-
signing_key:
|
|
136
|
+
rubygems_version: 3.6.9
|
|
135
137
|
specification_version: 4
|
|
136
138
|
summary: The official Ruby client for the Fintoc API.
|
|
137
139
|
test_files: []
|