diff --git a/README.md b/README.md index 30bf1be..67d8e7b 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ Resources follow the pattern `fintoc [v2] [args] [flags]`. A | `v2 entities` | create, get, list, settlement_account | | `v2 onboardings` | create, get, list, submit, upload_document, add_document, delete_document, upload_shareholder_document, upload_legal_representative_document | | `v2 payment_intents` | create, get, list, cancel, voucher_url, check_eligibility | -| `v2 payment_methods` | create, get, list, cancel, mandate_document | +| `v2 payment_methods` | create, get, list, cancel, mandate_document, installments | | `v2 products` | create, get, list, update | | `v2 subscriptions` | create, get, list, update, cancel, detach_payment_method | | `v2 invoices` | create, get, list, update, finalize, pay, void, mark_uncollectible, add_lines, remove_lines | @@ -126,7 +126,7 @@ Resources follow the pattern `fintoc [v2] [args] [flags]`. A | `v2 simulate` | receive_transfer | | `v2 crossborder_beneficiaries` | create, get, list, delete | | `v2 crossborder_quotes` | create, get | -| `v2 crossborder_transfers` | create, get, list | +| `v2 crossborder_transfers` | create, get, list, cancel, simulate_credit | `organizations create` preserves the published `--products ` and `--metadata ` flags. Updating organizations requires a future SDK release; fintoc 1.31.0 only supports creation. diff --git a/package-lock.json b/package-lock.json index 2f0cda1..7540e0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@inquirer/prompts": "^8.4.2", "commander": "^14.0.3", "es-toolkit": "^1.46.1", - "fintoc": "^1.33.0", + "fintoc": "^1.35.0", "smol-toml": "^1.6.1", "ws": "^8.20.0", "zod": "^4.4.3" @@ -4473,9 +4473,9 @@ } }, "node_modules/fintoc": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/fintoc/-/fintoc-1.33.0.tgz", - "integrity": "sha512-+R/z2Rdv/X3PN2aWBaw0vWhJUC3FLSggcioRs9RSQ5K6QyBDlm4kX8nMwEi1eooHZoIyLSKbo79FmD9GVIy1RA==", + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/fintoc/-/fintoc-1.35.0.tgz", + "integrity": "sha512-Y7N7VvGpKhVDnDtM2x33l8CHE+gqDOuxykMK6ssPiKNGsrxehNkS4CgnJqJ6dKMo9VhuM5kWDZiNJ9efcegXXg==", "license": "BSD-3-Clause", "dependencies": { "@types/node": "^22.15.18", diff --git a/package.json b/package.json index c6a5ae9..b54323b 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@inquirer/prompts": "^8.4.2", "commander": "^14.0.3", "es-toolkit": "^1.46.1", - "fintoc": "^1.33.0", + "fintoc": "^1.35.0", "smol-toml": "^1.6.1", "ws": "^8.20.0", "zod": "^4.4.3" diff --git a/src/resources/__tests__/registry.test.ts b/src/resources/__tests__/registry.test.ts index fc9b408..fdfc537 100644 --- a/src/resources/__tests__/registry.test.ts +++ b/src/resources/__tests__/registry.test.ts @@ -550,6 +550,27 @@ describe('resource registry', () => { } }) + test('v2 payment_methods installments is a read that requires amount and currency', () => { + const installments = find('payment_methods', 'v2').actions!.find( + (a) => a.name === 'installments', + )! + expect(installments.sdkMethod).toBe('installments') + expect(installments.kind).toBe('read') + expect(installments.flags!.filter((f) => f.required).map((f) => f.name)).toEqual([ + 'amount', + 'currency', + ]) + }) + + test.each([ + ['cancel', 'cancel'], + ['simulate_credit', 'simulateCredit'], + ])('v2 crossborder_transfers %s is an idempotent write', (name, sdkMethod) => { + const action = find('crossborder_transfers', 'v2').actions!.find((a) => a.name === name)! + expect(action.sdkMethod).toBe(sdkMethod) + expect(action.idempotencyKey).toBe(true) + }) + test('payment_methods create requires the four consent documents as files', () => { const files = find('payment_methods', 'v2').createFiles! expect(files.map((f) => f.field)).toEqual([ diff --git a/src/resources/registry.ts b/src/resources/registry.ts index 2300ba2..1c58e40 100644 --- a/src/resources/registry.ts +++ b/src/resources/registry.ts @@ -2239,6 +2239,18 @@ export const resources: ResourceDef[] = [ required: true, description: 'ID of the payment method to charge', }, + { + name: 'off-session', + type: 'boolean', + description: + 'Charge while the customer is absent (defaults to true; false only for CLP card payments in Chile)', + }, + { + name: 'card-installments', + type: 'integer', + nestedPath: 'payment_method_options.card.installments', + description: 'Number of installments to charge the card in (only with off-session false)', + }, { name: 'metadata', type: 'map', @@ -2352,6 +2364,12 @@ export const resources: ResourceDef[] = [ nestedPath: 'payment_options.amount', description: 'Only payment methods that can pay this amount', }, + { + name: 'payment-options-off-session', + type: 'boolean', + nestedPath: 'payment_options.off_session', + description: 'Set to false to list only cards the customer can pay with while present', + }, ], createFlags: [ { @@ -2456,6 +2474,26 @@ export const resources: ResourceDef[] = [ description: 'Get the download URL of the mandate contract', kind: 'read', }, + { + name: 'installments', + sdkMethod: 'installments', + description: 'Get the numbers of installments a saved card accepts for an amount', + kind: 'read', + flags: [ + { + name: 'amount', + type: 'integer', + required: true, + description: 'Amount to charge in the smallest currency unit', + }, + { + name: 'currency', + type: 'string', + required: true, + description: 'Currency code (CLP)', + }, + ], + }, ], }, { @@ -3562,6 +3600,24 @@ export const resources: ResourceDef[] = [ description: 'Filter by direction (mx_to_usd, usd_to_mx)', }, ], + actions: [ + { + name: 'cancel', + idempotencyKey: true, + sdkMethod: 'cancel', + description: 'Cancel a usdt_to_mx transfer that is waiting for its USDT', + confirm: true, + successMessage: "{resource} '{id}' canceled", + }, + { + name: 'simulate_credit', + idempotencyKey: true, + sdkMethod: 'simulateCredit', + description: + 'Simulate the credit of the pesos of a usd_to_mx or usdt_to_mx transfer (test mode)', + successMessage: "Credit of {resource} '{id}' simulated", + }, + ], }, ]