-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathejemplo-timbres.ts
More file actions
41 lines (33 loc) · 1.21 KB
/
ejemplo-timbres.ts
File metadata and controls
41 lines (33 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { FiscalapiClient, FiscalapiSettings } from '../src/index';
async function main(): Promise<void> {
const settings: FiscalapiSettings = {
apiUrl: 'https://test.fisalapi.com',
apiKey: '<API_KEY>',
tenant: '<TENANT_ID>',
debug: true
};
const client = FiscalapiClient.create(settings);
// 1. Listar transacciones de timbres
const list = await client.stamps.getList(1, 10);
console.log('Lista de transacciones:', list);
// 2. Obtener transacción por ID
const transaction = await client.stamps.getById('77678d6d-94b1-4635-aa91-15cdd7423aab');
console.log('Transacción por ID:', transaction);
// 3. Transferir timbres
const transfer = await client.stamps.transferStamps({
fromPersonId: '2e7b988f-3a2a-4f67-86e9-3f931dd48581',
toPersonId: '5fd9f48c-a6a2-474f-944b-88a01751d432',
amount: 1,
comments: 'Transferencia de prueba'
});
console.log('Transferencia:', transfer);
// 4. Retirar timbres
const withdraw = await client.stamps.withdrawStamps({
fromPersonId: '5fd9f48c-a6a2-474f-944b-88a01751d432',
toPersonId: '2e7b988f-3a2a-4f67-86e9-3f931dd48581',
amount: 1,
comments: 'Retiro de prueba'
});
console.log('Retiro:', withdraw);
}
main();