-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathejemplo-datos-empleado-empleador.ts
More file actions
61 lines (52 loc) · 2.06 KB
/
ejemplo-datos-empleado-empleador.ts
File metadata and controls
61 lines (52 loc) · 2.06 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import {
FiscalapiClient,
FiscalapiSettings,
CreateEmployerRequest,
CreateEmployeeRequest
} from '../src';
async function main(): Promise<void> {
// Configuración de FiscalAPI
const settings: FiscalapiSettings = {
apiUrl: 'https://test.fiscalapi.com', // https://live.fiscalapi.com
apiKey: '<api-key>', // API key de FiscalAPI
tenant: '<tenant>', // Tenant de FiscalAPI
debug: true // true, imprime raw request y response en consola, util durante el desarrollo de la integración.
};
const client = FiscalapiClient.create(settings);
const escuelaKemperUrgateId = '<id-empleador>';
const karlaFuenteNolascoId = '<id-empleado>';
// Crear datos de empleador
const employerRequest: CreateEmployerRequest = {
personId: escuelaKemperUrgateId,
employerRegistration: 'B5510768108',
};
const employerResult = await client.persons.employer.create(employerRequest);
console.log('Empleador:', JSON.stringify(employerResult, null, 2));
// Crear datos de empleado
const employeeRequest: CreateEmployeeRequest = {
employerPersonId: escuelaKemperUrgateId,
employeePersonId: karlaFuenteNolascoId,
employeeNumber: '123456789',
socialSecurityNumber: '04078873454',
laborRelationStartDate: '2024-08-18',
satContractTypeId: '01',
satTaxRegimeTypeId: '02',
satJobRiskId: '1',
satPaymentPeriodicityId: '05',
satBankId: '012',
satPayrollStateId: 'JAL',
department: 'GenAI',
position: 'Sr Software Engineer',
seniority: 'P54W',
baseSalaryForContributions: 2828.50,
integratedDailySalary: 0.00,
};
const employeeResult = await client.persons.employee.create(employeeRequest);
console.log('Empleado:', JSON.stringify(employeeResult, null, 2));
// Consultar datos
const employer = await client.persons.employer.getById(escuelaKemperUrgateId);
console.log('Consulta empleador:', JSON.stringify(employer, null, 2));
const employee = await client.persons.employee.getById(karlaFuenteNolascoId);
console.log('Consulta empleado:', JSON.stringify(employee, null, 2));
}
main().catch(console.error);