fintoc 1.0.0 → 1.1.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/pull_request_template.md +0 -1
- data/CHANGELOG.md +14 -2
- data/Gemfile.lock +1 -1
- data/README.md +122 -4
- data/lib/fintoc/base_client.rb +22 -11
- data/lib/fintoc/v2/managers/account_numbers_manager.rb +13 -8
- data/lib/fintoc/v2/managers/account_verifications_manager.rb +5 -4
- data/lib/fintoc/v2/managers/accounts_manager.rb +9 -8
- data/lib/fintoc/v2/managers/simulate_manager.rb +6 -4
- data/lib/fintoc/v2/managers/transfers_manager.rb +13 -8
- data/lib/fintoc/v2/resources/account.rb +5 -4
- data/lib/fintoc/v2/resources/account_number.rb +5 -4
- data/lib/fintoc/v2/resources/transfer.rb +2 -2
- data/lib/fintoc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ce93ceec460af064e29aa8b4108858087ab74c623ba328785f160165c8a8b2f
|
4
|
+
data.tar.gz: a3f1f7dce733d2a9fbdbba43176467d95c03aa60407e2cfef2cce897fea6341c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e33500d7c444114ed0d8d8fbd7e50179b1789faefe70f4e87e9b38badf0a9458f97a3c8fb46bea6a73e50b10225aa263d86ae045ee7fe1db050e5742ecd4427
|
7
|
+
data.tar.gz: 848d3e8b713c20c6ca4d01060aafbb8672f9607f17332e1ff55bb443df19bb14ae8ba2b25eb69394c9b06410ce978c1a78cad9a530cfd4904bacc4ffd6c23b26
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.1.0 - 2025-09-15
|
4
|
+
|
5
|
+
### 🚀 New Features
|
6
|
+
|
7
|
+
- **Idempotency Key Support**: Added comprehensive idempotency key support across all V2 API operations to help prevent duplicate operations during network issues or retries
|
8
|
+
- **Accounts**: `create` and `update` methods now accept the `idempotency_key` parameter
|
9
|
+
- **Account Numbers**: `create` and `update` methods support idempotency keys
|
10
|
+
- **Transfers**: `create` and `return` operations support idempotency keys
|
11
|
+
- **Account Verifications**: `create` method supports idempotency keys
|
12
|
+
- **Simulation**: `receive_transfer` method supports idempotency keys
|
13
|
+
- **Resource-level methods**: Instance methods like `account.update`, `transfer.return_transfer`, and `account.simulate_receive_transfer` all support idempotency keys
|
14
|
+
|
3
15
|
## 1.0.0 - 2025-09-05
|
4
16
|
|
5
17
|
### 🚀 New Features
|
@@ -12,7 +24,7 @@
|
|
12
24
|
|
13
25
|
- **V2 Client - Transfers API Implementation**: Partial implementation of Transfers API endpoints in `Fintoc::V2::Client`
|
14
26
|
- **Entities**: List and retrieve business entities
|
15
|
-
- **
|
27
|
+
- **Accounts**: Create, read, update, and list accounts
|
16
28
|
- **Account Numbers**: Manage account numbers/CLABEs
|
17
29
|
- **Transfers**: Create, retrieve, list, and return transfers
|
18
30
|
- **Simulation**: Simulate receiving transfers for testing
|
@@ -42,4 +54,4 @@
|
|
42
54
|
|
43
55
|
Initial version
|
44
56
|
|
45
|
-
|
57
|
+
- Up to date with the [2020-11-17](https://docs.fintoc.com/docs/api-changelog#2020-11-17) API version
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -28,11 +28,19 @@ Do yourself a favor: go grab some ice cubes by installing this refreshing librar
|
|
28
28
|
- [Get movements](#get-movements)
|
29
29
|
- [Transfers API Examples](#transfers-api-examples)
|
30
30
|
- [Entities](#entities)
|
31
|
-
- [
|
31
|
+
- [Accounts](#accounts)
|
32
32
|
- [Account Numbers](#account-numbers)
|
33
33
|
- [Transfers](#transfers)
|
34
34
|
- [Simulate](#simulate)
|
35
35
|
- [Account Verifications](#account-verifications)
|
36
|
+
- [Idempotency Keys](#idempotency-keys)
|
37
|
+
- [Idempotency Examples](#idempotency-examples)
|
38
|
+
- [Account Methods with Idempotency Key](#account-methods-with-idempotency-key)
|
39
|
+
- [Account Number Methods with Idempotency Key](#account-number-methods-with-idempotency-key)
|
40
|
+
- [Transfer Methods with Idempotency Key](#transfer-methods-with-idempotency-key)
|
41
|
+
- [Simulation with Idempotency Key](#simulation-with-idempotency-key)
|
42
|
+
- [Account Verification with Idempotency Key](#account-verification-with-idempotency-key)
|
43
|
+
- [About idempotency keys](#about-idempotency-keys)
|
36
44
|
- [Development](#development)
|
37
45
|
- [Dependencies](#dependencies)
|
38
46
|
- [Setup](#setup)
|
@@ -107,7 +115,7 @@ client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')
|
|
107
115
|
entities = client.v2.entities.list
|
108
116
|
entity = client.v2.entities.get('entity_id')
|
109
117
|
|
110
|
-
#
|
118
|
+
# Accounts
|
111
119
|
accounts = client.v2.accounts.list
|
112
120
|
account = client.v2.accounts.get('account_id')
|
113
121
|
account = client.v2.accounts.create(entity_id: 'entity_id', description: 'My Account')
|
@@ -265,14 +273,14 @@ You can also list entities with pagination:
|
|
265
273
|
entities = client.v2.entities.list(limit: 10, starting_after: 'entity_id')
|
266
274
|
```
|
267
275
|
|
268
|
-
####
|
276
|
+
#### Accounts
|
269
277
|
|
270
278
|
```ruby
|
271
279
|
require 'fintoc'
|
272
280
|
|
273
281
|
client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')
|
274
282
|
|
275
|
-
# Create
|
283
|
+
# Create an account
|
276
284
|
account = client.v2.accounts.create(
|
277
285
|
entity_id: 'entity_id',
|
278
286
|
description: 'My Business Account'
|
@@ -378,6 +386,116 @@ account_verification = client.v2.account_verifications.get('account_verification
|
|
378
386
|
account_verifications = client.v2.account_verifications.list
|
379
387
|
```
|
380
388
|
|
389
|
+
## Idempotency Keys
|
390
|
+
|
391
|
+
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.
|
392
|
+
|
393
|
+
To use idempotency keys, provide an `idempotency_key` parameter when making POST/PATCH requests:
|
394
|
+
|
395
|
+
### Idempotency Examples
|
396
|
+
|
397
|
+
#### Account Methods with Idempotency Key
|
398
|
+
|
399
|
+
Create and update methods support the use of idempotency keys to prevent duplication:
|
400
|
+
|
401
|
+
```ruby
|
402
|
+
require 'fintoc'
|
403
|
+
require 'securerandom'
|
404
|
+
|
405
|
+
client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')
|
406
|
+
|
407
|
+
idempotency_key = SecureRandom.uuid
|
408
|
+
account = client.v2.accounts.create(
|
409
|
+
entity_id: 'entity_id', description: 'My Business Account', idempotency_key:
|
410
|
+
)
|
411
|
+
|
412
|
+
idempotency_key = SecureRandom.uuid
|
413
|
+
updated_account = client.v2.accounts.update(
|
414
|
+
'account_id', description: 'Updated Description', idempotency_key:
|
415
|
+
)
|
416
|
+
```
|
417
|
+
|
418
|
+
Simulation of transfers can also be done with idempotency key:
|
419
|
+
|
420
|
+
```ruby
|
421
|
+
idempotency_key = SecureRandom.uuid
|
422
|
+
account.simulate_receive_transfer(amount: 1000, idempotency_key:)
|
423
|
+
```
|
424
|
+
|
425
|
+
#### Account Number Methods with Idempotency Key
|
426
|
+
|
427
|
+
Create and update methods support the use of idempotency keys as well:
|
428
|
+
|
429
|
+
```ruby
|
430
|
+
idempotency_key = SecureRandom.uuid
|
431
|
+
account_number = client.v2.account_numbers.create(
|
432
|
+
account_id: 'account_id', description: 'Main account number', idempotency_key:
|
433
|
+
)
|
434
|
+
|
435
|
+
idempotency_key = SecureRandom.uuid
|
436
|
+
updated_account_number = client.v2.account_numbers.update(
|
437
|
+
'account_number_id', description: 'Updated description', idempotency_key:
|
438
|
+
)
|
439
|
+
```
|
440
|
+
|
441
|
+
Simulation of transfers can also be done with idempotency key:
|
442
|
+
|
443
|
+
```ruby
|
444
|
+
account_number.simulate_receive_transfer(amount: 1000, currency: 'MXN', idempotency_key:)
|
445
|
+
```
|
446
|
+
|
447
|
+
#### Transfer Methods with Idempotency Key
|
448
|
+
|
449
|
+
Creating and returning transfers support the use of idempotency keys:
|
450
|
+
|
451
|
+
```ruby
|
452
|
+
idempotency_key = SecureRandom.uuid
|
453
|
+
transfer = client.v2.transfers.create(
|
454
|
+
amount: 10000, currency: 'CLP', account_id: 'account_id', counterparty: { ... }, idempotency_key:
|
455
|
+
)
|
456
|
+
|
457
|
+
idempotency_key = SecureRandom.uuid
|
458
|
+
returned_transfer = client.v2.transfers.return('transfer_id', idempotency_key:)
|
459
|
+
```
|
460
|
+
|
461
|
+
Returning a transfer as an instance method also supports the use of idempotency key:
|
462
|
+
|
463
|
+
```ruby
|
464
|
+
idempotency_key = SecureRandom.uuid
|
465
|
+
transfer.return_transfer(idempotency_key:)
|
466
|
+
```
|
467
|
+
|
468
|
+
#### Simulation with Idempotency Key
|
469
|
+
|
470
|
+
For simulating transfers, the use of idempotency keys is also supported:
|
471
|
+
|
472
|
+
```ruby
|
473
|
+
idempotency_key = SecureRandom.uuid
|
474
|
+
simulated_transfer = client.v2.simulate.receive_transfer(
|
475
|
+
account_number_id: 'account_number_id', amount: 5000, currency: 'CLP', idempotency_key:
|
476
|
+
)
|
477
|
+
```
|
478
|
+
|
479
|
+
#### Account Verification with Idempotency Key
|
480
|
+
|
481
|
+
```ruby
|
482
|
+
idempotency_key = SecureRandom.uuid
|
483
|
+
account_verification = client.v2.account_verifications.create(
|
484
|
+
account_number: 'account_number', idempotency_key:
|
485
|
+
)
|
486
|
+
```
|
487
|
+
|
488
|
+
### About idempotency keys
|
489
|
+
|
490
|
+
- Idempotency keys can be up to 255 characters long
|
491
|
+
- Use consistent unique identifiers for the same logical operation (e.g. order IDs, transaction references). If you set them randomly, we suggest using V4 UUIDs, or another random string with enough entropy to avoid collisions.
|
492
|
+
- The same idempotency key will return the same result, including errors
|
493
|
+
- Keys are automatically removed after 24 hours
|
494
|
+
- Only POST and PATCH requests currently support idempotency keys
|
495
|
+
- If parameters differ with the same key, an error will be raised
|
496
|
+
|
497
|
+
For more information, see the [Fintoc API documentation on idempotent requests](https://docs.fintoc.com/reference/idempotent-requests).
|
498
|
+
|
381
499
|
## Development
|
382
500
|
|
383
501
|
### Dependencies
|
data/lib/fintoc/base_client.rb
CHANGED
@@ -23,25 +23,25 @@ module Fintoc
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def get(version: :v1)
|
26
|
-
request('get', version:
|
26
|
+
request('get', version:)
|
27
27
|
end
|
28
28
|
|
29
29
|
def delete(version: :v1)
|
30
|
-
request('delete', version:
|
30
|
+
request('delete', version:)
|
31
31
|
end
|
32
32
|
|
33
|
-
def post(version: :v1, use_jws: false)
|
34
|
-
request('post', version
|
33
|
+
def post(version: :v1, use_jws: false, idempotency_key: nil)
|
34
|
+
request('post', version:, use_jws:, idempotency_key:)
|
35
35
|
end
|
36
36
|
|
37
|
-
def patch(version: :v1, use_jws: false)
|
38
|
-
request('patch', version
|
37
|
+
def patch(version: :v1, use_jws: false, idempotency_key: nil)
|
38
|
+
request('patch', version:, use_jws:, idempotency_key:)
|
39
39
|
end
|
40
40
|
|
41
|
-
def request(method, version: :v1, use_jws: false)
|
41
|
+
def request(method, version: :v1, use_jws: false, idempotency_key: nil)
|
42
42
|
proc do |resource, **kwargs|
|
43
43
|
parameters = params(method, **kwargs)
|
44
|
-
response = make_request(method, resource, parameters, version
|
44
|
+
response = make_request(method, resource, parameters, version:, use_jws:, idempotency_key:)
|
45
45
|
content = JSON.parse(response.body, symbolize_names: true)
|
46
46
|
|
47
47
|
if response.status.client_error? || response.status.server_error?
|
@@ -91,7 +91,13 @@ module Fintoc
|
|
91
91
|
use_jws && @jws && %w[post patch put].include?(method.downcase)
|
92
92
|
end
|
93
93
|
|
94
|
-
def
|
94
|
+
def should_use_idempotency_key?(method, idempotency_key)
|
95
|
+
idempotency_key && %w[post patch put].include?(method.downcase)
|
96
|
+
end
|
97
|
+
|
98
|
+
def make_request(
|
99
|
+
method, resource, parameters, version: :v1, use_jws: false, idempotency_key: nil
|
100
|
+
)
|
95
101
|
# this is to handle url returned in the link headers
|
96
102
|
# I'm sure there is a better and more clever way to solve this
|
97
103
|
if resource.start_with? 'https'
|
@@ -99,15 +105,20 @@ module Fintoc
|
|
99
105
|
end
|
100
106
|
|
101
107
|
url = build_url(resource, version:)
|
108
|
+
request_client = client
|
102
109
|
|
103
110
|
if should_use_jws?(method, use_jws)
|
104
111
|
request_body = parameters[:json]&.to_json || ''
|
105
112
|
jws_signature = @jws.generate_signature(request_body)
|
106
113
|
|
107
|
-
|
114
|
+
request_client = request_client.headers('Fintoc-JWS-Signature' => jws_signature)
|
115
|
+
end
|
116
|
+
|
117
|
+
if should_use_idempotency_key?(method, idempotency_key)
|
118
|
+
request_client = request_client.headers('Idempotency-Key' => idempotency_key)
|
108
119
|
end
|
109
120
|
|
110
|
-
|
121
|
+
request_client.send(method, url, parameters)
|
111
122
|
end
|
112
123
|
|
113
124
|
def params(method, **kwargs)
|
@@ -8,8 +8,10 @@ module Fintoc
|
|
8
8
|
@client = client
|
9
9
|
end
|
10
10
|
|
11
|
-
def create(account_id:, description: nil, metadata: nil, **params)
|
12
|
-
data = _create_account_number(
|
11
|
+
def create(account_id:, description: nil, metadata: nil, idempotency_key: nil, **params)
|
12
|
+
data = _create_account_number(
|
13
|
+
account_id:, description:, metadata:, idempotency_key:, **params
|
14
|
+
)
|
13
15
|
build_account_number(data)
|
14
16
|
end
|
15
17
|
|
@@ -22,20 +24,22 @@ module Fintoc
|
|
22
24
|
_list_account_numbers(**params).map { |data| build_account_number(data) }
|
23
25
|
end
|
24
26
|
|
25
|
-
def update(account_number_id, **params)
|
26
|
-
data = _update_account_number(account_number_id, **params)
|
27
|
+
def update(account_number_id, idempotency_key: nil, **params)
|
28
|
+
data = _update_account_number(account_number_id, idempotency_key:, **params)
|
27
29
|
build_account_number(data)
|
28
30
|
end
|
29
31
|
|
30
32
|
private
|
31
33
|
|
32
|
-
def _create_account_number(
|
34
|
+
def _create_account_number(
|
35
|
+
account_id:, description: nil, metadata: nil, idempotency_key: nil, **params
|
36
|
+
)
|
33
37
|
request_params = { account_id: }
|
34
38
|
request_params[:description] = description if description
|
35
39
|
request_params[:metadata] = metadata if metadata
|
36
40
|
request_params.merge!(params)
|
37
41
|
|
38
|
-
@client.post(version: :v2).call('account_numbers', **request_params)
|
42
|
+
@client.post(version: :v2, idempotency_key:).call('account_numbers', **request_params)
|
39
43
|
end
|
40
44
|
|
41
45
|
def _get_account_number(account_number_id)
|
@@ -46,8 +50,9 @@ module Fintoc
|
|
46
50
|
@client.get(version: :v2).call('account_numbers', **params)
|
47
51
|
end
|
48
52
|
|
49
|
-
def _update_account_number(account_number_id, **params)
|
50
|
-
@client.patch(version: :v2
|
53
|
+
def _update_account_number(account_number_id, idempotency_key: nil, **params)
|
54
|
+
@client.patch(version: :v2, idempotency_key:)
|
55
|
+
.call("account_numbers/#{account_number_id}", **params)
|
51
56
|
end
|
52
57
|
|
53
58
|
def build_account_number(data)
|
@@ -8,8 +8,8 @@ module Fintoc
|
|
8
8
|
@client = client
|
9
9
|
end
|
10
10
|
|
11
|
-
def create(account_number:)
|
12
|
-
data = _create_account_verification(account_number:)
|
11
|
+
def create(account_number:, idempotency_key: nil)
|
12
|
+
data = _create_account_verification(account_number:, idempotency_key:)
|
13
13
|
build_account_verification(data)
|
14
14
|
end
|
15
15
|
|
@@ -24,8 +24,9 @@ module Fintoc
|
|
24
24
|
|
25
25
|
private
|
26
26
|
|
27
|
-
def _create_account_verification(account_number:)
|
28
|
-
@client.post(version: :v2, use_jws: true
|
27
|
+
def _create_account_verification(account_number:, idempotency_key: nil)
|
28
|
+
@client.post(version: :v2, use_jws: true, idempotency_key:)
|
29
|
+
.call('account_verifications', account_number:)
|
29
30
|
end
|
30
31
|
|
31
32
|
def _get_account_verification(account_verification_id)
|
@@ -8,8 +8,8 @@ module Fintoc
|
|
8
8
|
@client = client
|
9
9
|
end
|
10
10
|
|
11
|
-
def create(entity_id:, description:, **params)
|
12
|
-
data = _create_account(entity_id:, description:, **params)
|
11
|
+
def create(entity_id:, description:, idempotency_key: nil, **params)
|
12
|
+
data = _create_account(entity_id:, description:, idempotency_key:, **params)
|
13
13
|
build_account(data)
|
14
14
|
end
|
15
15
|
|
@@ -22,15 +22,16 @@ module Fintoc
|
|
22
22
|
_list_accounts(**params).map { |data| build_account(data) }
|
23
23
|
end
|
24
24
|
|
25
|
-
def update(account_id, **params)
|
26
|
-
data = _update_account(account_id, **params)
|
25
|
+
def update(account_id, idempotency_key: nil, **params)
|
26
|
+
data = _update_account(account_id, idempotency_key:, **params)
|
27
27
|
build_account(data)
|
28
28
|
end
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
|
-
def _create_account(entity_id:, description:, **params)
|
33
|
-
@client.post(version: :v2
|
32
|
+
def _create_account(entity_id:, description:, idempotency_key: nil, **params)
|
33
|
+
@client.post(version: :v2, idempotency_key:)
|
34
|
+
.call('accounts', entity_id:, description:, **params)
|
34
35
|
end
|
35
36
|
|
36
37
|
def _get_account(account_id)
|
@@ -41,8 +42,8 @@ module Fintoc
|
|
41
42
|
@client.get(version: :v2).call('accounts', **params)
|
42
43
|
end
|
43
44
|
|
44
|
-
def _update_account(account_id, **params)
|
45
|
-
@client.patch(version: :v2).call("accounts/#{account_id}", **params)
|
45
|
+
def _update_account(account_id, idempotency_key: nil, **params)
|
46
|
+
@client.patch(version: :v2, idempotency_key:).call("accounts/#{account_id}", **params)
|
46
47
|
end
|
47
48
|
|
48
49
|
def build_account(data)
|
@@ -8,16 +8,18 @@ module Fintoc
|
|
8
8
|
@client = client
|
9
9
|
end
|
10
10
|
|
11
|
-
def receive_transfer(account_number_id:, amount:, currency:)
|
12
|
-
data = _simulate_receive_transfer(
|
11
|
+
def receive_transfer(account_number_id:, amount:, currency:, idempotency_key: nil)
|
12
|
+
data = _simulate_receive_transfer(
|
13
|
+
account_number_id:, amount:, currency:, idempotency_key:
|
14
|
+
)
|
13
15
|
build_transfer(data)
|
14
16
|
end
|
15
17
|
|
16
18
|
private
|
17
19
|
|
18
|
-
def _simulate_receive_transfer(account_number_id:, amount:, currency:)
|
20
|
+
def _simulate_receive_transfer(account_number_id:, amount:, currency:, idempotency_key: nil)
|
19
21
|
@client
|
20
|
-
.post(version: :v2)
|
22
|
+
.post(version: :v2, idempotency_key:)
|
21
23
|
.call('simulate/receive_transfer', account_number_id:, amount:, currency:)
|
22
24
|
end
|
23
25
|
|
@@ -8,8 +8,10 @@ module Fintoc
|
|
8
8
|
@client = client
|
9
9
|
end
|
10
10
|
|
11
|
-
def create(amount:, currency:, account_id:, counterparty:, **params)
|
12
|
-
data = _create_transfer(
|
11
|
+
def create(amount:, currency:, account_id:, counterparty:, idempotency_key: nil, **params)
|
12
|
+
data = _create_transfer(
|
13
|
+
amount:, currency:, account_id:, counterparty:, idempotency_key:, **params
|
14
|
+
)
|
13
15
|
build_transfer(data)
|
14
16
|
end
|
15
17
|
|
@@ -22,16 +24,18 @@ module Fintoc
|
|
22
24
|
_list_transfers(**params).map { |data| build_transfer(data) }
|
23
25
|
end
|
24
26
|
|
25
|
-
def return(transfer_id)
|
26
|
-
data = _return_transfer(transfer_id)
|
27
|
+
def return(transfer_id, idempotency_key: nil)
|
28
|
+
data = _return_transfer(transfer_id, idempotency_key:)
|
27
29
|
build_transfer(data)
|
28
30
|
end
|
29
31
|
|
30
32
|
private
|
31
33
|
|
32
|
-
def _create_transfer(
|
34
|
+
def _create_transfer(
|
35
|
+
amount:, currency:, account_id:, counterparty:, idempotency_key: nil, **params
|
36
|
+
)
|
33
37
|
@client
|
34
|
-
.post(version: :v2, use_jws: true)
|
38
|
+
.post(version: :v2, use_jws: true, idempotency_key:)
|
35
39
|
.call('transfers', amount:, currency:, account_id:, counterparty:, **params)
|
36
40
|
end
|
37
41
|
|
@@ -43,8 +47,9 @@ module Fintoc
|
|
43
47
|
@client.get(version: :v2).call('transfers', **params)
|
44
48
|
end
|
45
49
|
|
46
|
-
def _return_transfer(transfer_id)
|
47
|
-
@client.post(version: :v2, use_jws: true
|
50
|
+
def _return_transfer(transfer_id, idempotency_key: nil)
|
51
|
+
@client.post(version: :v2, use_jws: true, idempotency_key:)
|
52
|
+
.call('transfers/return', transfer_id:)
|
48
53
|
end
|
49
54
|
|
50
55
|
def build_transfer(data)
|
@@ -44,11 +44,11 @@ module Fintoc
|
|
44
44
|
refresh_from_account(fresh_account)
|
45
45
|
end
|
46
46
|
|
47
|
-
def update(description: nil)
|
47
|
+
def update(description: nil, idempotency_key: nil)
|
48
48
|
params = {}
|
49
49
|
params[:description] = description if description
|
50
50
|
|
51
|
-
updated_account = @client.accounts.update(@id, **params)
|
51
|
+
updated_account = @client.accounts.update(@id, idempotency_key:, **params)
|
52
52
|
refresh_from_account(updated_account)
|
53
53
|
end
|
54
54
|
|
@@ -68,7 +68,7 @@ module Fintoc
|
|
68
68
|
@mode == 'test'
|
69
69
|
end
|
70
70
|
|
71
|
-
def simulate_receive_transfer(amount:)
|
71
|
+
def simulate_receive_transfer(amount:, idempotency_key: nil)
|
72
72
|
unless test_mode?
|
73
73
|
raise Fintoc::Errors::InvalidRequestError, 'Simulation is only available in test mode'
|
74
74
|
end
|
@@ -76,7 +76,8 @@ module Fintoc
|
|
76
76
|
@client.simulate.receive_transfer(
|
77
77
|
account_number_id: @root_account_number_id,
|
78
78
|
amount:,
|
79
|
-
currency: @currency
|
79
|
+
currency: @currency,
|
80
|
+
idempotency_key:
|
80
81
|
)
|
81
82
|
end
|
82
83
|
|
@@ -42,13 +42,13 @@ module Fintoc
|
|
42
42
|
refresh_from_account_number(fresh_account_number)
|
43
43
|
end
|
44
44
|
|
45
|
-
def update(description: nil, status: nil, metadata: nil)
|
45
|
+
def update(description: nil, status: nil, metadata: nil, idempotency_key: nil)
|
46
46
|
params = {}
|
47
47
|
params[:description] = description if description
|
48
48
|
params[:status] = status if status
|
49
49
|
params[:metadata] = metadata if metadata
|
50
50
|
|
51
|
-
updated_account_number = @client.account_numbers.update(@id, **params)
|
51
|
+
updated_account_number = @client.account_numbers.update(@id, idempotency_key:, **params)
|
52
52
|
refresh_from_account_number(updated_account_number)
|
53
53
|
end
|
54
54
|
|
@@ -68,7 +68,7 @@ module Fintoc
|
|
68
68
|
@mode == 'test'
|
69
69
|
end
|
70
70
|
|
71
|
-
def simulate_receive_transfer(amount:, currency: 'MXN')
|
71
|
+
def simulate_receive_transfer(amount:, currency: 'MXN', idempotency_key: nil)
|
72
72
|
unless test_mode?
|
73
73
|
raise Fintoc::Errors::InvalidRequestError, 'Simulation is only available in test mode'
|
74
74
|
end
|
@@ -76,7 +76,8 @@ module Fintoc
|
|
76
76
|
@client.simulate.receive_transfer(
|
77
77
|
account_number_id: @id,
|
78
78
|
amount:,
|
79
|
-
currency
|
79
|
+
currency:,
|
80
|
+
idempotency_key:
|
80
81
|
)
|
81
82
|
end
|
82
83
|
|
@@ -62,8 +62,8 @@ module Fintoc
|
|
62
62
|
refresh_from_transfer(fresh_transfer)
|
63
63
|
end
|
64
64
|
|
65
|
-
def return_transfer
|
66
|
-
returned_transfer = @client.transfers.return(@id)
|
65
|
+
def return_transfer(idempotency_key: nil)
|
66
|
+
returned_transfer = @client.transfers.return(@id, idempotency_key:)
|
67
67
|
refresh_from_transfer(returned_transfer)
|
68
68
|
end
|
69
69
|
|
data/lib/fintoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fintoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Ca Sardin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|