Skip to content

Commit 602184e

Browse files
[CLN-2115] Armar SDK de transfers en Ruby (#18)
* feature(api): add support for v2 endpoint * feature(entity): Add entity resource * feature(entities): Add entities endpoints * feature(entity): Add refresh method to entity * feature(entities): Add readme docs for entity * feature(client): Add post requests * refactor(movements): Move existing accounts to movements namespace * refactor(entity): Move entities to Transfers folder * refactor(clients): Refactor Clients to have separate clients for Movements and Transfers * refactor(balance): Move balance to Movements namespace * refactor(institution): Move Institutions to Movements namespace * refactor(links): Move links to Movements namespace * refactor(movements): Move movements to Movements namespace * refactor(transfer-accounts): Move TransferAccounts to Movements namespace * refactor(fintoc): Restrutcture entire folder structure to have better navigability and more intuitive naming * refactor(transfers-client): Update spec to mock api response rather than method response * fix(movements-http-mocks): Move mocks to correct folder (and delete deprecated ones) * fix(movements): Fix movements comparison * feature(base-client): Add patch request method * feature(accounts): Create transfers account resource * feature(accounts): Add accounts methods to Transfers client * refactor(client): Add comment to Fintoc::Client to make sure that the AI doesn't use it since it is expected to be deprecated * refactor(entitities): Remove unnecessary entities array conversion * feature(accounts): Add refresh method to accounts * feature(accounts): Add update method for accounts * refactor(client): Add comment indicating that Client is only kept for backward compatibility * refactor(accounts): Configure money-rails gem instead of custom formatter * refactor(resources): Prefer explicit refreshing of resource values * feature(account-numbers): Add account numbers transfer resource * feature(account-numbers): Add account numbers methods * feature(account-number): Add refresh method to account numbers * feature(account-numbers): Add update method to account numbers * refactor(resources): Do not refresh using initialize as it returns a different object * feature(transfers): Add transfers resources * feature(jws): Add JWS private key to request args for use of transfers create and patch methods * feature(transfers): Add transfers methods * feature(transfers): Add refresh method to transfers * feature(transfer): Add return_transfer method to transfer * refactor(client/jws): Move jws condition to separate method * feature(simulate): Implement simulate methods * feature(account/simulate): Use simulate_receive_transfer as isntance method for Account * feature(account-number/simulate): Use simulate_receive_transfer as isntance method for AccountNumber * feature(simulate): Only allow simulating inbound transfers on test mode * refactor(transfers-methods/spec): Better mocks for unit tests of methods * feature(account-verifications): Add AccountVerification resource * feature(account-verifications): Add account verification methods * feature(account-verifications): add refresh methods to account verifications * refactor(transfers): Remove unnecessary inclusions of Utils * refactor(transfer/refresh-resources): Use ArgumentError for resfresh_from_* error on mismatching instances * refactor(errors): Update errors url ref * feature(errors): Update list of possible errors * feature(docs): Update readme docs to include new methods and changes to the api use * refactor(client): Use managers instead of methods to access all api methods as in Python SDK * fix(readme): Fix typo * refactor(client): Prefer having v1/v2 clients instead of movements/transfers/others for consistency with other SDKs * fix(readme): Fix readme client * feat: add webhook signature module * feat: add webhook signature error * feat: include webhook signature module to fintoc * refactor(errors): Remove redundant to_s at Errors Since it is implied by inheriting from StandardError * refactor(v1/accounts): Move Headers to frozen constant * fix(v1/link): Fix call to delete * refactor(fintoc/version): Move version spec to better folder * feature(spec): Increase spec coverage * fix(transfers-manager): Fix mock of transfers return in spec * fix(base-client): Invert visible part and hidden part of key This also adds a spec for BaseClient * feature(account/spec): Add missing spec for update_balance method of V1::Account * feature(spec/link): Add missing spec for update_accounts of V1::Link * feature(simplecov): Add simplecov gem * feature(simplecov): Add simplecov config * feature(ci/simplecov): Add coverage requirement to CI * feature(version): Bump version to 1.0.0 and update changelog --------- Co-authored-by: Danny Fuentes <dannyfuf@gmail.com>
1 parent 22467cd commit 602184e

114 files changed

Lines changed: 6448 additions & 1202 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ jobs:
4343
bundler-cache: true
4444

4545
- name: Run tests
46-
run: bundle exec rspec
46+
run: COVERAGE=true bundle exec rspec

CHANGELOG.md

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
11
# Changelog
22

3-
## 0.2.0 - 2025-08-26
3+
## 1.0.0 - 2025-09-05
44

5-
* Update linting rules and fix linting issues
6-
* Update CI flow
7-
* Update gems and support only Ruby versions that haven't reached EOL
8-
* Update README
5+
### 🚀 New Features
6+
7+
- **New Client Architecture**: Restructured client to distinguish between API versions
8+
- Movements API now accessible via `Fintoc::V1::Client`
9+
- Transfers API accessible via `Fintoc::V2::Client`
10+
- Unified client interface with `Fintoc::Client` providing access to both versions
11+
- Backward compatibility maintained for existing method signatures
12+
13+
- **V2 Client - Transfers API Implementation**: Partial implementation of Transfers API endpoints in `Fintoc::V2::Client`
14+
- **Entities**: List and retrieve business entities
15+
- **Transfer Accounts**: Create, read, update, and list transfer accounts
16+
- **Account Numbers**: Manage account numbers/CLABEs
17+
- **Transfers**: Create, retrieve, list, and return transfers
18+
- **Simulation**: Simulate receiving transfers for testing
19+
- **Account Verifications**: Verify account numbers
20+
- **Movements**: TODO! Not yet implemented
21+
22+
### 🧪 Testing & Quality
23+
24+
- **100% Line Coverage**: Achieved full line coverage using SimpleCov gem, increasing the spec coverage and testing all new code.
25+
- Configured with `minimum_coverage 100` and `minimum_coverage_by_file 100`
26+
- Uses `simplecov_text_formatter` and `simplecov_linter_formatter` for reporting
27+
28+
- **Robust CI Pipeline**: Enhanced GitHub Actions workflow for comprehensive testing
29+
- **Linting**: Dedicated RuboCop job for code quality enforcement
30+
- **Multi-version Testing**: Tests against all currently supported Ruby versions (3.2, 3.3, and 3.4) for version compatibility
31+
- **Coverage Integration**: Automated coverage reporting in CI pipeline
32+
33+
### Others
34+
35+
- **Money-Rails Integration**: Added `money-rails` gem for proper currency handling
36+
- **Comprehensive README Update**: Extensively updated documentation with usage examples and development instructions
37+
- **Improved Error Handling**: Better error management across API versions
38+
- **JWS Support**: JSON Web Signature support for secure V2 API operations
39+
- **HMac Signature verification**: Added the `Fintoc::WebhookSignature` class for easing webhook signature verification
940

1041
## 0.1.0 - 2021-01-18
1142

43+
Initial version
44+
1245
* Up to date with the [2020-11-17](https://docs.fintoc.com/docs/api-changelog#2020-11-17) API version

Gemfile

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@ source 'https://rubygems.org'
44
gemspec
55

66
# Development dependencies
7-
gem 'rexml' # Required for webmock in Ruby 3.0+
8-
gem 'rspec', '~> 3.0'
9-
gem 'rubocop', '~> 1.80'
10-
gem 'rubocop-capybara', '~> 2.22', '>= 2.22.1'
11-
gem 'rubocop-performance', '~> 1.25'
12-
gem 'rubocop-rails', '~> 2.33', '>= 2.33.3'
13-
gem 'rubocop-rspec', '~> 3.6'
14-
gem 'vcr', '~> 6.3'
15-
gem 'webmock'
7+
group :development do
8+
gem 'rubocop', '~> 1.80'
9+
gem 'rubocop-capybara', '~> 2.22', '>= 2.22.1'
10+
gem 'rubocop-performance', '~> 1.25'
11+
gem 'rubocop-rails', '~> 2.33', '>= 2.33.3'
12+
gem 'rubocop-rspec', '~> 3.6'
13+
end
14+
15+
group :test do
16+
gem 'rexml' # Required for webmock in Ruby 3.0+
17+
gem 'rspec', '~> 3.0'
18+
gem 'simplecov', '~> 0.21'
19+
gem 'simplecov_linter_formatter'
20+
gem 'simplecov_text_formatter'
21+
gem 'vcr', '~> 6.3'
22+
gem 'webmock'
23+
end

Gemfile.lock

Lines changed: 106 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
PATH
22
remote: .
33
specs:
4-
fintoc (0.2.0)
4+
fintoc (1.0.0)
55
http
6+
money-rails
67
tabulate
78

89
GEM
910
remote: https://rubygems.org/
1011
specs:
12+
actionpack (8.0.2.1)
13+
actionview (= 8.0.2.1)
14+
activesupport (= 8.0.2.1)
15+
nokogiri (>= 1.8.5)
16+
rack (>= 2.2.4)
17+
rack-session (>= 1.0.1)
18+
rack-test (>= 0.6.3)
19+
rails-dom-testing (~> 2.2)
20+
rails-html-sanitizer (~> 1.6)
21+
useragent (~> 0.16)
22+
actionview (8.0.2.1)
23+
activesupport (= 8.0.2.1)
24+
builder (~> 3.1)
25+
erubi (~> 1.11)
26+
rails-dom-testing (~> 2.2)
27+
rails-html-sanitizer (~> 1.6)
1128
activesupport (8.0.2.1)
1229
base64
1330
benchmark (>= 0.3)
@@ -27,22 +44,26 @@ GEM
2744
base64 (0.3.0)
2845
benchmark (0.4.1)
2946
bigdecimal (3.2.2)
47+
builder (3.3.0)
3048
concurrent-ruby (1.3.5)
3149
connection_pool (2.5.3)
3250
crack (1.0.0)
3351
bigdecimal
3452
rexml
53+
crass (1.0.6)
54+
date (3.4.1)
3555
diff-lcs (1.6.2)
56+
docile (1.4.1)
3657
domain_name (0.6.20240107)
3758
drb (2.2.3)
59+
erb (5.0.2)
60+
erubi (1.13.1)
3861
ffi (1.17.2)
3962
ffi (1.17.2-aarch64-linux-gnu)
4063
ffi (1.17.2-aarch64-linux-musl)
4164
ffi (1.17.2-arm-linux-gnu)
4265
ffi (1.17.2-arm-linux-musl)
4366
ffi (1.17.2-arm64-darwin)
44-
ffi (1.17.2-x86-linux-gnu)
45-
ffi (1.17.2-x86-linux-musl)
4667
ffi (1.17.2-x86_64-darwin)
4768
ffi (1.17.2-x86_64-linux-gnu)
4869
ffi (1.17.2-x86_64-linux-musl)
@@ -60,25 +81,91 @@ GEM
6081
http-form_data (2.3.0)
6182
i18n (1.14.7)
6283
concurrent-ruby (~> 1.0)
84+
io-console (0.8.1)
85+
irb (1.15.2)
86+
pp (>= 0.6.0)
87+
rdoc (>= 4.0.0)
88+
reline (>= 0.4.2)
6389
json (2.13.2)
6490
language_server-protocol (3.17.0.5)
6591
lint_roller (1.1.0)
6692
llhttp-ffi (0.5.1)
6793
ffi-compiler (~> 1.0)
6894
rake (~> 13.0)
6995
logger (1.7.0)
96+
loofah (2.24.1)
97+
crass (~> 1.0.2)
98+
nokogiri (>= 1.12.0)
7099
minitest (5.25.5)
100+
monetize (1.13.0)
101+
money (~> 6.12)
102+
money (6.19.0)
103+
i18n (>= 0.6.4, <= 2)
104+
money-rails (1.15.0)
105+
activesupport (>= 3.0)
106+
monetize (~> 1.9)
107+
money (~> 6.13)
108+
railties (>= 3.0)
109+
nokogiri (1.18.9-aarch64-linux-gnu)
110+
racc (~> 1.4)
111+
nokogiri (1.18.9-aarch64-linux-musl)
112+
racc (~> 1.4)
113+
nokogiri (1.18.9-arm-linux-gnu)
114+
racc (~> 1.4)
115+
nokogiri (1.18.9-arm-linux-musl)
116+
racc (~> 1.4)
117+
nokogiri (1.18.9-arm64-darwin)
118+
racc (~> 1.4)
119+
nokogiri (1.18.9-x86_64-darwin)
120+
racc (~> 1.4)
121+
nokogiri (1.18.9-x86_64-linux-gnu)
122+
racc (~> 1.4)
123+
nokogiri (1.18.9-x86_64-linux-musl)
124+
racc (~> 1.4)
71125
parallel (1.27.0)
72126
parser (3.3.9.0)
73127
ast (~> 2.4.1)
74128
racc
129+
pp (0.6.2)
130+
prettyprint
131+
prettyprint (0.2.0)
75132
prism (1.4.0)
133+
psych (5.2.6)
134+
date
135+
stringio
76136
public_suffix (6.0.2)
77137
racc (1.8.1)
78138
rack (3.2.0)
139+
rack-session (2.1.1)
140+
base64 (>= 0.1.0)
141+
rack (>= 3.0.0)
142+
rack-test (2.2.0)
143+
rack (>= 1.3)
144+
rackup (2.2.1)
145+
rack (>= 3)
146+
rails-dom-testing (2.3.0)
147+
activesupport (>= 5.0.0)
148+
minitest
149+
nokogiri (>= 1.6)
150+
rails-html-sanitizer (1.6.2)
151+
loofah (~> 2.21)
152+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
153+
railties (8.0.2.1)
154+
actionpack (= 8.0.2.1)
155+
activesupport (= 8.0.2.1)
156+
irb (~> 1.13)
157+
rackup (>= 1.0.0)
158+
rake (>= 12.2)
159+
thor (~> 1.0, >= 1.2.2)
160+
zeitwerk (~> 2.6)
79161
rainbow (3.1.1)
80162
rake (13.3.0)
163+
rdoc (6.14.2)
164+
erb
165+
psych (>= 4.0.0)
81166
regexp_parser (2.11.2)
167+
reline (0.6.2)
168+
io-console (~> 0.5)
82169
rexml (3.4.2)
83170
rspec (3.13.1)
84171
rspec-core (~> 3.13.0)
@@ -125,29 +212,39 @@ GEM
125212
rubocop (~> 1.72, >= 1.72.1)
126213
ruby-progressbar (1.13.0)
127214
securerandom (0.4.1)
215+
simplecov (0.22.0)
216+
docile (~> 1.1)
217+
simplecov-html (~> 0.11)
218+
simplecov_json_formatter (~> 0.1)
219+
simplecov-html (0.13.2)
220+
simplecov_json_formatter (0.1.4)
221+
simplecov_linter_formatter (0.2.0)
222+
rainbow
223+
simplecov_text_formatter (0.1.0)
224+
stringio (3.1.7)
128225
tabulate (0.1.2)
226+
thor (1.4.0)
129227
tzinfo (2.0.6)
130228
concurrent-ruby (~> 1.0)
131229
unicode-display_width (3.1.5)
132230
unicode-emoji (~> 4.0, >= 4.0.4)
133231
unicode-emoji (4.0.4)
134232
uri (1.0.3)
233+
useragent (0.16.11)
135234
vcr (6.3.1)
136235
base64
137236
webmock (3.25.1)
138237
addressable (>= 2.8.0)
139238
crack (>= 0.3.2)
140239
hashdiff (>= 0.4.0, < 2.0.0)
240+
zeitwerk (2.7.3)
141241

142242
PLATFORMS
143243
aarch64-linux-gnu
144244
aarch64-linux-musl
145245
arm-linux-gnu
146246
arm-linux-musl
147247
arm64-darwin
148-
ruby
149-
x86-linux-gnu
150-
x86-linux-musl
151248
x86_64-darwin
152249
x86_64-linux
153250
x86_64-linux-gnu
@@ -162,6 +259,9 @@ DEPENDENCIES
162259
rubocop-performance (~> 1.25)
163260
rubocop-rails (~> 2.33, >= 2.33.3)
164261
rubocop-rspec (~> 3.6)
262+
simplecov (~> 0.21)
263+
simplecov_linter_formatter
264+
simplecov_text_formatter
165265
vcr (~> 6.3)
166266
webmock
167267

0 commit comments

Comments
 (0)