diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..3877e65 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,82 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +Official Java SDK for FiscalAPI - a Mexican CFDI electronic invoicing service (SAT integration). Provides CFDI 4.0 invoicing, certificate management, mass downloads, payroll, and SAT catalog queries. + +## Build Commands + +```bash +mvn clean compile # Compile +mvn test # Run tests +mvn package # Create JAR +mvn clean deploy -Prelease # Deploy to Maven Central (requires GPG) +``` + +## Architecture + +### Entry Point +`FiscalApiClient.create(FiscalApiSettings)` - Factory method creating the main client with all services. + +### Service Layer Pattern +``` +IFiscalApiClient (facade) + ├── getInvoiceService() → IInvoiceService extends IFiscalApiService + ├── getPersonService() → IPersonService extends IFiscalApiService + ├── getProductService() → IProductService extends IFiscalApiService + ├── getTaxFileService() → ITaxFileService extends IFiscalApiService + ├── getCatalogService() → ICatalogService extends IFiscalApiService + └── ... (other services) +``` + +### Generic CRUD Base +All services extend `BaseFiscalApiService` which implements standard CRUD: +- `getList(pageNumber, pageSize)` → `ApiResponse>` +- `getById(id, details)` → `ApiResponse` +- `create(model)` → `ApiResponse` +- `update(model)` → `ApiResponse` +- `delete(id)` → `ApiResponse` + +Subclasses must implement `getTypeParameterClass()` to return the entity type for Jackson deserialization. + +### DTO Hierarchy +``` +SerializableDto → AuditableDto (createdAt, updatedAt) → BaseDto (id) +``` +All models extend `BaseDto`. Responses wrapped in `ApiResponse`. + +### HTTP Layer +- `OkHttpClientFactory` - Creates/caches OkHttpClient instances with auth headers (X-API-KEY, X-TENANT-KEY, X-API-VERSION, X-TIMEZONE) +- `FiscalApiHttpClient` - Wraps OkHttp with Jackson, handles request/response logging in debug mode + +### Key Packages +- `abstractions/` - Service interfaces +- `common/` - ApiResponse, PagedList, settings +- `http/` - HTTP client implementation +- `models/` - All DTOs (invoicing/, downloading/ subpackages) +- `services/` - Service implementations + +## Configuration + +```java +FiscalApiSettings settings = new FiscalApiSettings(); +settings.setApiUrl("https://test.fiscalapi.com"); // or https://live.fiscalapi.com +settings.setApiKey("sk_test_..."); +settings.setTenant("..."); +settings.setDebugMode(true); // Logs requests/responses +FiscalApiClient client = FiscalApiClient.create(settings); +``` + +## API Endpoint Pattern + +`{apiUrl}/api/{apiVersion}/{resource}/{id?}/{action?}` + +Example: `POST api/v4/invoices`, `GET api/v4/invoices/{id}?details=true` + +## Dependencies + +- OkHttp3 4.12.0 (HTTP) +- Jackson 2.14.2 (JSON) +- Java 8+ (source/target) diff --git a/README.md b/README.md index d8a6352..d268314 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,15 @@ - **Soporte completo para CFDI 4.0** con todas las especificaciones oficiales - **Timbrado de facturas de ingreso** con validación automática - **Timbrado de notas de crédito** (facturas de egreso) -- **Timbrado de complementos de pago** en MXN, USD y EUR. +- **Timbrado de complementos de pago** en MXN, USD y EUR +- **Timbrado de facturas de nómina** - Soporte para los 13 tipos de CFDI de nómina - **Consulta del estatus de facturas** en el SAT en tiempo real - **Cancelación de facturas** - **Generación de archivos PDF** de las facturas con formato profesional - **Personalización de logos y colores** en los PDF generados - **Envío de facturas por correo electrónico** automatizado - **Descarga de archivos XML** con estructura completa -- **Almacenamiento y recuperación** de facturas por 5 años. +- **Almacenamiento y recuperación** de facturas por 5 años - Dos [modos de operación](https://docs.fiscalapi.com/modes-of-operation): **Por valores** o **Por referencias** ## 📥 Descarga Masiva @@ -32,16 +33,29 @@ - **Administración de personas** (emisores, receptores, clientes, usuarios, etc.) - **Gestión de certificados CSD y FIEL** (subir archivos .cer y .key a FiscalAPI) - **Configuración de datos fiscales** (RFC, domicilio fiscal, régimen fiscal) +- **Datos de empleado** (agrega/actualiza/elimina datos de empleado a una persona. CFDI Nómina) +- **Datos de empleador** (agrega/actualiza/elimina datos de empleador a una persona. CFDI Nómina) + +## 🎖️ Gestión de Timbres +- **Gestión de folios fiscales** Compra timbres a fiscalapi y transfiere/retira a las personas de tu organizacion segun tus reglas de negocio. ## 🛍️ Gestión de Productos/Servicios - **Gestión de productos y servicios** con catálogo personalizable - **Administración de impuestos aplicables** (IVA, ISR, IEPS) +- **Timbres** + Listar transacciones, transferir y retirar timbres entre personas. ## 📚 Consulta de Catálogos SAT - **Consulta en catálogos oficiales del SAT** actualizados - **Consulta en catálogos oficiales de Descarga masiva del SAT** actualizados - **Búsqueda de información** en catálogos del SAT con filtros avanzados - **Acceso y búsqueda** en catálogos completos + +## 🎫 Gestión de Timbres +- **Listar transacciones de timbres** con paginación +- **Consultar transacciones** por ID +- **Transferir timbres** entre personas +- **Retirar timbres** de una persona ## 📖 Recursos Adicionales - **Cientos de ejemplos de código** disponibles en múltiples lenguajes de programación diff --git a/pom.xml b/pom.xml index 274c8b9..758329d 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.fiscalapi fiscalapi - 4.0.273 + 4.0.360 ${project.groupId}:${project.artifactId} Genera facturas CFDI válidas ante el SAT consumiendo la API de https://www.fiscalapi.com https://www.fiscalapi.com diff --git a/src/main/java/com/fiscalapi/Examples.java b/src/main/java/com/fiscalapi/Examples.java index b636a29..38183e6 100644 --- a/src/main/java/com/fiscalapi/Examples.java +++ b/src/main/java/com/fiscalapi/Examples.java @@ -1,13 +1,11 @@ package com.fiscalapi; -import com.fiscalapi.common.ApiResponse; import com.fiscalapi.common.FiscalApiSettings; -import com.fiscalapi.common.PagedList; -import com.fiscalapi.models.downloading.DownloadRequest; -import com.fiscalapi.models.downloading.DownloadRule; -import com.fiscalapi.models.invoicing.*; +import com.fiscalapi.models.invoicing.payroll.PayrollEarningOvertime; +import com.fiscalapi.models.invoicing.payroll.PayrollEarnings; +import com.fiscalapi.models.invoicing.payroll.PayrollRetirement; +import com.fiscalapi.models.invoicing.payroll.PayrollSeverance; import com.fiscalapi.services.FiscalApiClient; -import java.time.LocalDate; import java.time.LocalDateTime; import java.util.*; @@ -26,17 +24,15 @@ public void run() { System.out.printf("%s\n", "Hello Fiscalapi!"); - FiscalApiSettings settings = new FiscalApiSettings(); - settings.setDebugMode(true); - settings.setApiUrl("https://test.fiscalapi.com"); - //settings.setApiKey(""); - settings.setApiKey("sk_test_4e7ca2f5_6c02_4571_9767_212f32cebd59"); - settings.setTenant("102e5f13-e114-41dd-bea7-507fce177281"); - //settings.setTenant(""); + // FiscalApiSettings settings = new FiscalApiSettings(); + // settings.setDebugMode(true); + // settings.setApiUrl("https://test.fiscalapi.com"); + // settings.setApiKey(""); + // settings.setTenant(""); - FiscalApiClient client = FiscalApiClient.create(settings); + // FiscalApiClient client = FiscalApiClient.create(settings); //region Personas (emisores/clientes/empresas, receptores/clientes/empresas, usuarios) @@ -74,6 +70,107 @@ public void run() { // // ***Eliminar persona ***// // ApiResponse apiResponse = client.getPersonService().delete("ca3df64a-2ecc-47b0-899d-38c29141979e"); // System.out.println(apiResponse); + + // region Datos de empleador + //Obtener datos de empleador + //ApiResponse apiResponse = client.getPersonService().getEmployerService().GetById("0e82a655-5f0c-4e07-abab-8f322e4123ef"); + //System.out.println(apiResponse); + + //Crear datos de empleador + /* + String personId = "bd199ed8-02ef-47c0-919c-9479dd8ecae7"; + + EmployerData employerData = new EmployerData(); + employerData.setPersonId(personId); + employerData.setEmployerRegistration("B5510768108"); + employerData.setOriginEmployerTin("URE180429TM6"); + + ApiResponse apiResponse = client.getPersonService().getEmployerService().Create(employerData); + System.out.println(apiResponse); + */ + //Actualizar datos de empleador + /* + String personId = "bd199ed8-02ef-47c0-919c-9479dd8ecae7"; + + EmployerData employerData = new EmployerData(); + employerData.setPersonId(personId); + employerData.setEmployerRegistration("A1230768108"); + employerData.setOriginEmployerTin("ARE180429TM6"); + + ApiResponse apiResponse = client.getPersonService().getEmployerService().Create(employerData); + System.out.println(apiResponse); + */ + + //Eliminar datos de empleador + //ApiResponse apiResponse = client.getPersonService().getEmployerService().Delete("0e82a655-5f0c-4e07-abab-8f322e4123ef"); + //System.out.println(apiResponse); +// endregion +//region Datos de empleado + //Datos de empleado + //Obtener datos de empleado + //ApiResponse apiResponse = client.getPersonService().getEmployerService().GetById("0e82a655-5f0c-4e07-abab-8f322e4123ef"); + //System.out.println(apiResponse); + + //Crear datos de empleado + /* + EmployeeData employeeData = new EmployeeData(); + + employeeData.setEmployerPersonId("bef56254-0892-4558-95c3-f9c8729e4b0e"); + employeeData.setEmployeePersonId("54fc14ae-c88f-4afc-996b-0574d63341e2"); + employeeData.setEmployeeNumber("12345"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatTaxRegimeTypeId("02"); + employeeData.setSatPaymentPeriodicityId("04"); + employeeData.setSatPayrollStateId("JAL"); + employeeData.setSocialSecurityNumber("123456789012345"); + employeeData.setLaborRelationStartDate("2023-01-15T00:00:00"); + employeeData.setSatWorkdayTypeId("01"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatBankId("002"); + employeeData.setSatUnionizedStatusId("No"); + employeeData.setDepartment("Recursos Humanos"); + employeeData.setPosition("Analista de Nóminas"); + employeeData.setSeniority("7Y3M1W"); + employeeData.setBankAccount("12345678901234567890"); + employeeData.setBaseSalaryForContributions("490.22"); + employeeData.setIntegratedDailySalary("146.47"); + + ApiResponse apiResponse = client.getPersonService().getEmployeeService().Create(employeeData); + System.out.println(apiResponse); + */ + + //Actualizar datos de empleado + /* + EmployeeData employeeData = new EmployeeData(); + + employeeData.setEmployerPersonId("bef56254-0892-4558-95c3-f9c8729e4b0e"); + employeeData.setEmployeePersonId("54fc14ae-c88f-4afc-996b-0574d63341e2"); + employeeData.setEmployeeNumber("12345"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatTaxRegimeTypeId("02"); + employeeData.setSatPaymentPeriodicityId("04"); + employeeData.setSatPayrollStateId("JAL"); + employeeData.setSocialSecurityNumber("123456789012345"); + employeeData.setLaborRelationStartDate("2023-01-15T00:00:00"); + employeeData.setSatWorkdayTypeId("01"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatBankId("002"); + employeeData.setSatUnionizedStatusId("No"); + employeeData.setDepartment("Recursos Humanos"); + employeeData.setPosition("Analista de Nóminas"); + employeeData.setSeniority("7Y3M1W"); + employeeData.setBankAccount("12345678901234567890"); + employeeData.setBaseSalaryForContributions("490.22"); + employeeData.setIntegratedDailySalary("146.47"); + + ApiResponse apiResponse = client.getPersonService().getEmployeeService().Update(employeeData); + System.out.println(apiResponse); + */ + + //Eliminar datos de empleado + //ApiResponse apiResponse = client.getPersonService().getEmployeeService().Delete("54fc14ae-c88f-4afc-996b-0574d63341e2"); + //System.out.println(apiResponse); + // endregion //endregion //region Certificados (sellos SAT) @@ -175,7 +272,7 @@ public void run() { // // ***Crear producto***// // Product product = new Product(); // product.setDescription("Libro de Java sin impuestos"); -// product.setUnitPrice(100.75986); +// product.setUnitPrice("100.75986"); // ApiResponse apiResponse = client.getProductService().create(product); // System.out.printf("apiResponse: %s\n", apiResponse); @@ -184,7 +281,7 @@ public void run() { // Product product = new Product(); // product.setId("f846e552-fcd1-489a-9674-cbae18116bdc"); // product.setDescription("Libro de Java con Impuestos"); -// product.setUnitPrice(150.75); +// product.setUnitPrice("150.75"); // product.setSatUnitMeasurementId("H87"); // Pieza // product.setSatProductCodeId("81111602"); // libros // product.setSatTaxObjectId("02"); // Si objeto de impuesto @@ -194,13 +291,13 @@ public void run() { // // ProductTax iva16 = new ProductTax(); // iva16.setTaxId("002"); // IVA -// iva16.setRate(0.160000); // 16% +// iva16.setRate("0.160000"); // 16% // iva16.setTaxTypeId("Tasa"); //Tasa // iva16.setTaxFlagId("T"); // Traslado // // ProductTax iva1067 = new ProductTax(); // Retención 2/3 partes iva // iva1067.setTaxId("002"); -// iva1067.setRate(0.010667); +// iva1067.setRate("0.010667"); // iva1067.setTaxTypeId("Tasa"); // iva1067.setTaxFlagId("T"); // @@ -253,8 +350,8 @@ public void run() { //region Facturas // // ***Obtener una factura por Id***// - ApiResponse apiResponse = client.getInvoiceService().getById("1207c05b-9c4b-42ed-aa39-1fab4e993c7b",true); - System.out.printf("apiResponse: %s\n", apiResponse); + //ApiResponse apiResponse = client.getInvoiceService().getById("1207c05b-9c4b-42ed-aa39-1fab4e993c7b",true); + //System.out.printf("apiResponse: %s\n", apiResponse); // // ***Listar facturas***// // ApiResponse> apiResponse = client.getInvoiceService().getList(1,3); @@ -273,7 +370,7 @@ public void run() { // invoice.setVersionCode("4.0"); // invoice.setTypeCode("I"); // invoice.setSeries("F"); -// invoice.setDate(LocalDateTime.now()); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setPaymentFormCode("01"); // invoice.setPaymentMethodCode("PUE"); // invoice.setExpeditionZipCode("42501"); @@ -326,13 +423,13 @@ public void run() { // InvoiceItem item = new InvoiceItem(); // // item.setItemCode("01010101"); -// item.setQuantity(9.5); +// item.setQuantity("9.5"); // item.setUnitOfMeasurementCode("E48"); // item.setDescription("Invoicing software as a service."); -// item.setUnitPrice(3587.75); +// item.setUnitPrice("3587.75"); // item.setTaxObjectCode("02"); // item.setItemSku("7506022301697"); -// item.setDiscount(255.85); +// item.setDiscount("255.85"); // // // impuestos del producto // @@ -366,7 +463,7 @@ public void run() { // invoice.setVersionCode("4.0"); // invoice.setTypeCode("I"); // invoice.setSeries("F"); -// invoice.setDate(LocalDateTime.now().minusHours(2)); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setCurrencyCode("MXN"); // invoice.setPaymentFormCode("01"); // invoice.setPaymentMethodCode("PUE"); @@ -424,13 +521,13 @@ public void run() { // InvoiceItem item = new InvoiceItem(); // // item.setItemCode("01010101"); -// item.setQuantity(1.0); +// item.setQuantity("1.0"); // item.setUnitOfMeasurementCode("ACT"); // item.setDescription("Venta"); -// item.setUnitPrice(1230.00); +// item.setUnitPrice("1230.00"); // item.setTaxObjectCode("02"); // item.setItemSku("venta0001"); -// item.setDiscount(255.85); +// item.setDiscount("255.85"); // // // impuestos del producto // List taxes = new ArrayList<>(); @@ -463,7 +560,7 @@ public void run() { // invoice.setVersionCode("4.0"); // invoice.setTypeCode("I"); // invoice.setSeries("F"); -// invoice.setDate(LocalDateTime.now().minusHours(2)); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setCurrencyCode("MXN"); // invoice.setPaymentFormCode("01"); // invoice.setPaymentMethodCode("PUE"); @@ -491,13 +588,13 @@ public void run() { // InvoiceItem item = new InvoiceItem(); // // item.setItemCode("01010101"); -// item.setQuantity(1.0); +// item.setQuantity("1.0"); // item.setUnitOfMeasurementCode("ACT"); // item.setDescription("Venta"); -// item.setUnitPrice(1230.00); +// item.setUnitPrice("1230.00"); // item.setTaxObjectCode("02"); // item.setItemSku("venta0001"); -// item.setDiscount(255.85); +// item.setDiscount("255.85"); // // // impuestos del producto // List taxes = new ArrayList<>(); @@ -530,7 +627,7 @@ public void run() { // invoice.setVersionCode("4.0"); // invoice.setTypeCode("I"); // invoice.setSeries("F"); -// invoice.setDate(LocalDateTime.now()); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setPaymentFormCode("01"); // invoice.setPaymentMethodCode("PUE"); // invoice.setExpeditionZipCode("42501"); @@ -574,13 +671,13 @@ public void run() { // List items = new ArrayList<>(); // InvoiceItem item = new InvoiceItem(); // item.setItemCode("01010101"); -// item.setQuantity(9.5); +// item.setQuantity("9.5"); // item.setUnitOfMeasurementCode("E48"); // item.setDescription("Invoicing software as a service"); -// item.setUnitPrice(3587.75); +// item.setUnitPrice("3587.75"); // item.setTaxObjectCode("02"); // item.setItemSku("7506022301697"); -// item.setDiscount(255.85); +// item.setDiscount("255.85"); // // // Impuestos del producto (IVA exento) // List taxes = new ArrayList<>(); @@ -603,7 +700,7 @@ public void run() { // invoice.setVersionCode("4.0"); // invoice.setTypeCode("I"); // invoice.setSeries("F"); -// invoice.setDate(LocalDateTime.now()); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setPaymentFormCode("01"); // invoice.setPaymentMethodCode("PUE"); // invoice.setExpeditionZipCode("42501"); @@ -647,13 +744,13 @@ public void run() { // List items = new ArrayList<>(); // InvoiceItem item = new InvoiceItem(); // item.setItemCode("01010101"); -// item.setQuantity(9.5); +// item.setQuantity("9.5"); // item.setUnitOfMeasurementCode("E48"); // item.setDescription("Invoicing software as a service"); -// item.setUnitPrice(3587.75); +// item.setUnitPrice("3587.75"); // item.setTaxObjectCode("02"); // item.setItemSku("7506022301697"); -// item.setDiscount(255.85); +// item.setDiscount("255.85"); // // // Impuestos del producto (IVA tasa cero) // List taxes = new ArrayList<>(); @@ -677,7 +774,7 @@ public void run() { // Invoice invoice = new Invoice(); // invoice.setVersionCode("4.0"); // invoice.setSeries("F"); -// invoice.setDate(LocalDateTime.now()); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setPaymentFormCode("01"); // invoice.setCurrencyCode("MXN"); // invoice.setTypeCode("I"); @@ -698,8 +795,8 @@ public void run() { // List items = new ArrayList<>(); // InvoiceItem item = new InvoiceItem(); // item.setId("114a4be5-fb65-40b2-a762-ff0c55c6ebfa"); -// item.setQuantity(2.0); -// item.setDiscount(255.85); +// item.setQuantity("2.0"); +// item.setDiscount("255.85"); // items.add(item); // invoice.setItems(items); // @@ -711,7 +808,7 @@ public void run() { // Invoice invoice = new Invoice(); // invoice.setVersionCode("4.0"); // invoice.setSeries("F"); -// invoice.setDate(LocalDateTime.now().minusHours(2)); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setPaymentFormCode("01"); // invoice.setCurrencyCode("MXN"); // invoice.setTypeCode("I"); @@ -732,8 +829,8 @@ public void run() { // List items = new ArrayList<>(); // InvoiceItem item = new InvoiceItem(); // item.setId("114a4be5-fb65-40b2-a762-ff0c55c6ebfa"); -// item.setQuantity(1.0); -// item.setUnitPrice(200.00); +// item.setQuantity("1.0"); +// item.setUnitPrice("200.00"); // items.add(item); // invoice.setItems(items); // @@ -746,7 +843,7 @@ public void run() { // Invoice invoice = new Invoice(); // invoice.setVersionCode("4.0"); // invoice.setSeries("CN"); -// invoice.setDate(LocalDateTime.now()); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setPaymentFormCode("03"); // invoice.setCurrencyCode("MXN"); // invoice.setTypeCode("E"); @@ -801,10 +898,10 @@ public void run() { // List items = new ArrayList<>(); // InvoiceItem item = new InvoiceItem(); // item.setItemCode("01010101"); -// item.setQuantity(0.5); +// item.setQuantity("0.5"); // item.setUnitOfMeasurementCode("E48"); // item.setDescription("Invoicing software as a service"); -// item.setUnitPrice(3587.75); +// item.setUnitPrice("3587.75"); // item.setTaxObjectCode("02"); // item.setItemSku("7506022301697"); // @@ -829,7 +926,7 @@ public void run() { // Invoice invoice = new Invoice(); // invoice.setVersionCode("4.0"); // invoice.setSeries("CN"); -// invoice.setDate(LocalDateTime.now()); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setPaymentFormCode("03"); // invoice.setCurrencyCode("MXN"); // invoice.setTypeCode("E"); @@ -858,7 +955,7 @@ public void run() { // List items = new ArrayList<>(); // InvoiceItem item = new InvoiceItem(); // item.setId("114a4be5-fb65-40b2-a762-ff0c55c6ebfa"); -// item.setQuantity(0.5); +// item.setQuantity("0.5"); // items.add(item); // invoice.setItems(items); // @@ -869,7 +966,7 @@ public void run() { // Invoice invoice = new Invoice(); // invoice.setVersionCode("4.0"); // invoice.setSeries("CN"); -// invoice.setDate(LocalDateTime.now().minusHours(2)); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setPaymentFormCode("03"); // invoice.setCurrencyCode("MXN"); // invoice.setTypeCode("E"); @@ -898,8 +995,8 @@ public void run() { // List items = new ArrayList<>(); // InvoiceItem item = new InvoiceItem(); // item.setId("114a4be5-fb65-40b2-a762-ff0c55c6ebfa"); -// item.setQuantity(0.5); -// item.setUnitPrice(150.0); +// item.setQuantity("0.5"); +// item.setUnitPrice("150.0"); // items.add(item); // invoice.setItems(items); @@ -916,7 +1013,7 @@ public void run() { // Invoice invoice = new Invoice(); // invoice.setVersionCode("4.0"); // invoice.setSeries("CP"); -// invoice.setDate(LocalDateTime.now()); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setCurrencyCode("XXX"); // invoice.setTypeCode("P"); // invoice.setExpeditionZipCode("01160"); @@ -960,10 +1057,10 @@ public void run() { // List items = new ArrayList<>(); // InvoiceItem item = new InvoiceItem(); // item.setItemCode("84111506"); -// item.setQuantity(1.0); +// item.setQuantity("1.0"); // item.setUnitOfMeasurementCode("ACT"); // item.setDescription("Pago"); -// item.setUnitPrice(0.0); +// item.setUnitPrice("0.0"); // item.setTaxObjectCode("01"); // items.add(item); // invoice.setItems(items); @@ -971,10 +1068,10 @@ public void run() { // // Pagos // List payments = new ArrayList<>(); // InvoicePayment payment = new InvoicePayment(); -// payment.setPaymentDate(LocalDateTime.now()); +// payment.setPaymentDate("2026-02-09T10:00:00"); // payment.setPaymentFormCode("28"); // payment.setCurrencyCode("MXN"); -// payment.setAmount(11600.00); +// payment.setAmount("11600.00"); // payment.setSourceBankTin("BSM970519DU8"); // payment.setSourceBankAccount("1234567891012131"); // payment.setTargetBankTin("BBA830831LJ2"); @@ -988,10 +1085,10 @@ public void run() { // paidInvoice.setNumber("1501"); // paidInvoice.setCurrencyCode("MXN"); // paidInvoice.setPartialityNumber(1); -// paidInvoice.setSubTotal(10000.0); -// paidInvoice.setPreviousBalance(11600.00); -// paidInvoice.setPaymentAmount(11600.00); -// paidInvoice.setRemainingBalance(0.0); +// paidInvoice.setSubTotal("10000.0"); +// paidInvoice.setPreviousBalance("11600.00"); +// paidInvoice.setPaymentAmount("11600.00"); +// paidInvoice.setRemainingBalance("0.0"); // paidInvoice.setTaxObjectCode("02"); // // // Impuestos de la factura pagada @@ -1018,7 +1115,7 @@ public void run() { // Invoice invoice = new Invoice(); // invoice.setVersionCode("4.0"); // invoice.setSeries("CP"); -// invoice.setDate(LocalDateTime.now()); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setCurrencyCode("XXX"); // invoice.setTypeCode("P"); // invoice.setExpeditionZipCode("01160"); @@ -1037,10 +1134,10 @@ public void run() { // // Pagos // List payments = new ArrayList<>(); // InvoicePayment payment = new InvoicePayment(); -// payment.setPaymentDate(LocalDateTime.parse("2024-06-03T14:44:56")); +// payment.setPaymentDate("2024-06-03T14:44:56"); // payment.setPaymentFormCode("28"); // payment.setCurrencyCode("MXN"); -// payment.setAmount(11600.00); +// payment.setAmount("11600.00"); // payment.setSourceBankTin("BSM970519DU8"); // payment.setSourceBankAccount("1234567891012131"); // payment.setTargetBankTin("BBA830831LJ2"); @@ -1054,10 +1151,10 @@ public void run() { // paidInvoice.setNumber("1501"); // paidInvoice.setCurrencyCode("MXN"); // paidInvoice.setPartialityNumber(1); -// paidInvoice.setSubTotal(10000.0); -// paidInvoice.setPreviousBalance(11600.00); -// paidInvoice.setPaymentAmount(11600.00); -// paidInvoice.setRemainingBalance(0.0); +// paidInvoice.setSubTotal("10000.0"); +// paidInvoice.setPreviousBalance("11600.00"); +// paidInvoice.setPaymentAmount("11600.00"); +// paidInvoice.setRemainingBalance("0.0"); // paidInvoice.setTaxObjectCode("02"); // // // Impuestos de la factura pagada @@ -1084,7 +1181,7 @@ public void run() { // Invoice invoice = new Invoice(); // invoice.setVersionCode("4.0"); // invoice.setSeries("usd-mxn"); -// invoice.setDate(LocalDateTime.now()); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setCurrencyCode("XXX"); // invoice.setTypeCode("P"); // invoice.setExpeditionZipCode("01160"); @@ -1128,10 +1225,10 @@ public void run() { // List items = new ArrayList<>(); // InvoiceItem item = new InvoiceItem(); // item.setItemCode("84111506"); -// item.setQuantity(1.0); +// item.setQuantity("1.0"); // item.setUnitOfMeasurementCode("ACT"); // item.setDescription("Pago"); -// item.setUnitPrice(0.0); +// item.setUnitPrice("0.0"); // item.setTaxObjectCode("01"); // items.add(item); // invoice.setItems(items); @@ -1139,11 +1236,11 @@ public void run() { // // Pagos // List payments = new ArrayList<>(); // InvoicePayment payment = new InvoicePayment(); -// payment.setPaymentDate(LocalDateTime.parse("2024-06-03T14:44:56")); +// payment.setPaymentDate("2024-06-03T14:44:56"); // payment.setPaymentFormCode("28"); // payment.setCurrencyCode("USD"); -// payment.setExchangeRate(20.64); -// payment.setAmount(5.62); +// payment.setExchangeRate("20.64"); +// payment.setAmount("5.62"); // payment.setSourceBankTin("BSM970519DU8"); // payment.setSourceBankAccount("1234567891012131"); // payment.setTargetBankTin("BBA830831LJ2"); @@ -1156,12 +1253,12 @@ public void run() { // paidInvoice.setSeries("F"); // paidInvoice.setNumber("2"); // paidInvoice.setCurrencyCode("MXN"); -// paidInvoice.setEquivalence(20.64); +// paidInvoice.setEquivalence("20.64"); // paidInvoice.setPartialityNumber(1); -// paidInvoice.setSubTotal(100.00); -// paidInvoice.setPreviousBalance(116.00); -// paidInvoice.setPaymentAmount(116.00); -// paidInvoice.setRemainingBalance(0.0); +// paidInvoice.setSubTotal("100.00"); +// paidInvoice.setPreviousBalance("116.00"); +// paidInvoice.setPaymentAmount("116.00"); +// paidInvoice.setRemainingBalance("0.0"); // paidInvoice.setTaxObjectCode("02"); // // // Impuestos de la factura pagada @@ -1204,7 +1301,7 @@ public void run() { // Invoice invoice = new Invoice(); // invoice.setVersionCode("4.0"); // invoice.setSeries("MXN-USD"); -// invoice.setDate(LocalDateTime.now()); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setCurrencyCode("XXX"); // invoice.setTypeCode("P"); // invoice.setExpeditionZipCode("01160"); @@ -1248,10 +1345,10 @@ public void run() { // List items = new ArrayList<>(); // InvoiceItem item = new InvoiceItem(); // item.setItemCode("84111506"); -// item.setQuantity(1.0); +// item.setQuantity("1.0"); // item.setUnitOfMeasurementCode("ACT"); // item.setDescription("Pago"); -// item.setUnitPrice(0.0); +// item.setUnitPrice("0.0"); // item.setTaxObjectCode("01"); // items.add(item); // invoice.setItems(items); @@ -1259,10 +1356,10 @@ public void run() { // // Pagos // List payments = new ArrayList<>(); // InvoicePayment payment = new InvoicePayment(); -// payment.setPaymentDate(LocalDateTime.parse("2024-06-03T14:44:56")); +// payment.setPaymentDate("2024-06-03T14:44:56"); // payment.setPaymentFormCode("28"); // payment.setCurrencyCode("MXN"); -// payment.setAmount(921.23); +// payment.setAmount("921.23"); // payment.setSourceBankTin("BSM970519DU8"); // payment.setSourceBankAccount("1234567891012131"); // payment.setTargetBankTin("BBA830831LJ2"); @@ -1275,12 +1372,12 @@ public void run() { // paidInvoice.setSeries("F"); // paidInvoice.setNumber("2"); // paidInvoice.setCurrencyCode("USD"); -// paidInvoice.setEquivalence(0.045331); +// paidInvoice.setEquivalence("0.045331"); // paidInvoice.setPartialityNumber(1); -// paidInvoice.setSubTotal(36.000); -// paidInvoice.setPreviousBalance(41.76); -// paidInvoice.setPaymentAmount(41.76); -// paidInvoice.setRemainingBalance(0.0); +// paidInvoice.setSubTotal("36.000"); +// paidInvoice.setPreviousBalance("41.76"); +// paidInvoice.setPaymentAmount("41.76"); +// paidInvoice.setRemainingBalance("0.0"); // paidInvoice.setTaxObjectCode("02"); // // // Impuestos de la factura pagada @@ -1323,7 +1420,7 @@ public void run() { // Invoice invoice = new Invoice(); // invoice.setVersionCode("4.0"); // invoice.setSeries("MXN-USD"); -// invoice.setDate(LocalDateTime.now()); +// invoice.setDate("2026-02-09T10:00:00"); // invoice.setCurrencyCode("XXX"); // invoice.setTypeCode("P"); // invoice.setExpeditionZipCode("01160"); @@ -1368,10 +1465,10 @@ public void run() { // List items = new ArrayList<>(); // InvoiceItem item = new InvoiceItem(); // item.setItemCode("84111506"); -// item.setQuantity(1.0); +// item.setQuantity("1.0"); // item.setUnitOfMeasurementCode("ACT"); // item.setDescription("Pago"); -// item.setUnitPrice(0.0); +// item.setUnitPrice("0.0"); // item.setTaxObjectCode("01"); // items.add(item); // invoice.setItems(items); @@ -1379,11 +1476,11 @@ public void run() { // // Pagos // List payments = new ArrayList<>(); // InvoicePayment payment = new InvoicePayment(); -// payment.setPaymentDate(LocalDateTime.parse("2024-06-03T14:44:56")); +// payment.setPaymentDate("2024-06-03T14:44:56"); // payment.setPaymentFormCode("28"); // payment.setCurrencyCode("EUR"); -// payment.setExchangeRate(25.00); -// payment.setAmount(100.00); +// payment.setExchangeRate("25.00"); +// payment.setAmount("100.00"); // payment.setSourceBankTin("BSM970519DU8"); // payment.setSourceBankAccount("1234567891012131"); // payment.setTargetBankTin("BBA830831LJ2"); @@ -1396,12 +1493,12 @@ public void run() { // paidInvoice.setSeries("F"); // paidInvoice.setNumber("2"); // paidInvoice.setCurrencyCode("USD"); -// paidInvoice.setEquivalence(1.160); +// paidInvoice.setEquivalence("1.160"); // paidInvoice.setPartialityNumber(1); -// paidInvoice.setSubTotal(100.0); -// paidInvoice.setPreviousBalance(116.00); -// paidInvoice.setPaymentAmount(116.00); -// paidInvoice.setRemainingBalance(0.0); +// paidInvoice.setSubTotal("100.0"); +// paidInvoice.setPreviousBalance("116.00"); +// paidInvoice.setPaymentAmount("116.00"); +// paidInvoice.setRemainingBalance("0.0"); // paidInvoice.setTaxObjectCode("02"); // // // Impuestos de la factura pagada @@ -1656,8 +1753,8 @@ public void run() { // DownloadRequest request = new DownloadRequest(); // request.setDownloadRuleId("a339a292-37fe-422e-a28a-f93e6025c72f"); // request.setDownloadRequestTypeId("Manual"); - // request.setStartDate(LocalDateTime.now().minusDays(5)); - // request.setEndDate(LocalDateTime.now()); + // request.setStartDate("2026-02-09T10:00:00"); + // request.setEndDate("2026-02-09T10:00:00"); // ApiResponse apiResponse = client.getDownloadRequestService().create(request); // System.out.println(apiResponse); @@ -1668,9 +1765,4866 @@ public void run() { // System.out.println(apiResponse); // Buscar solicitud de descarga masiva por fecha de creación - // ApiResponse> apiResponse = client.getDownloadRequestService().search(LocalDate.now()); + // ApiResponse> apiResponse = client.getDownloadRequestService().search("2026-02-09T10:00:00"); + // System.out.println(apiResponse); + + // region Complemento de nómina + // Complemento de Nómina + + // Crear nómina ordinaria por valores + // Emisor + /* + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("FUNK671228PH6"); + issuer.setLegalName("KARLA FUENTE NOLASCO"); + issuer.setTaxRegimeCode("621"); + + EmployerData employerData = new EmployerData(); + employerData.setEmployerRegistration("B5510768108"); + + // Certificados del emisor + List credentials = new ArrayList<>(); + + TaxCredential cer = new TaxCredential(); + cer.setBase64File(base64Cer); + cer.setFileType(0); // 0 = Certificado (.cer) + cer.setPassword(password); + + TaxCredential key = new TaxCredential(); + key.setBase64File(base64Key); + key.setFileType(1); // 1 = Clave privada (.key) + key.setPassword(password); + + credentials.add(cer); + credentials.add(key); + + issuer.setTaxCredentials(credentials); + + // Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("EKU9003173C9"); + recipient.setLegalName("ESCUELA KEMPER URGATE"); + recipient.setZipCode("42501"); + recipient.setTaxRegimeCode("601"); + recipient.setCfdiUseCode("CP01"); + recipient.setEmail("someone@somewhere.com"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101MNEXXXA8"); + employeeData.setSocialSecurityNumber("04078873454"); + employeeData.setLaborRelationStartDate("2024-08-18"); + employeeData.setSeniority("P54W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatTaxRegimeTypeId("02"); + employeeData.setEmployeeNumber("123456789"); + employeeData.setDepartment("GenAI"); + employeeData.setPosition("Sr Software Engineer"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatPaymentPeriodicityId("05"); + employeeData.setSatBankId("012"); + employeeData.setBaseSalaryForContributions("282.50"); + employeeData.setIntegratedDailySalary("2626.23"); + employeeData.setSatPayrollStateId("JAL"); + + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2025-08-30"); + payroll.setInitialPaymentDate("2025-07-31"); + payroll.setFinalPaymentDate("2025-08-30"); + payroll.setDaysPaid(30); + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("1003"); + e1.setConcept("Sueldo nominal"); + e1.setTaxedAmount(95030); + e1.setExemptAmount(0); + + PayrollEarning e2 = new PayrollEarning(); + e2.setEarningTypeCode("005"); + e2.setCode("5913"); + e2.setConcept("Fondo de Ahorro Aportación Patrón"); + e2.setTaxedAmount(0); + e2.setExemptAmount(0); + + PayrollEarning e3 = new PayrollEarning(); + e3.setEarningTypeCode("038"); + e3.setCode("1885"); + e3.setConcept("Bono Ingles"); + e3.setTaxedAmount("14254.50"); + e3.setExemptAmount(0); + + PayrollEarning e4 = new PayrollEarning(); + e4.setEarningTypeCode("029"); + e4.setCode("1941"); + e4.setConcept("Vales Despensa"); + e4.setTaxedAmount(0); + e4.setExemptAmount(3439); + + PayrollEarning e5 = new PayrollEarning(); + e5.setEarningTypeCode("038"); + e5.setCode("1824"); + e5.setConcept("Herramientas Teletrabajo (telecom y prop. electri)"); + e5.setTaxedAmount(273); + e5.setExemptAmount(0); + + PayrollEarning e6 = new PayrollEarning(); + e6.setEarningTypeCode("002"); + e6.setCode("5050"); + e6.setConcept("Exceso de subsidio al empleo"); + e6.setTaxedAmount(0); + e6.setExemptAmount(0); + + earnings.add(e1); + earnings.add(e2); + earnings.add(e3); + earnings.add(e4); + earnings.add(e5); + earnings.add(e6); + + List otherPayments = new ArrayList<>(); + PayrollEarningOtherPayment op1 = new PayrollEarningOtherPayment(); + op1.setOtherPaymentCode("002"); + op1.setCode("5050"); + op1.setConcept("exceso de subsidio al empleo"); + op1.setAmount(0); + op1.setSubsidyCaused(0); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("002"); + d1.setCode("5003"); + d1.setConcept("ISR Causado"); + d1.setAmount(27645); + + PayrollDeduction d2 = new PayrollDeduction(); + d2.setDeductionTypeCode("004"); + d2.setCode("5910"); + d2.setConcept("Fondo de ahorro Empleado Inversión"); + d2.setAmount("4412.46"); + + PayrollDeduction d3 = new PayrollDeduction(); + d3.setDeductionTypeCode("004"); + d3.setCode("5914"); + d3.setConcept("Fondo de Ahorro Patrón Inversión"); + d3.setAmount("4412.46"); + + PayrollDeduction d4 = new PayrollDeduction(); + d4.setDeductionTypeCode("004"); + d4.setCode("1966"); + d4.setConcept("Contribución póliza exceso GMM"); + d4.setAmount("519.91"); + + PayrollDeduction d5 = new PayrollDeduction(); + d5.setDeductionTypeCode("004"); + d5.setCode("1934"); + d5.setConcept("Descuento Vales Despensa"); + d5.setAmount(1); + + PayrollDeduction d6 = new PayrollDeduction(); + d6.setDeductionTypeCode("004"); + d6.setCode("1942"); + d6.setConcept("Vales Despensa Electrónico"); + d6.setAmount(3439); + + PayrollDeduction d7 = new PayrollDeduction(); + d7.setDeductionTypeCode("001"); + d7.setCode("1895"); + d7.setConcept("IMSS"); + d7.setAmount("2391.13"); + + payrollDeductions.add(d1); + payrollDeductions.add(d2); + payrollDeductions.add(d3); + payrollDeductions.add(d4); + payrollDeductions.add(d5); + payrollDeductions.add(d6); + payrollDeductions.add(d7); + + payroll.setDeductions(payrollDeductions); + + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); + invoice.setTypeCode("I"); + invoice.setExpeditionZipCode("42501"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setDate("2026-02-09T10:00:00"); + invoice.setPaymentMethodCode("PUE"); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + System.out.println(apiResponse); + + // Nómina ordinaria por referencias + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setId("0e82a655-5f0c-4e07-abab-8f322e4123ef"); + + List credentials = new ArrayList<>(); + + TaxCredential cer = new TaxCredential(); + cer.setBase64File(base64Cer); + cer.setFileType(0); + cer.setPassword(password); + + TaxCredential key = new TaxCredential(); + key.setBase64File(base64Key); + key.setFileType(1); + key.setPassword(password); + + credentials.add(cer); + credentials.add(key); + + issuer.setTaxCredentials(credentials); + + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setId("da71df0c-f328-45ee-9bd9-3096ed02c164"); + + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2025-08-30T00:00:00"); + payroll.setInitialPaymentDate("2025-07-31T00:00:00"); + payroll.setFinalPaymentDate("2025-08-30T00:00:00"); + payroll.setDaysPaid(30); + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("1003"); + e1.setConcept("Sueldo nominal"); + e1.setTaxedAmount("95030"); + e1.setExemptAmount("0"); + + PayrollEarning e2 = new PayrollEarning(); + e2.setEarningTypeCode("005"); + e2.setCode("5913"); + e2.setConcept("Fondo de Ahorro Aportación Patrón"); + e2.setTaxedAmount("0"); + e2.setExemptAmount("4412.46"); + + PayrollEarning e3 = new PayrollEarning(); + e3.setEarningTypeCode("038"); + e3.setCode("1885"); + e3.setConcept("Bono Ingles"); + e3.setTaxedAmount("14254.50"); + e3.setExemptAmount("0"); + + PayrollEarning e4 = new PayrollEarning(); + e4.setEarningTypeCode("029"); + e4.setCode("1941"); + e4.setConcept("Vales Despensa"); + e4.setTaxedAmount("0"); + e4.setExemptAmount("3439"); + + PayrollEarning e5 = new PayrollEarning(); + e5.setEarningTypeCode("038"); + e5.setCode("1824"); + e5.setConcept("Herramientas Teletrabajo (telecom y prop. electri)"); + e5.setTaxedAmount("273"); + e5.setExemptAmount("0"); + + earnings.add(e1); + earnings.add(e2); + earnings.add(e3); + earnings.add(e4); + earnings.add(e5); + + List otherPayments = new ArrayList<>(); + PayrollEarningOtherPayment op1 = new PayrollEarningOtherPayment(); + op1.setOtherPaymentTypeCode("002"); + op1.setCode("5050"); + op1.setConcept("exceso de subsidio al empleo"); + op1.setAmount("0"); + op1.setSubsidyCaused("0"); + otherPayments.add(op1); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + payroll.setEarnings(payrollEarnings); + + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("002"); + d1.setCode("5003"); + d1.setConcept("ISR Causado"); + d1.setAmount("27645.00"); + + PayrollDeduction d2 = new PayrollDeduction(); + d2.setDeductionTypeCode("004"); + d2.setCode("5910"); + d2.setConcept("Fondo de ahorro Empleado Inversión"); + d2.setAmount("4412.46"); + + PayrollDeduction d3 = new PayrollDeduction(); + d3.setDeductionTypeCode("004"); + d3.setCode("5914"); + d3.setConcept("Fondo de Ahorro Patrón Inversión"); + d3.setAmount("4412.46"); + + PayrollDeduction d4 = new PayrollDeduction(); + d4.setDeductionTypeCode("004"); + d4.setCode("1966"); + d4.setConcept("Contribución póliza exceso GMM"); + d4.setAmount("519.91"); + + PayrollDeduction d5 = new PayrollDeduction(); + d5.setDeductionTypeCode("004"); + d5.setCode("1934"); + d5.setConcept("Descuento Vales Despensa"); + d5.setAmount("1.00"); + + PayrollDeduction d6 = new PayrollDeduction(); + d6.setDeductionTypeCode("004"); + d6.setCode("1942"); + d6.setConcept("Vales Despensa Electrónico"); + d6.setAmount("3439.00"); + + PayrollDeduction d7 = new PayrollDeduction(); + d7.setDeductionTypeCode("001"); + d7.setCode("1895"); + d7.setConcept("IMSS"); + d7.setAmount("2391.13"); + + payrollDeductions.add(d1); + payrollDeductions.add(d2); + payrollDeductions.add(d3); + payrollDeductions.add(d4); + payrollDeductions.add(d5); + payrollDeductions.add(d6); + payrollDeductions.add(d7); + + payroll.setDeductions(payrollDeductions); + Complement complement = new Complement(); + complement.setPayroll(payroll); + + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); + invoice.setTypeCode("N"); + invoice.setExpeditionZipCode("20000"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setDate("2026-02-09T10:00:00"); + invoice.setPaymentMethodCode("PUE"); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + System.out.println(apiResponse); + + // Nómina asimilados por valores + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + + EmployerData employerData = new EmployerData(); + employerData.setOriginEmployerTin("EKU9003173C9"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("CACX7605101P8"); + recipient.setLegalName("XOCHILT CASAS CHAVEZ"); + recipient.setZipCode("36257"); + recipient.setTaxRegimeCode("605"); + recipient.setCfdiUseCode("CN01"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101HNEXXXA4"); + employeeData.setSatContractTypeId("09"); + employeeData.setSatUnionizedStatusId("No"); + employeeData.setSatTaxRegimeTypeId("09"); + employeeData.setEmployeeNumber("00002"); + employeeData.setDepartment("ADMINISTRACION"); + employeeData.setPosition("DIRECTOR DE ADMINISTRACION"); + employeeData.setSatPaymentPeriodicityId("99"); + employeeData.setSatBankId("012"); + employeeData.setBankAccount("1111111111"); + employeeData.setSatPayrollStateId("CMX"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("E"); + payroll.setPaymentDate("2023-06-02T00:00:00"); + payroll.setInitialPaymentDate("2023-06-01T00:00:00"); + payroll.setFinalPaymentDate("2023-06-02T00:00:00"); + payroll.setDaysPaid(1); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("046"); + e1.setCode("010046"); + e1.setConcept("INGRESOS ASIMILADOS A SALARIOS"); + e1.setTaxedAmount("111197.73"); + e1.setExemptAmount("0.00"); + + earnings.add(e1); + + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("002"); + d1.setCode("020002"); + d1.setConcept("ISR"); + d1.setAmount("36197.73"); + + payrollDeductions.add(d1); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("06880"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + // Nómina asimilados por referencias + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setId("0e82a655-5f0c-4e07-abab-8f322e4123ef"); + + List credentials = new ArrayList<>(); + + TaxCredential cer = new TaxCredential(); + cer.setBase64File(base64Cer); + cer.setFileType(0); + cer.setPassword(password); + + TaxCredential key = new TaxCredential(); + key.setBase64File(base64Key); + key.setFileType(1); + key.setPassword(password); + + credentials.add(cer); + credentials.add(key); + + issuer.setTaxCredentials(credentials); + + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setId("da71df0c-f328-45ee-9bd9-3096ed02c164"); + + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("E"); + payroll.setPaymentDate("2023-06-02T00:00:00"); + payroll.setInitialPaymentDate("2023-06-01T00:00:00"); + payroll.setFinalPaymentDate("2023-06-02T00:00:00"); + payroll.setDaysPaid(1); + + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("046"); + e1.setCode("010046"); + e1.setConcept("INGRESOS ASIMILADOS A SALARIOS"); + e1.setTaxedAmount("111197.73"); + e1.setExemptAmount("0.00"); + + earnings.add(e1); + + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("002"); + d1.setCode("020002"); + d1.setConcept("ISR"); + d1.setAmount("36197.73"); + + payrollDeductions.add(d1); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + + Complement complement = new Complement(); + complement.setPayroll(payroll); + + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("06880"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + //Nómina con bonos fondo de ahorro y deducciones + // Emisor + /* + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + + EmployerData employerData = new EmployerData(); + employerData.setEmployerRegistration("Z0000001234"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("XOJI740919U48"); + recipient.setLegalName("INGRID XODAR JIMENEZ"); + recipient.setZipCode("76028"); + recipient.setTaxRegimeCode("605"); + recipient.setCfdiUseCode("CN01"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101MNEXXXA8"); + employeeData.setSocialSecurityNumber("0000000000"); + employeeData.setLaborRelationStartDate("2022-03-02T00:00:00"); + employeeData.setSeniority("P66W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatUnionizedStatusId("No"); + employeeData.setSatTaxRegimeTypeId("02"); + employeeData.setEmployeeNumber("111111"); + employeeData.setSatJobRiskId("4"); + employeeData.setSatPaymentPeriodicityId("02"); + employeeData.setIntegratedDailySalary("180.96"); + employeeData.setSatPayrollStateId("GUA"); + +// Items + List items = new ArrayList<>(); + + InvoiceItem item1 = new InvoiceItem(); + item1.setItemCode("84111505"); + item1.setItemSku("84111505"); + item1.setQuantity(1); + item1.setUnitOfMeasurementCode("ACT"); + item1.setDescription("Pago de nómina"); + item1.setUnitPrice("1842.82"); + item1.setDiscount("608.71"); + item1.setTaxObjectCode("01"); + + items.add(item1); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-06-11T00:00:00"); + payroll.setInitialPaymentDate("2023-06-05T00:00:00"); + payroll.setFinalPaymentDate("2023-06-11T00:00:00"); + payroll.setDaysPaid(7); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("SP01"); + e1.setConcept("SUELDO"); + e1.setTaxedAmount("1210.30"); + e1.setExemptAmount("0.00"); + + PayrollEarning e2 = new PayrollEarning(); + e2.setEarningTypeCode("010"); + e2.setCode("SP02"); + e2.setConcept("PREMIO PUNTUALIDAD"); + e2.setTaxedAmount("121.03"); + e2.setExemptAmount("0.00"); + + PayrollEarning e3 = new PayrollEarning(); + e3.setEarningTypeCode("029"); + e3.setCode("SP03"); + e3.setConcept("MONEDERO ELECTRONICO"); + e3.setTaxedAmount("0.00"); + e3.setExemptAmount("269.43"); + + PayrollEarning e4 = new PayrollEarning(); + e4.setEarningTypeCode("010"); + e4.setCode("SP04"); + e4.setConcept("PREMIO DE ASISTENCIA"); + e4.setTaxedAmount("121.03"); + e4.setExemptAmount("0.00"); + + PayrollEarning e5 = new PayrollEarning(); + e5.setEarningTypeCode("005"); + e5.setCode("SP54"); + e5.setConcept("APORTACION FONDO AHORRO"); + e5.setTaxedAmount("0.00"); + e5.setExemptAmount("121.03"); + + earnings.add(e1); + earnings.add(e2); + earnings.add(e3); + earnings.add(e4); + earnings.add(e5); + +// Other Payments + List otherPayments = new ArrayList<>(); + + PayrollEarningOtherPayment op1 = new PayrollEarningOtherPayment(); + op1.setOtherPaymentTypeCode("002"); + op1.setCode("ISRSUB"); + op1.setConcept("Subsidio ISR para empleo"); + op1.setAmount("0.0"); + op1.setSubsidyCaused("0.0"); + + BalanceCompensation balanceCompensation = new BalanceCompensation(); + balanceCompensation.setFavorableBalance("0.0"); + balanceCompensation.setYear(2022); + balanceCompensation.setRemainingFavorableBalance("0.0"); + + op1.setBalanceCompensation(balanceCompensation); + + otherPayments.add(op1); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("004"); + d1.setCode("ZA09"); + d1.setConcept("APORTACION FONDO AHORRO"); + d1.setAmount("121.03"); + + PayrollDeduction d2 = new PayrollDeduction(); + d2.setDeductionTypeCode("002"); + d2.setCode("ISR"); + d2.setConcept("ISR"); + d2.setAmount("36.57"); + + PayrollDeduction d3 = new PayrollDeduction(); + d3.setDeductionTypeCode("001"); + d3.setCode("IMSS"); + d3.setConcept("Cuota de Seguridad Social EE"); + d3.setAmount("30.08"); + + PayrollDeduction d4 = new PayrollDeduction(); + d4.setDeductionTypeCode("004"); + d4.setCode("ZA68"); + d4.setConcept("DEDUCCION FDO AHORRO PAT"); + d4.setAmount("121.03"); + + PayrollDeduction d5 = new PayrollDeduction(); + d5.setDeductionTypeCode("018"); + d5.setCode("ZA11"); + d5.setConcept("APORTACION CAJA AHORRO"); + d5.setAmount("300.00"); + + payrollDeductions.add(d1); + payrollDeductions.add(d2); + payrollDeductions.add(d3); + payrollDeductions.add(d4); + payrollDeductions.add(d5); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setItems(items); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + // Nómina con horas extra por referencias + // Emisor + /* + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setId("0e82a655-5f0c-4e07-abab-8f322e4123ef"); + + List credentials = new ArrayList<>(); + + TaxCredential cer = new TaxCredential(); + cer.setBase64File(base64Cer); + cer.setFileType(0); + cer.setPassword(password); + + TaxCredential key = new TaxCredential(); + key.setBase64File(base64Key); + key.setFileType(1); + key.setPassword(password); + + credentials.add(cer); + credentials.add(key); + + issuer.setTaxCredentials(credentials); + + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setId("da71df0c-f328-45ee-9bd9-3096ed02c164"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101HNEXXXA4"); + employeeData.setSocialSecurityNumber("000000"); + employeeData.setLaborRelationStartDate("2015-01-01"); + employeeData.setSeniority("P437W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatWorkdayTypeId("01"); + employeeData.setSatTaxRegimeTypeId("03"); + employeeData.setEmployeeNumber("120"); + employeeData.setDepartment("Desarrollo"); + employeeData.setPosition("Ingeniero de Software"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatPaymentPeriodicityId("04"); + employeeData.setSatBankId("002"); + employeeData.setBankAccount("1111111111"); + employeeData.setBaseSalaryForContributions("490.22"); + employeeData.setIntegratedDailySalary("146.47"); + employeeData.setSatPayrollStateId("JAL"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-05-24T00:00:00"); + payroll.setInitialPaymentDate("2023-05-09T00:00:00"); + payroll.setFinalPaymentDate("2023-05-24T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("00500"); + e1.setConcept("Sueldos, Salarios Rayas y Jornales"); + e1.setTaxedAmount("2808.8"); + e1.setExemptAmount("2191.2"); + + PayrollEarning e2 = new PayrollEarning(); + e2.setEarningTypeCode("019"); + e2.setCode("00100"); + e2.setConcept("Horas Extra"); + e2.setTaxedAmount("50.00"); + e2.setExemptAmount("50.00"); + + List overtimeList = new ArrayList<>(); + PayrollEarningOvertime overtime1 = new PayrollEarningOvertime(); + overtime1.setDays(1); + overtime1.setHoursTypeCode("01"); + overtime1.setExtraHours(2); + overtime1.setAmountPaid("100.00"); + overtimeList.add(overtime1); + + e2.setOvertime(overtimeList); + + earnings.add(e1); + earnings.add(e2); + +// Other Payments + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("001"); + d1.setCode("00301"); + d1.setConcept("Seguridad Social"); + d1.setAmount(200); + + PayrollDeduction d2 = new PayrollDeduction(); + d2.setDeductionTypeCode("002"); + d2.setCode("00302"); + d2.setConcept("ISR"); + d2.setAmount(100); + + payrollDeductions.add(d1); + payrollDeductions.add(d2); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + //Nómina con horas extra + // Emisor + /* + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + + EmployerData employerData = new EmployerData(); + employerData.setEmployerRegistration("B5510768108"); + employerData.setOriginEmployerTin("URE180429TM6"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("XOJI740919U48"); + recipient.setLegalName("INGRID XODAR JIMENEZ"); + recipient.setZipCode("76028"); + recipient.setTaxRegimeCode("605"); + recipient.setCfdiUseCode("CN01"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101HNEXXXA4"); + employeeData.setSocialSecurityNumber("000000"); + employeeData.setLaborRelationStartDate("2015-01-01"); + employeeData.setSeniority("P437W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatWorkdayTypeId("01"); + employeeData.setSatTaxRegimeTypeId("03"); + employeeData.setEmployeeNumber("120"); + employeeData.setDepartment("Desarrollo"); + employeeData.setPosition("Ingeniero de Software"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatPaymentPeriodicityId("04"); + employeeData.setSatBankId("002"); + employeeData.setBankAccount("1111111111"); + employeeData.setBaseSalaryForContributions("490.22"); + employeeData.setIntegratedDailySalary("146.47"); + employeeData.setSatPayrollStateId("JAL"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-05-24T00:00:00"); + payroll.setInitialPaymentDate("2023-05-09T00:00:00"); + payroll.setFinalPaymentDate("2023-05-24T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("00500"); + e1.setConcept("Sueldos, Salarios Rayas y Jornales"); + e1.setTaxedAmount("2808.8"); + e1.setExemptAmount("2191.2"); + + PayrollEarning e2 = new PayrollEarning(); + e2.setEarningTypeCode("019"); + e2.setCode("00100"); + e2.setConcept("Horas Extra"); + e2.setTaxedAmount("50.00"); + e2.setExemptAmount("50.00"); + + List overtimeList = new ArrayList<>(); + PayrollEarningOvertime overtime1 = new PayrollEarningOvertime(); + overtime1.setDays(1); + overtime1.setHoursTypeCode("01"); + overtime1.setExtraHours(2); + overtime1.setAmountPaid("100.00"); + overtimeList.add(overtime1); + + e2.setOvertime(overtimeList); + + earnings.add(e1); + earnings.add(e2); + +// Other Payments + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("001"); + d1.setCode("00301"); + d1.setConcept("Seguridad Social"); + d1.setAmount(200); + + PayrollDeduction d2 = new PayrollDeduction(); + d2.setDeductionTypeCode("002"); + d2.setCode("00302"); + d2.setConcept("ISR"); + d2.setAmount(100); + + payrollDeductions.add(d1); + payrollDeductions.add(d2); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + + // Nómina con incapacidades + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + + EmployerData employerData = new EmployerData(); + employerData.setEmployerRegistration("B5510768108"); + employerData.setOriginEmployerTin("URE180429TM6"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("XOJI740919U48"); + recipient.setLegalName("INGRID XODAR JIMENEZ"); + recipient.setZipCode("76028"); + recipient.setTaxRegimeCode("605"); + recipient.setCfdiUseCode("CN01"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101HNEXXXA4"); + employeeData.setSocialSecurityNumber("000000"); + employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); + employeeData.setSeniority("P437W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatWorkdayTypeId("01"); + employeeData.setSatTaxRegimeTypeId("03"); + employeeData.setEmployeeNumber("120"); + employeeData.setDepartment("Desarrollo"); + employeeData.setPosition("Ingeniero de Software"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatPaymentPeriodicityId("04"); + employeeData.setSatBankId("002"); + employeeData.setBankAccount("1111111111"); + employeeData.setBaseSalaryForContributions("490.22"); + employeeData.setIntegratedDailySalary("146.47"); + employeeData.setSatPayrollStateId("JAL"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-05-24T00:00:00"); + payroll.setInitialPaymentDate("2023-05-09T00:00:00"); + payroll.setFinalPaymentDate("2023-05-24T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("00500"); + e1.setConcept("Sueldos, Salarios Rayas y Jornales"); + e1.setTaxedAmount("2808.8"); + e1.setExemptAmount("2191.2"); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("001"); + d1.setCode("00301"); + d1.setConcept("Seguridad Social"); + d1.setAmount(200); + + PayrollDeduction d2 = new PayrollDeduction(); + d2.setDeductionTypeCode("002"); + d2.setCode("00302"); + d2.setConcept("ISR"); + d2.setAmount(100); + + payrollDeductions.add(d1); + payrollDeductions.add(d2); + +// Disabilities + List disabilities = new ArrayList<>(); + + PayrollDisability disability1 = new PayrollDisability(); + disability1.setDisabilityDays(1); + disability1.setDisabilityTypeCode("01"); + + disabilities.add(disability1); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + payroll.setDisabilities(disabilities); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + //Nómina con incapacidades por referencias + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setId("bef56254-0892-4558-95c3-f9c8729e4b0e"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setId("54fc14ae-c88f-4afc-996b-0574d63341e2"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-05-24T00:00:00"); + payroll.setInitialPaymentDate("2023-05-09T00:00:00"); + payroll.setFinalPaymentDate("2023-05-24T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("00500"); + e1.setConcept("Sueldos, Salarios Rayas y Jornales"); + e1.setTaxedAmount("2808.8"); + e1.setExemptAmount("2191.2"); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("001"); + d1.setCode("00301"); + d1.setConcept("Seguridad Social"); + d1.setAmount("200.00"); + + PayrollDeduction d2 = new PayrollDeduction(); + d2.setDeductionTypeCode("002"); + d2.setCode("00302"); + d2.setConcept("ISR"); + d2.setAmount("100.00"); + + payrollDeductions.add(d1); + payrollDeductions.add(d2); + +// Disabilities + List disabilities = new ArrayList<>(); + + PayrollDisability disability1 = new PayrollDisability(); + disability1.setDisabilityDays(1); + disability1.setDisabilityTypeCode("01"); + + disabilities.add(disability1); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + payroll.setDisabilities(disabilities); + + Complement complement = new Complement(); + complement.setPayroll(payroll); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + //Nómina con SNCF + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("OÑO120726RX3"); + issuer.setLegalName("ORGANICOS ÑAVEZ OSORIO"); + issuer.setTaxRegimeCode("601"); + + EmployerData employerData = new EmployerData(); + employerData.setEmployerRegistration("27112029"); + employerData.setSatFundSourceId("IP"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("CACX7605101P8"); + recipient.setLegalName("XOCHILT CASAS CHAVEZ"); + recipient.setZipCode("36257"); + recipient.setTaxRegimeCode("605"); + recipient.setCfdiUseCode("CN01"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101HNEXXXA4"); + employeeData.setSocialSecurityNumber("80997742673"); + employeeData.setLaborRelationStartDate("2021-09-01"); + employeeData.setSeniority("P88W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatTaxRegimeTypeId("02"); + employeeData.setEmployeeNumber("273"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatPaymentPeriodicityId("04"); + employeeData.setIntegratedDailySalary("221.48"); + employeeData.setSatPayrollStateId("GRO"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-05-16T00:00:00"); + payroll.setInitialPaymentDate("2023-05-01T00:00:00"); + payroll.setFinalPaymentDate("2023-05-16T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("P001"); + e1.setConcept("Sueldos, Salarios Rayas y Jornales"); + e1.setTaxedAmount("3322.20"); + e1.setExemptAmount("0.0"); + + PayrollEarning e2 = new PayrollEarning(); + e2.setEarningTypeCode("038"); + e2.setCode("P540"); + e2.setConcept("Compensacion"); + e2.setTaxedAmount("100.0"); + e2.setExemptAmount("0.0"); + + PayrollEarning e3 = new PayrollEarning(); + e3.setEarningTypeCode("038"); + e3.setCode("P550"); + e3.setConcept("Compensación Garantizada Extraordinaria"); + e3.setTaxedAmount("2200.0"); + e3.setExemptAmount("0.0"); + + PayrollEarning e4 = new PayrollEarning(); + e4.setEarningTypeCode("038"); + e4.setCode("P530"); + e4.setConcept("Servicio Extraordinario"); + e4.setTaxedAmount("200.0"); + e4.setExemptAmount("0.0"); + + PayrollEarning e5 = new PayrollEarning(); + e5.setEarningTypeCode("001"); + e5.setCode("P506"); + e5.setConcept("Otras Prestaciones"); + e5.setTaxedAmount("1500.0"); + e5.setExemptAmount("0.0"); + + PayrollEarning e6 = new PayrollEarning(); + e6.setEarningTypeCode("001"); + e6.setCode("P505"); + e6.setConcept("Remuneración al Desempeño Legislativo"); + e6.setTaxedAmount("17500.0"); + e6.setExemptAmount("0.0"); + + earnings.add(e1); + earnings.add(e2); + earnings.add(e3); + earnings.add(e4); + earnings.add(e5); + earnings.add(e6); + +// Other Payments + List otherPayments = new ArrayList<>(); + + PayrollEarningOtherPayment op1 = new PayrollEarningOtherPayment(); + op1.setOtherPaymentTypeCode("002"); + op1.setCode("o002"); + op1.setConcept("Subsidio para el empleo efectivamente entregado al trabajador"); + op1.setAmount("0.0"); + op1.setSubsidyCaused("0.0"); + + otherPayments.add(op1); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("002"); + d1.setCode("D002"); + d1.setConcept("ISR"); + d1.setAmount("4716.61"); + + PayrollDeduction d2 = new PayrollDeduction(); + d2.setDeductionTypeCode("004"); + d2.setCode("D525"); + d2.setConcept("Redondeo"); + d2.setAmount("0.81"); + + PayrollDeduction d3 = new PayrollDeduction(); + d3.setDeductionTypeCode("001"); + d3.setCode("D510"); + d3.setConcept("Cuota Trabajador ISSSTE"); + d3.setAmount("126.78"); + + payrollDeductions.add(d1); + payrollDeductions.add(d2); + payrollDeductions.add(d3); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("39074"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + //Nómina con SNCF por referencias + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setId("ab7ec306-6f81-4f9f-b55f-bbbb1ab2f153"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setId("acf43966-4672-48b6-a01a-d04cac6c3d64"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-05-16T00:00:00"); + payroll.setInitialPaymentDate("2023-05-01T00:00:00"); + payroll.setFinalPaymentDate("2023-05-16T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("P001"); + e1.setConcept("Sueldos, Salarios Rayas y Jornales"); + e1.setTaxedAmount("3322.20"); + e1.setExemptAmount("0"); + + PayrollEarning e2 = new PayrollEarning(); + e2.setEarningTypeCode("038"); + e2.setCode("P540"); + e2.setConcept("Compensacion"); + e2.setTaxedAmount("100.00"); + e2.setExemptAmount("0"); + + PayrollEarning e3 = new PayrollEarning(); + e3.setEarningTypeCode("038"); + e3.setCode("P550"); + e3.setConcept("Compensación Garantizada Extraordinaria"); + e3.setTaxedAmount("2200.00"); + e3.setExemptAmount("0"); + + PayrollEarning e4 = new PayrollEarning(); + e4.setEarningTypeCode("038"); + e4.setCode("P530"); + e4.setConcept("Servicio Extraordinario"); + e4.setTaxedAmount("200.00"); + e4.setExemptAmount("0"); + + PayrollEarning e5 = new PayrollEarning(); + e5.setEarningTypeCode("001"); + e5.setCode("P506"); + e5.setConcept("Otras Prestaciones"); + e5.setTaxedAmount("1500.00"); + e5.setExemptAmount("0"); + + PayrollEarning e6 = new PayrollEarning(); + e6.setEarningTypeCode("001"); + e6.setCode("P505"); + e6.setConcept("Remuneración al Desempeño Legislativo"); + e6.setTaxedAmount("17500.00"); + e6.setExemptAmount("0"); + + earnings.add(e1); + earnings.add(e2); + earnings.add(e3); + earnings.add(e4); + earnings.add(e5); + earnings.add(e6); + +// Other Payments + List otherPayments = new ArrayList<>(); + + PayrollEarningOtherPayment op1 = new PayrollEarningOtherPayment(); + op1.setOtherPaymentTypeCode("002"); + op1.setCode("002"); + op1.setConcept("Subsidio para el empleo efectivamente entregado al trabajador"); + op1.setAmount("0"); + op1.setSubsidyCaused("0"); + + otherPayments.add(op1); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("002"); + d1.setCode("D002"); + d1.setConcept("ISR"); + d1.setAmount("4716.61"); + + PayrollDeduction d2 = new PayrollDeduction(); + d2.setDeductionTypeCode("004"); + d2.setCode("D525"); + d2.setConcept("Redondeo"); + d2.setAmount("0.81"); + + PayrollDeduction d3 = new PayrollDeduction(); + d3.setDeductionTypeCode("001"); + d3.setCode("D510"); + d3.setConcept("Cuota Trabajador ISSSTE"); + d3.setAmount("126.78"); + + payrollDeductions.add(d1); + payrollDeductions.add(d2); + payrollDeductions.add(d3); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + + Complement complement = new Complement(); + complement.setPayroll(payroll); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("39074"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + // Nómina extraordinaria + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + + EmployerData employerData = new EmployerData(); + employerData.setEmployerRegistration("B5510768108"); + employerData.setOriginEmployerTin("URE180429TM6"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("XOJI740919U48"); + recipient.setLegalName("INGRID XODAR JIMENEZ"); + recipient.setZipCode("76028"); + recipient.setTaxRegimeCode("605"); + recipient.setCfdiUseCode("CN01"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101HNEXXXA4"); + employeeData.setSocialSecurityNumber("000000"); + employeeData.setLaborRelationStartDate("2015-01-01"); + employeeData.setSeniority("P439W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatWorkdayTypeId("01"); + employeeData.setSatTaxRegimeTypeId("03"); + employeeData.setEmployeeNumber("120"); + employeeData.setDepartment("Desarrollo"); + employeeData.setPosition("Ingeniero de Software"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatPaymentPeriodicityId("99"); + employeeData.setSatBankId("002"); + employeeData.setBankAccount("1111111111"); + employeeData.setIntegratedDailySalary("146.47"); + employeeData.setSatPayrollStateId("JAL"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("E"); + payroll.setPaymentDate("2023-06-04T00:00:00"); + payroll.setInitialPaymentDate("2023-06-04T00:00:00"); + payroll.setFinalPaymentDate("2023-06-04T00:00:00"); + payroll.setDaysPaid(30); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("002"); + e1.setCode("00500"); + e1.setConcept("Gratificación Anual (Aguinaldo)"); + e1.setTaxedAmount("0.00"); + e1.setExemptAmount("10000.00"); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions (empty list) + List payrollDeductions = new ArrayList<>(); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + Nómina extraordinaria por referencias + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setId("bef56254-0892-4558-95c3-f9c8729e4b0e"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setId("54fc14ae-c88f-4afc-996b-0574d63341e2"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("E"); + payroll.setPaymentDate("2023-06-04T00:00:00"); + payroll.setInitialPaymentDate("2023-06-04T00:00:00"); + payroll.setFinalPaymentDate("2023-06-04T00:00:00"); + payroll.setDaysPaid(30); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("002"); + e1.setCode("00500"); + e1.setConcept("Gratificación Anual (Aguinaldo)"); + e1.setTaxedAmount("0.00"); + e1.setExemptAmount("10000.00"); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions (empty list) + List payrollDeductions = new ArrayList<>(); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + + Complement complement = new Complement(); + complement.setPayroll(payroll); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + // Nómina separacion indemnización + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + + EmployerData employerData = new EmployerData(); + employerData.setEmployerRegistration("B5510768108"); + employerData.setOriginEmployerTin("URE180429TM6"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("XOJI740919U48"); + recipient.setLegalName("INGRID XODAR JIMENEZ"); + recipient.setZipCode("76028"); + recipient.setTaxRegimeCode("605"); + recipient.setCfdiUseCode("CN01"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101HNEXXXA4"); + employeeData.setSocialSecurityNumber("000000"); + employeeData.setLaborRelationStartDate("2015-01-01"); + employeeData.setSeniority("P439W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatWorkdayTypeId("01"); + employeeData.setSatTaxRegimeTypeId("03"); + employeeData.setEmployeeNumber("120"); + employeeData.setDepartment("Desarrollo"); + employeeData.setPosition("Ingeniero de Software"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatPaymentPeriodicityId("99"); + employeeData.setSatBankId("002"); + employeeData.setBankAccount("1111111111"); + employeeData.setIntegratedDailySalary("146.47"); + employeeData.setSatPayrollStateId("JAL"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("E"); + payroll.setPaymentDate("2023-06-04T00:00:00"); + payroll.setInitialPaymentDate("2023-05-05T00:00:00"); + payroll.setFinalPaymentDate("2023-06-04T00:00:00"); + payroll.setDaysPaid(30); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("023"); + e1.setCode("00500"); + e1.setConcept("Pagos por separación"); + e1.setTaxedAmount("0.00"); + e1.setExemptAmount("10000.00"); + + PayrollEarning e2 = new PayrollEarning(); + e2.setEarningTypeCode("025"); + e2.setCode("00900"); + e2.setConcept("Indemnizaciones"); + e2.setTaxedAmount("0.00"); + e2.setExemptAmount("500.00"); + + earnings.add(e1); + earnings.add(e2); + +// Other Payments + List otherPayments = new ArrayList<>(); + +// Severance + PayrollSeverance severance = new PayrollSeverance(); + severance.setTotalPaid("10500.00"); + severance.setYearsOfService(1); + severance.setLastMonthlySalary("10000.00"); + severance.setAccumulableIncome("10000.00"); + severance.setNonAccumulableIncome("0.00"); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + payrollEarnings.setSeverance(severance); + +// Deductions (empty list) + List payrollDeductions = new ArrayList<>(); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + // Nómina separacion indemnización por referencias + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setId("0e82a655-5f0c-4e07-abab-8f322e4123ef"); + + // Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setId("aa2ad8c3-6ec5-4601-91be-d827d9a865bc"); + + + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("E"); + payroll.setPaymentDate("2023-06-04T00:00:00"); + payroll.setInitialPaymentDate("2023-06-04T00:00:00"); + payroll.setFinalPaymentDate("2023-06-04T00:00:00"); + payroll.setDaysPaid(30); + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("023"); + e1.setCode("00500"); + e1.setConcept("Pagos por separación"); + e1.setTaxedAmount("0"); + e1.setExemptAmount("10000.0"); + + PayrollEarning e2 = new PayrollEarning(); + e2.setEarningTypeCode("025"); + e2.setCode("00900"); + e2.setConcept("Indemnizaciones"); + e2.setTaxedAmount("0"); + e2.setExemptAmount("500.0"); + + earnings.add(e1); + earnings.add(e2); + + List otherPayments = new ArrayList<>(); + PayrollSeverance severance = new PayrollSeverance(); + severance.setTotalPaid("10500.00"); + severance.setYearsOfService(1); + severance.setLastMonthlySalary("10000.00"); + severance.setAccumulableIncome("10000.00"); + severance.setNonAccumulableIncome("0"); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + payrollEarnings.setSeverance(severance); + payroll.setEarnings(payrollEarnings); + + List payrollDeductions = new ArrayList<>(); + + payroll.setDeductions(payrollDeductions); + Complement complement = new Complement(); + complement.setPayroll(payroll); + + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); + invoice.setTypeCode("N"); + invoice.setExpeditionZipCode("20000"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setDate("2026-02-09T10:00:00"); + invoice.setPaymentMethodCode("PUE"); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + System.out.println(apiResponse); + + // Nómina jubilación + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + + EmployerData employerData = new EmployerData(); + employerData.setEmployerRegistration("B5510768108"); + employerData.setOriginEmployerTin("URE180429TM6"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("XOJI740919U48"); + recipient.setLegalName("INGRID XODAR JIMENEZ"); + recipient.setZipCode("76028"); + recipient.setTaxRegimeCode("605"); + recipient.setCfdiUseCode("CN01"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101HNEXXXA4"); + employeeData.setSocialSecurityNumber("000000"); + employeeData.setLaborRelationStartDate("2015-01-01"); + employeeData.setSeniority("P439W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatWorkdayTypeId("01"); + employeeData.setSatTaxRegimeTypeId("03"); + employeeData.setEmployeeNumber("120"); + employeeData.setDepartment("Desarrollo"); + employeeData.setPosition("Ingeniero de Software"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatPaymentPeriodicityId("99"); + employeeData.setSatBankId("002"); + employeeData.setBankAccount("1111111111"); + employeeData.setIntegratedDailySalary("146.47"); + employeeData.setSatPayrollStateId("JAL"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("E"); + payroll.setPaymentDate("2023-05-05T00:00:00"); + payroll.setInitialPaymentDate("2023-06-04T00:00:00"); + payroll.setFinalPaymentDate("2023-06-04T00:00:00"); + payroll.setDaysPaid(30); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("039"); + e1.setCode("00500"); + e1.setConcept("Jubilaciones, pensiones o haberes de retiro"); + e1.setTaxedAmount("0.00"); + e1.setExemptAmount("10000.00"); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + +// Retirement + PayrollRetirement retirement = new PayrollRetirement(); + retirement.setTotalOneTime("10000.00"); + retirement.setAccumulableIncome("10000.00"); + retirement.setNonAccumulableIncome("0.00"); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + payrollEarnings.setRetirement(retirement); + +// Deductions (empty list) + List payrollDeductions = new ArrayList<>(); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + // Nómina jubilación por referencias + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setId("bef56254-0892-4558-95c3-f9c8729e4b0e"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setId("54fc14ae-c88f-4afc-996b-0574d63341e2"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("E"); + payroll.setPaymentDate("2023-05-05T00:00:00"); + payroll.setInitialPaymentDate("2023-06-04T00:00:00"); + payroll.setFinalPaymentDate("2023-06-04T00:00:00"); + payroll.setDaysPaid(30); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("039"); + e1.setCode("00500"); + e1.setConcept("Jubilaciones, pensiones o haberes de retiro"); + e1.setTaxedAmount("0.00"); + e1.setExemptAmount("10000.00"); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + +// Retirement + PayrollRetirement retirement = new PayrollRetirement(); + retirement.setTotalOneTime("10000.00"); + retirement.setAccumulableIncome("10000.00"); + retirement.setNonAccumulableIncome("0.00"); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + payrollEarnings.setRetirement(retirement); + +// Deductions (empty list) + List payrollDeductions = new ArrayList<>(); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + + Complement complement = new Complement(); + complement.setPayroll(payroll); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + // Nómina sin deducciones + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + + EmployerData employerData = new EmployerData(); + employerData.setEmployerRegistration("B5510768108"); + employerData.setOriginEmployerTin("URE180429TM6"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("XOJI740919U48"); + recipient.setLegalName("INGRID XODAR JIMENEZ"); + recipient.setZipCode("76028"); + recipient.setTaxRegimeCode("605"); + recipient.setCfdiUseCode("CN01"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101HNEXXXA4"); + employeeData.setSocialSecurityNumber("000000"); + employeeData.setLaborRelationStartDate("2015-01-01"); + employeeData.setSeniority("P437W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatWorkdayTypeId("01"); + employeeData.setSatTaxRegimeTypeId("03"); + employeeData.setEmployeeNumber("120"); + employeeData.setDepartment("Desarrollo"); + employeeData.setPosition("Ingeniero de Software"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatPaymentPeriodicityId("04"); + employeeData.setSatBankId("002"); + employeeData.setBankAccount("1111111111"); + employeeData.setBaseSalaryForContributions("490.22"); + employeeData.setIntegratedDailySalary("146.47"); + employeeData.setSatPayrollStateId("JAL"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-05-24T00:00:00"); + payroll.setInitialPaymentDate("2023-05-09T00:00:00"); + payroll.setFinalPaymentDate("2023-05-24T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("00500"); + e1.setConcept("Sueldos, Salarios Rayas y Jornales"); + e1.setTaxedAmount("2808.8"); + e1.setExemptAmount("2191.2"); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions (empty list) + List payrollDeductions = new ArrayList<>(); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + //Nómina sin deducciones por referencias + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setId("bef56254-0892-4558-95c3-f9c8729e4b0e"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setId("54fc14ae-c88f-4afc-996b-0574d63341e2"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-05-24T00:00:00"); + payroll.setInitialPaymentDate("2023-05-09T00:00:00"); + payroll.setFinalPaymentDate("2023-05-24T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("00500"); + e1.setConcept("Sueldos, Salarios Rayas y Jornales"); + e1.setTaxedAmount("2808.8"); + e1.setExemptAmount("2191.2"); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions (empty list) + List payrollDeductions = new ArrayList<>(); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + + Complement complement = new Complement(); + complement.setPayroll(payroll); +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + // Nómina viáticos + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + + EmployerData employerData = new EmployerData(); + employerData.setEmployerRegistration("B5510768108"); + employerData.setOriginEmployerTin("URE180429TM6"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("XOJI740919U48"); + recipient.setLegalName("INGRID XODAR JIMENEZ"); + recipient.setZipCode("76028"); + recipient.setTaxRegimeCode("605"); + recipient.setCfdiUseCode("CN01"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101HNEXXXA4"); + employeeData.setSocialSecurityNumber("000000"); + employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); + employeeData.setSeniority("P438W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatWorkdayTypeId("01"); + employeeData.setSatTaxRegimeTypeId("03"); + employeeData.setEmployeeNumber("120"); + employeeData.setDepartment("Desarrollo"); + employeeData.setPosition("Ingeniero de Software"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatPaymentPeriodicityId("04"); + employeeData.setSatBankId("002"); + employeeData.setBankAccount("1111111111"); + employeeData.setBaseSalaryForContributions("490.22"); + employeeData.setIntegratedDailySalary("146.47"); + employeeData.setSatPayrollStateId("JAL"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-09-26T00:00:00"); + payroll.setInitialPaymentDate("2023-09-11T00:00:00"); + payroll.setFinalPaymentDate("2023-09-26T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("050"); + e1.setCode("050"); + e1.setConcept("Viaticos"); + e1.setTaxedAmount(0); + e1.setExemptAmount(3000); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("081"); + d1.setCode("081"); + d1.setConcept("Ajuste en viaticos entregados al trabajador"); + d1.setAmount(3000); + + payrollDeductions.add(d1); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + // Nómina viáticos por referencias + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setId("0e82a655-5f0c-4e07-abab-8f322e4123ef"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setId("54fc14ae-c88f-4afc-996b-0574d63341e2"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-09-26T00:00:00"); + payroll.setInitialPaymentDate("2023-09-11T00:00:00"); + payroll.setFinalPaymentDate("2023-09-26T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("050"); + e1.setCode("050"); + e1.setConcept("Viaticos"); + e1.setTaxedAmount("0"); + e1.setExemptAmount("3000"); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("081"); + d1.setCode("081"); + d1.setConcept("Ajuste en viaticos entregados al trabajador"); + d1.setAmount("3000.00"); + + payrollDeductions.add(d1); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + + Complement complement = new Complement(); + complement.setPayroll(payroll); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + // Nómina subsidio causado al empleo + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + + EmployerData employerData = new EmployerData(); + employerData.setEmployerRegistration("B5510768108"); + employerData.setOriginEmployerTin("URE180429TM6"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("XOJI740919U48"); + recipient.setLegalName("INGRID XODAR JIMENEZ"); + recipient.setZipCode("76028"); + recipient.setTaxRegimeCode("605"); + recipient.setCfdiUseCode("CN01"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101HNEXXXA4"); + employeeData.setSocialSecurityNumber("000000"); + employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); + employeeData.setSeniority("P437W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatWorkdayTypeId("01"); + employeeData.setSatTaxRegimeTypeId("0aa2ad8c3-6ec5-4601-91be-d827d9a865bc2"); + employeeData.setEmployeeNumber("120"); + employeeData.setDepartment("Desarrollo"); + employeeData.setPosition("Ingeniero de Software"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatPaymentPeriodicityId("04"); + employeeData.setSatBankId("002"); + employeeData.setBankAccount("1111111111"); + employeeData.setBaseSalaryForContributions("490.22"); + employeeData.setIntegratedDailySalary("146.47"); + employeeData.setSatPayrollStateId("JAL"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-05-24T00:00:00"); + payroll.setInitialPaymentDate("2023-05-09T00:00:00"); + payroll.setFinalPaymentDate("2023-05-24T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("00500"); + e1.setConcept("Sueldos, Salarios Rayas y Jornales"); + e1.setTaxedAmount("2808.8"); + e1.setExemptAmount("2191.2"); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + + PayrollEarningOtherPayment op1 = new PayrollEarningOtherPayment(); + op1.setOtherPaymentTypeCode("007"); + op1.setCode("0002"); + op1.setConcept("ISR ajustado por subsidio"); + op1.setAmount("145.80"); + op1.setSubsidyCaused("0.0"); + + otherPayments.add(op1); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("107"); + d1.setCode("D002"); + d1.setConcept("Ajuste al Subsidio Causado"); + d1.setAmount("160.35"); + + PayrollDeduction d2 = new PayrollDeduction(); + d2.setDeductionTypeCode("002"); + d2.setCode("D002"); + d2.setConcept("ISR"); + d2.setAmount("145.80"); + + payrollDeductions.add(d1); + payrollDeductions.add(d2); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + //Nómina subsidio causado al empleo por referencias + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setId("bef56254-0892-4558-95c3-f9c8729e4b0e"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setId("54fc14ae-c88f-4afc-996b-0574d63341e2"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-05-24T00:00:00"); + payroll.setInitialPaymentDate("2023-05-09T00:00:00"); + payroll.setFinalPaymentDate("2023-05-24T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("00500"); + e1.setConcept("Sueldos, Salarios Rayas y Jornales"); + e1.setTaxedAmount("2808.8"); + e1.setExemptAmount("2191.2"); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + + PayrollEarningOtherPayment op1 = new PayrollEarningOtherPayment(); + op1.setOtherPaymentTypeCode("007"); + op1.setCode("0002"); + op1.setConcept("ISR ajustado por subsidio"); + op1.setAmount("145.80"); + op1.setSubsidyCaused("0.0"); + + otherPayments.add(op1); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("107"); + d1.setCode("D002"); + d1.setConcept("Ajuste al Subsidio Causado"); + d1.setAmount("160.35"); + + PayrollDeduction d2 = new PayrollDeduction(); + d2.setDeductionTypeCode("002"); + d2.setCode("D002"); + d2.setConcept("ISR"); + d2.setAmount("145.80"); + + payrollDeductions.add(d1); + payrollDeductions.add(d2); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + + Complement complement = new Complement(); + complement.setPayroll(payroll); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + + // Nómina + // Emisor + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + + EmployerData employerData = new EmployerData(); + employerData.setEmployerRegistration("B5510768108"); + employerData.setOriginEmployerTin("URE180429TM6"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("XOJI740919U48"); + recipient.setLegalName("INGRID XODAR JIMENEZ"); + recipient.setZipCode("76028"); + recipient.setTaxRegimeCode("605"); + recipient.setCfdiUseCode("CN01"); + + EmployeeData employeeData = new EmployeeData(); + employeeData.setCurp("XEXX010101HNEXXXA4"); + employeeData.setSocialSecurityNumber("000000"); + employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); + employeeData.setSeniority("P437W"); + employeeData.setSatContractTypeId("01"); + employeeData.setSatWorkdayTypeId("01"); + employeeData.setSatTaxRegimeTypeId("03"); + employeeData.setEmployeeNumber("120"); + employeeData.setDepartment("Desarrollo"); + employeeData.setPosition("Ingeniero de Software"); + employeeData.setSatJobRiskId("1"); + employeeData.setSatPaymentPeriodicityId("04"); + employeeData.setSatBankId("002"); + employeeData.setBankAccount("1111111111"); + employeeData.setBaseSalaryForContributions("490.22"); + employeeData.setIntegratedDailySalary("146.47"); + employeeData.setSatPayrollStateId("JAL"); + +// Payroll + Payroll payroll = new Payroll(); + payroll.setVersion("1.2"); + payroll.setPayrollTypeCode("O"); + payroll.setPaymentDate("2023-05-24T00:00:00"); + payroll.setInitialPaymentDate("2023-05-09T00:00:00"); + payroll.setFinalPaymentDate("2023-05-24T00:00:00"); + payroll.setDaysPaid(15); + +// Earnings + PayrollEarnings payrollEarnings = new PayrollEarnings(); + List earnings = new ArrayList<>(); + + PayrollEarning e1 = new PayrollEarning(); + e1.setEarningTypeCode("001"); + e1.setCode("00500"); + e1.setConcept("Sueldos, Salarios Rayas y Jornales"); + e1.setTaxedAmount("2808.8"); + e1.setExemptAmount("2191.2"); + + earnings.add(e1); + +// Other Payments + List otherPayments = new ArrayList<>(); + + payrollEarnings.setEarnings(earnings); + payrollEarnings.setOtherPayments(otherPayments); + +// Deductions + List payrollDeductions = new ArrayList<>(); + + PayrollDeduction d1 = new PayrollDeduction(); + d1.setDeductionTypeCode("001"); + d1.setCode("00301"); + d1.setConcept("Seguridad Social"); + d1.setAmount(200); + + PayrollDeduction d2 = new PayrollDeduction(); + d2.setDeductionTypeCode("002"); + d2.setCode("00302"); + d2.setConcept("ISR"); + d2.setAmount(100); + + payrollDeductions.add(d1); + payrollDeductions.add(d2); + + payroll.setEarnings(payrollEarnings); + payroll.setDeductions(payrollDeductions); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setTypeCode("N"); + invoice.setPaymentMethodCode("PUE"); + invoice.setCurrencyCode("MXN"); + invoice.setExpeditionZipCode("20000"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setComplement(invoice.getComplement()); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + */ + + //Complemento Impuestos locales + //Ingreso Impuestos locales + // Emisor + /* + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("EKU9003173C9"); + recipient.setLegalName("ESCUELA KEMPER URGATE"); + recipient.setZipCode("42501"); + recipient.setTaxRegimeCode("601"); + recipient.setCfdiUseCode("G01"); + recipient.setEmail("someone@somewhere.com"); + +// Items + List items = new ArrayList<>(); + +// Item 1 + InvoiceItem item1 = new InvoiceItem(); + item1.setItemCode("01010101"); + item1.setQuantity("9.5"); + item1.setUnitOfMeasurementCode("E48"); + item1.setUnitOfMeasurement("Unidad de servicio"); + item1.setDescription("Invoicing software as a service"); + item1.setUnitPrice("3587.75"); + item1.setTaxObjectCode("02"); + item1.setItemSku("7506022301697"); + item1.setDiscount("255.85"); + + List taxes1 = new ArrayList<>(); + ItemTax tax1 = new ItemTax(); + tax1.setTaxCode("002"); + tax1.setTaxTypeCode("Tasa"); + tax1.setTaxRate("0.160000"); + tax1.setTaxFlagCode("T"); + taxes1.add(tax1); + + item1.setItemTaxes(taxes1); + +// Item 2 + InvoiceItem item2 = new InvoiceItem(); + item2.setItemCode("01010101"); + item2.setQuantity("8.0"); + item2.setUnitOfMeasurementCode("E48"); + item2.setUnitOfMeasurement("Unidad de servicio2"); + item2.setDescription("Software Consultant"); + item2.setUnitPrice("250.85"); + item2.setTaxObjectCode("02"); + item2.setItemSku("7506022301698"); + item2.setDiscount("255.85"); + + List taxes2 = new ArrayList<>(); + ItemTax tax2 = new ItemTax(); + tax2.setTaxCode("002"); + tax2.setTaxTypeCode("Tasa"); + tax2.setTaxRate("0.160000"); + tax2.setTaxFlagCode("T"); + taxes2.add(tax2); + + item2.setItemTaxes(taxes2); + +// Item 3 + InvoiceItem item3 = new InvoiceItem(); + item3.setItemCode("01010101"); + item3.setQuantity("6.0"); + item3.setUnitOfMeasurementCode("E48"); + item3.setUnitOfMeasurement("Unidad de servicio3"); + item3.setDescription("Computer software"); + item3.setUnitPrice("1250.75"); + item3.setTaxObjectCode("02"); + item3.setItemSku("7506022301699"); + + List taxes3 = new ArrayList<>(); + ItemTax tax3a = new ItemTax(); + tax3a.setTaxCode("002"); + tax3a.setTaxTypeCode("Tasa"); + tax3a.setTaxRate("0.160000"); + tax3a.setTaxFlagCode("T"); + taxes3.add(tax3a); + + ItemTax tax3b = new ItemTax(); + tax3b.setTaxCode("002"); + tax3b.setTaxTypeCode("Tasa"); + tax3b.setTaxRate("0.106666"); + tax3b.setTaxFlagCode("R"); + taxes3.add(tax3b); + + item3.setItemTaxes(taxes3); + + items.add(item1); + items.add(item2); + items.add(item3); + +// Local Taxes Complement + LocalTaxes localTaxes = new LocalTaxes(); + List localTaxList = new ArrayList<>(); + + LocalTax localTax1 = new LocalTax(); + localTax1.setTaxName("CEDULAR"); + localTax1.setTaxRate("3.00"); + localTax1.setTaxAmount("6.00"); + localTax1.setTaxFlagCode("R"); + + LocalTax localTax2 = new LocalTax(); + localTax2.setTaxName("ISH"); + localTax2.setTaxRate("8.00"); + localTax2.setTaxAmount("16.00"); + localTax2.setTaxFlagCode("R"); + + localTaxList.add(localTax1); + localTaxList.add(localTax2); + + localTaxes.setTaxes(localTaxList); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setPaymentFormCode("01"); + invoice.setPaymentConditions("Contado"); + invoice.setCurrencyCode("MXN"); + invoice.setTypeCode("I"); + invoice.setExpeditionZipCode("42501"); + invoice.setPaymentMethodCode("PUE"); + invoice.setExchangeRate("1.0"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setItems(items); + +// Set complement with local taxes + Complement complement = new Complement(); + complement.setLocalTaxes(localTaxes); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + */ + + //Ingreso impuestos locales CEDULAR + // Emisor + /* + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("EKU9003173C9"); + recipient.setLegalName("ESCUELA KEMPER URGATE"); + recipient.setZipCode("42501"); + recipient.setTaxRegimeCode("601"); + recipient.setCfdiUseCode("G01"); + recipient.setEmail("someone@somewhere.com"); + +// Items + List items = new ArrayList<>(); + +// Item 1 + InvoiceItem item1 = new InvoiceItem(); + item1.setItemCode("01010101"); + item1.setQuantity("9.5"); + item1.setUnitOfMeasurementCode("E48"); + item1.setUnitOfMeasurement("Unidad de servicio"); + item1.setDescription("Invoicing software as a service"); + item1.setUnitPrice("3587.75"); + item1.setTaxObjectCode("02"); + item1.setItemSku("7506022301697"); + item1.setDiscount("255.85"); + + List taxes1 = new ArrayList<>(); + ItemTax tax1 = new ItemTax(); + tax1.setTaxCode("002"); + tax1.setTaxTypeCode("Tasa"); + tax1.setTaxRate("0.160000"); + tax1.setTaxFlagCode("T"); + taxes1.add(tax1); + + item1.setItemTaxes(taxes1); + +// Item 2 + InvoiceItem item2 = new InvoiceItem(); + item2.setItemCode("01010101"); + item2.setQuantity("8.0"); + item2.setUnitOfMeasurementCode("E48"); + item2.setUnitOfMeasurement("Unidad de servicio2"); + item2.setDescription("Software Consultant"); + item2.setUnitPrice("250.85"); + item2.setTaxObjectCode("02"); + item2.setItemSku("7506022301698"); + item2.setDiscount("255.85"); + + List taxes2 = new ArrayList<>(); + ItemTax tax2 = new ItemTax(); + tax2.setTaxCode("002"); + tax2.setTaxTypeCode("Tasa"); + tax2.setTaxRate("0.160000"); + tax2.setTaxFlagCode("T"); + taxes2.add(tax2); + + item2.setItemTaxes(taxes2); + +// Item 3 + InvoiceItem item3 = new InvoiceItem(); + item3.setItemCode("01010101"); + item3.setQuantity("6.0"); + item3.setUnitOfMeasurementCode("E48"); + item3.setUnitOfMeasurement("Unidad de servicio3"); + item3.setDescription("Computer software"); + item3.setUnitPrice("1250.75"); + item3.setTaxObjectCode("02"); + item3.setItemSku("7506022301699"); + + List taxes3 = new ArrayList<>(); + ItemTax tax3a = new ItemTax(); + tax3a.setTaxCode("002"); + tax3a.setTaxTypeCode("Tasa"); + tax3a.setTaxRate("0.160000"); + tax3a.setTaxFlagCode("T"); + taxes3.add(tax3a); + + ItemTax tax3b = new ItemTax(); + tax3b.setTaxCode("002"); + tax3b.setTaxTypeCode("Tasa"); + tax3b.setTaxRate("0.106666"); + tax3b.setTaxFlagCode("R"); + taxes3.add(tax3b); + + item3.setItemTaxes(taxes3); + + items.add(item1); + items.add(item2); + items.add(item3); + +// Local Taxes Complement - CEDULAR only + LocalTaxes localTaxes = new LocalTaxes(); + List localTaxList = new ArrayList<>(); + + LocalTax cedularTax = new LocalTax(); + cedularTax.setTaxName("CEDULAR"); + cedularTax.setTaxRate("3.00"); + cedularTax.setTaxAmount("6.00"); + cedularTax.setTaxFlagCode("R"); + + localTaxList.add(cedularTax); + + localTaxes.setTaxes(localTaxList); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setPaymentFormCode("01"); + invoice.setPaymentConditions("Contado"); + invoice.setCurrencyCode("MXN"); + invoice.setTypeCode("I"); + invoice.setExpeditionZipCode("42501"); + invoice.setPaymentMethodCode("PUE"); + invoice.setExchangeRate("1.0"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setItems(items); + +// Set complement with local taxes + Complement complement = new Complement(); + complement.setLocalTaxes(localTaxes); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + */ + + // Factura ingreso impuestos locales ISH + // Emisor + /* + InvoiceIssuer issuer = new InvoiceIssuer(); + issuer.setTin("EKU9003173C9"); + issuer.setLegalName("ESCUELA KEMPER URGATE"); + issuer.setTaxRegimeCode("601"); + +// Receptor + InvoiceRecipient recipient = new InvoiceRecipient(); + recipient.setTin("EKU9003173C9"); + recipient.setLegalName("ESCUELA KEMPER URGATE"); + recipient.setZipCode("42501"); + recipient.setTaxRegimeCode("601"); + recipient.setCfdiUseCode("G01"); + recipient.setEmail("someone@somewhere.com"); + +// Items + List items = new ArrayList<>(); + +// Item 1 + InvoiceItem item1 = new InvoiceItem(); + item1.setItemCode("01010101"); + item1.setQuantity("9.5"); + item1.setUnitOfMeasurementCode("E48"); + item1.setUnitOfMeasurement("Unidad de servicio"); + item1.setDescription("Invoicing software as a service"); + item1.setUnitPrice("3587.75"); + item1.setTaxObjectCode("02"); + item1.setItemSku("7506022301697"); + item1.setDiscount("255.85"); + + List taxes1 = new ArrayList<>(); + ItemTax tax1 = new ItemTax(); + tax1.setTaxCode("002"); + tax1.setTaxTypeCode("Tasa"); + tax1.setTaxRate("0.160000"); + tax1.setTaxFlagCode("T"); + taxes1.add(tax1); + + item1.setItemTaxes(taxes1); + +// Item 2 + InvoiceItem item2 = new InvoiceItem(); + item2.setItemCode("01010101"); + item2.setQuantity("8.0"); + item2.setUnitOfMeasurementCode("E48"); + item2.setUnitOfMeasurement("Unidad de servicio2"); + item2.setDescription("Software Consultant"); + item2.setUnitPrice("250.85"); + item2.setTaxObjectCode("02"); + item2.setItemSku("7506022301698"); + item2.setDiscount("255.85"); + + List taxes2 = new ArrayList<>(); + ItemTax tax2 = new ItemTax(); + tax2.setTaxCode("002"); + tax2.setTaxTypeCode("Tasa"); + tax2.setTaxRate("0.160000"); + tax2.setTaxFlagCode("T"); + taxes2.add(tax2); + + item2.setItemTaxes(taxes2); + +// Item 3 + InvoiceItem item3 = new InvoiceItem(); + item3.setItemCode("01010101"); + item3.setQuantity("6.0"); + item3.setUnitOfMeasurementCode("E48"); + item3.setUnitOfMeasurement("Unidad de servicio3"); + item3.setDescription("Computer software"); + item3.setUnitPrice("1250.75"); + item3.setTaxObjectCode("02"); + item3.setItemSku("7506022301699"); + + List taxes3 = new ArrayList<>(); + ItemTax tax3a = new ItemTax(); + tax3a.setTaxCode("002"); + tax3a.setTaxTypeCode("Tasa"); + tax3a.setTaxRate("0.160000"); + tax3a.setTaxFlagCode("T"); + taxes3.add(tax3a); + + ItemTax tax3b = new ItemTax(); + tax3b.setTaxCode("002"); + tax3b.setTaxTypeCode("Tasa"); + tax3b.setTaxRate("0.106666"); + tax3b.setTaxFlagCode("R"); + taxes3.add(tax3b); + + item3.setItemTaxes(taxes3); + + items.add(item1); + items.add(item2); + items.add(item3); + +// Local Taxes Complement - ISH only + LocalTaxes localTaxes = new LocalTaxes(); + List localTaxList = new ArrayList<>(); + + LocalTax ishTax = new LocalTax(); + ishTax.setTaxName("ISH"); + ishTax.setTaxRate("8.00"); + ishTax.setTaxAmount("16.00"); + ishTax.setTaxFlagCode("R"); + + localTaxList.add(ishTax); + + localTaxes.setTaxes(localTaxList); + +// Invoice + Invoice invoice = new Invoice(); + invoice.setVersionCode("4.0"); + invoice.setSeries("F"); + invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder + invoice.setPaymentFormCode("01"); + invoice.setPaymentConditions("Contado"); + invoice.setCurrencyCode("MXN"); + invoice.setTypeCode("I"); + invoice.setExpeditionZipCode("42501"); + invoice.setPaymentMethodCode("PUE"); + invoice.setExchangeRate("1.0"); + invoice.setExportCode("01"); + invoice.setIssuer(issuer); + invoice.setRecipient(recipient); + invoice.setItems(items); + +// Set complement with local taxes + Complement complement = new Complement(); + complement.setLocalTaxes(localTaxes); + invoice.setComplement(complement); + + ApiResponse apiResponse = client.getInvoiceService().create(invoice); + + System.out.println(apiResponse); + */ + + +// Nómina por valores +// Nómina Ordinaria + // InvoiceIssuer issuer = new InvoiceIssuer(); + // issuer.setTin("EKU9003173C9"); + // issuer.setLegalName("ESCUELA KEMPER URGATE"); + // issuer.setTaxRegimeCode("601"); + + // EmployerData employerData = new EmployerData(); + // employerData.setEmployerRegistration("B5510768108"); + // issuer.setEmployerData(employerData); + + // // Certificados del emisor + // List credentials = new ArrayList<>(); + + // TaxCredential cer = new TaxCredential(); + // cer.setBase64File(base64Cer); + // cer.setFileType(0); // 0 = Certificado (.cer) + // cer.setPassword(password); + + // TaxCredential key = new TaxCredential(); + // key.setBase64File(base64Key); + // key.setFileType(1); // 1 = Clave privada (.key) + // key.setPassword(password); + + // credentials.add(cer); + // credentials.add(key); + + // issuer.setTaxCredentials(credentials); + + // // Receptor + // InvoiceRecipient recipient = new InvoiceRecipient(); + // recipient.setTin("FUNK671228PH6"); + // recipient.setLegalName("KARLA FUENTE NOLASCO"); + // recipient.setZipCode("01160"); + // recipient.setTaxRegimeCode("605"); + // recipient.setCfdiUseCode("CN01"); + // recipient.setEmail("someone@somewhere.com"); + + // EmployeeData employeeData = new EmployeeData(); + // employeeData.setCurp("XEXX010101MNEXXXA8"); + // employeeData.setSocialSecurityNumber("04078873454"); + // employeeData.setLaborRelationStartDate("2024-08-18T00:00:00"); + // employeeData.setSeniority("P54W"); + // employeeData.setSatContractTypeId("01"); + // employeeData.setSatTaxRegimeTypeId("02"); + // employeeData.setEmployeeNumber("123456789"); + // employeeData.setDepartment("GenAI"); + // employeeData.setPosition("Sr Software Engineer"); + // employeeData.setSatJobRiskId("1"); + // employeeData.setSatPaymentPeriodicityId("05"); + // employeeData.setSatBankId("012"); + // employeeData.setBaseSalaryForContributions("282.50"); + // employeeData.setIntegratedDailySalary("2626.23"); + // employeeData.setSatPayrollStateId("JAL"); + // recipient.setEmployeeData(employeeData); + + // Payroll payroll = new Payroll(); + // payroll.setVersion("1.2"); + // payroll.setPayrollTypeCode("O"); + // payroll.setPaymentDate("2025-08-30T00:00:00"); + // payroll.setInitialPaymentDate("2025-07-31T00:00:00"); + // payroll.setFinalPaymentDate("2025-08-30T00:00:00"); + // payroll.setDaysPaid(30); + // PayrollEarnings payrollEarnings = new PayrollEarnings(); + // List earnings = new ArrayList<>(); + + // PayrollEarning e1 = new PayrollEarning(); + // e1.setEarningTypeCode("001"); + // e1.setCode("1003"); + // e1.setConcept("Sueldo nominal"); + // e1.setTaxedAmount("95030"); + // e1.setExemptAmount("0"); + + // PayrollEarning e2 = new PayrollEarning(); + // e2.setEarningTypeCode("005"); + // e2.setCode("5913"); + // e2.setConcept("Fondo de Ahorro Aportación Patrón"); + // e2.setTaxedAmount("0"); + // e2.setExemptAmount("4412.46"); + + // PayrollEarning e3 = new PayrollEarning(); + // e3.setEarningTypeCode("038"); + // e3.setCode("1885"); + // e3.setConcept("Bono Ingles"); + // e3.setTaxedAmount("14254.50"); + // e3.setExemptAmount("0"); + + // PayrollEarning e4 = new PayrollEarning(); + // e4.setEarningTypeCode("029"); + // e4.setCode("1941"); + // e4.setConcept("Vales Despensa"); + // e4.setTaxedAmount("0"); + // e4.setExemptAmount("3439"); + + // PayrollEarning e5 = new PayrollEarning(); + // e5.setEarningTypeCode("038"); + // e5.setCode("1824"); + // e5.setConcept("Herramientas Teletrabajo (telecom y prop. electri)"); + // e5.setTaxedAmount("273"); + // e5.setExemptAmount("0"); + + // earnings.add(e1); + // earnings.add(e2); + // earnings.add(e3); + // earnings.add(e4); + // earnings.add(e5); + + // List otherPayments = new ArrayList<>(); + // PayrollEarningOtherPayment op1 = new PayrollEarningOtherPayment(); + // op1.setOtherPaymentTypeCode("002"); + // op1.setCode("5050"); + // op1.setConcept("exceso de subsidio al empleo"); + // op1.setAmount("0"); + // op1.setSubsidyCaused("0"); + // otherPayments.add(op1); + + // payrollEarnings.setEarnings(earnings); + // payrollEarnings.setOtherPayments(otherPayments); + // payroll.setEarnings(payrollEarnings); + + // List payrollDeductions = new ArrayList<>(); + + // PayrollDeduction d1 = new PayrollDeduction(); + // d1.setDeductionTypeCode("002"); + // d1.setCode("5003"); + // d1.setConcept("ISR Causado"); + // d1.setAmount("27645.00"); + + // PayrollDeduction d2 = new PayrollDeduction(); + // d2.setDeductionTypeCode("004"); + // d2.setCode("5910"); + // d2.setConcept("Fondo de ahorro Empleado Inversión"); + // d2.setAmount("4412.46"); + + // PayrollDeduction d3 = new PayrollDeduction(); + // d3.setDeductionTypeCode("004"); + // d3.setCode("5914"); + // d3.setConcept("Fondo de Ahorro Patrón Inversión"); + // d3.setAmount("4412.46"); + + // PayrollDeduction d4 = new PayrollDeduction(); + // d4.setDeductionTypeCode("004"); + // d4.setCode("1966"); + // d4.setConcept("Contribución póliza exceso GMM"); + // d4.setAmount("519.91"); + + // PayrollDeduction d5 = new PayrollDeduction(); + // d5.setDeductionTypeCode("004"); + // d5.setCode("1934"); + // d5.setConcept("Descuento Vales Despensa"); + // d5.setAmount("1.00"); + + // PayrollDeduction d6 = new PayrollDeduction(); + // d6.setDeductionTypeCode("004"); + // d6.setCode("1942"); + // d6.setConcept("Vales Despensa Electrónico"); + // d6.setAmount("3439.00"); + + // PayrollDeduction d7 = new PayrollDeduction(); + // d7.setDeductionTypeCode("001"); + // d7.setCode("1895"); + // d7.setConcept("IMSS"); + // d7.setAmount("2391.13"); + + // payrollDeductions.add(d1); + // payrollDeductions.add(d2); + // payrollDeductions.add(d3); + // payrollDeductions.add(d4); + // payrollDeductions.add(d5); + // payrollDeductions.add(d6); + // payrollDeductions.add(d7); + + // payroll.setDeductions(payrollDeductions); + // Complement complement = new Complement(); + // complement.setPayroll(payroll); + + // Invoice invoice = new Invoice(); + // invoice.setVersionCode("4.0"); + // invoice.setSeries("F"); + // invoice.setDate("2026-02-09T10:00:00"); + // invoice.setTypeCode("N"); + // invoice.setExpeditionZipCode("20000"); + // invoice.setIssuer(issuer); + // invoice.setRecipient(recipient); + // invoice.setDate("2026-02-09T10:00:00"); + // invoice.setPaymentMethodCode("PUE"); + // invoice.setComplement(complement); + + // ApiResponse apiResponse = client.getInvoiceService().create(invoice); // System.out.println(apiResponse); +// // Nómina asimilados +// // Emisor +// InvoiceIssuer issuer = new InvoiceIssuer(); +// issuer.setTin("EKU9003173C9"); +// issuer.setLegalName("ESCUELA KEMPER URGATE"); +// issuer.setTaxRegimeCode("601"); + +// EmployerData employerData = new EmployerData(); +// employerData.setOriginEmployerTin("EKU9003173C9"); + +// // Certificados del emisor +// // Certificados del emisor +// List credentials = new ArrayList<>(); + +// TaxCredential cer = new TaxCredential(); +// cer.setBase64File(base64Cer); +// cer.setFileType(0); // 0 = Certificado (.cer) +// cer.setPassword(password); + +// TaxCredential key = new TaxCredential(); +// key.setBase64File(base64Key); +// key.setFileType(1); // 1 = Clave privada (.key) +// key.setPassword(password); + +// credentials.add(cer); +// credentials.add(key); + +// issuer.setTaxCredentials(credentials); + +// // Receptor +// InvoiceRecipient recipient = new InvoiceRecipient(); +// recipient.setTin("CACX7605101P8"); +// recipient.setLegalName("XOCHILT CASAS CHAVEZ"); +// recipient.setZipCode("36257"); +// recipient.setTaxRegimeCode("605"); +// recipient.setCfdiUseCode("CN01"); + +// EmployeeData employeeData = new EmployeeData(); +// employeeData.setCurp("XEXX010101HNEXXXA4"); +// employeeData.setSatContractTypeId("09"); +// employeeData.setSatUnionizedStatusId("No"); +// employeeData.setSatTaxRegimeTypeId("09"); +// employeeData.setEmployeeNumber("00002"); +// employeeData.setDepartment("ADMINISTRACION"); +// employeeData.setPosition("DIRECTOR DE ADMINISTRACION"); +// employeeData.setSatPaymentPeriodicityId("99"); +// employeeData.setSatBankId("012"); +// employeeData.setBankAccount("1111111111"); +// employeeData.setSatPayrollStateId("CMX"); +// recipient.setEmployeeData(employeeData); + +// // Payroll +// Payroll payroll = new Payroll(); +// payroll.setVersion("1.2"); +// payroll.setPayrollTypeCode("E"); +// payroll.setPaymentDate("2023-06-02T00:00:00"); +// payroll.setInitialPaymentDate("2023-06-01T00:00:00"); +// payroll.setFinalPaymentDate("2023-06-02T00:00:00"); +// payroll.setDaysPaid(1); + +// // Earnings +// PayrollEarnings payrollEarnings = new PayrollEarnings(); +// List earnings = new ArrayList<>(); + +// PayrollEarning e1 = new PayrollEarning(); +// e1.setEarningTypeCode("046"); +// e1.setCode("010046"); +// e1.setConcept("INGRESOS ASIMILADOS A SALARIOS"); +// e1.setTaxedAmount("111197.73"); +// e1.setExemptAmount("0.00"); + +// earnings.add(e1); + +// List otherPayments = new ArrayList<>(); + +// payrollEarnings.setEarnings(earnings); +// payrollEarnings.setOtherPayments(otherPayments); + +// // Deductions +// List payrollDeductions = new ArrayList<>(); + +// PayrollDeduction d1 = new PayrollDeduction(); +// d1.setDeductionTypeCode("002"); +// d1.setCode("020002"); +// d1.setConcept("ISR"); +// d1.setAmount("36197.73"); + +// payrollDeductions.add(d1); + +// payroll.setEarnings(payrollEarnings); +// payroll.setDeductions(payrollDeductions); + +// Complement complement = new Complement(); +// complement.setPayroll(payroll); + +// // Invoice +// Invoice invoice = new Invoice(); +// invoice.setVersionCode("4.0"); +// invoice.setSeries("F"); +// invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder +// invoice.setTypeCode("N"); +// invoice.setPaymentMethodCode("PUE"); +// invoice.setCurrencyCode("MXN"); +// invoice.setExpeditionZipCode("06880"); +// invoice.setExportCode("01"); +// invoice.setIssuer(issuer); +// invoice.setRecipient(recipient); +// invoice.setComplement(complement); + +// ApiResponse apiResponse = client.getInvoiceService().create(invoice); + +// System.out.println(apiResponse); + + //Nómina con bonos, fondo de ahorrro y deducciones + // Emisor +// InvoiceIssuer issuer = new InvoiceIssuer(); +// issuer.setTin("EKU9003173C9"); +// issuer.setLegalName("ESCUELA KEMPER URGATE"); +// issuer.setTaxRegimeCode("601"); + +// // Certificados del emisor +// // Certificados del emisor +// List credentials = new ArrayList<>(); + +// TaxCredential cer = new TaxCredential(); +// cer.setBase64File(base64Cer); +// cer.setFileType(0); // 0 = Certificado (.cer) +// cer.setPassword(password); + +// TaxCredential key = new TaxCredential(); +// key.setBase64File(base64Key); +// key.setFileType(1); // 1 = Clave privada (.key) +// key.setPassword(password); + +// credentials.add(cer); +// credentials.add(key); + +// issuer.setTaxCredentials(credentials); + +// EmployerData employerData = new EmployerData(); +// employerData.setEmployerRegistration("Z0000001234"); +// issuer.setEmployerData(employerData); + +// // Receptor +// InvoiceRecipient recipient = new InvoiceRecipient(); +// recipient.setTin("XOJI740919U48"); +// recipient.setLegalName("INGRID XODAR JIMENEZ"); +// recipient.setZipCode("76028"); +// recipient.setTaxRegimeCode("605"); +// recipient.setCfdiUseCode("CN01"); + +// EmployeeData employeeData = new EmployeeData(); +// employeeData.setCurp("XEXX010101MNEXXXA8"); +// employeeData.setSocialSecurityNumber("0000000000"); +// employeeData.setLaborRelationStartDate("2022-03-02T00:00:00"); +// employeeData.setSeniority("P66W"); +// employeeData.setSatContractTypeId("01"); +// employeeData.setSatUnionizedStatusId("No"); +// employeeData.setSatTaxRegimeTypeId("02"); +// employeeData.setEmployeeNumber("111111"); +// employeeData.setSatJobRiskId("4"); +// employeeData.setSatPaymentPeriodicityId("02"); +// employeeData.setIntegratedDailySalary("180.96"); +// employeeData.setSatPayrollStateId("GUA"); +// recipient.setEmployeeData(employeeData); + +// // Items +// List items = new ArrayList<>(); + +// InvoiceItem item1 = new InvoiceItem(); +// item1.setItemCode("84111505"); +// item1.setItemSku("84111505"); +// item1.setQuantity("1.0"); +// item1.setUnitOfMeasurementCode("ACT"); +// item1.setDescription("Pago de nómina"); +// item1.setUnitPrice("1842.82"); +// item1.setDiscount("608.71"); +// item1.setTaxObjectCode("01"); + +// items.add(item1); + +// // Payroll +// Payroll payroll = new Payroll(); +// payroll.setVersion("1.2"); +// payroll.setPayrollTypeCode("O"); +// payroll.setPaymentDate("2023-06-11T00:00:00"); +// payroll.setInitialPaymentDate("2023-06-05T00:00:00"); +// payroll.setFinalPaymentDate("2023-06-11T00:00:00"); +// payroll.setDaysPaid(7); + +// // Earnings +// PayrollEarnings payrollEarnings = new PayrollEarnings(); +// List earnings = new ArrayList<>(); + +// PayrollEarning e1 = new PayrollEarning(); +// e1.setEarningTypeCode("001"); +// e1.setCode("SP01"); +// e1.setConcept("SUELDO"); +// e1.setTaxedAmount("1210.30"); +// e1.setExemptAmount("0.00"); + +// PayrollEarning e2 = new PayrollEarning(); +// e2.setEarningTypeCode("010"); +// e2.setCode("SP02"); +// e2.setConcept("PREMIO PUNTUALIDAD"); +// e2.setTaxedAmount("121.03"); +// e2.setExemptAmount("0.00"); + +// PayrollEarning e3 = new PayrollEarning(); +// e3.setEarningTypeCode("029"); +// e3.setCode("SP03"); +// e3.setConcept("MONEDERO ELECTRONICO"); +// e3.setTaxedAmount("0.00"); +// e3.setExemptAmount("269.43"); + +// PayrollEarning e4 = new PayrollEarning(); +// e4.setEarningTypeCode("010"); +// e4.setCode("SP04"); +// e4.setConcept("PREMIO DE ASISTENCIA"); +// e4.setTaxedAmount("121.03"); +// e4.setExemptAmount("0.00"); + +// PayrollEarning e5 = new PayrollEarning(); +// e5.setEarningTypeCode("005"); +// e5.setCode("SP54"); +// e5.setConcept("APORTACION FONDO AHORRO"); +// e5.setTaxedAmount("0.00"); +// e5.setExemptAmount("121.03"); + +// earnings.add(e1); +// earnings.add(e2); +// earnings.add(e3); +// earnings.add(e4); +// earnings.add(e5); + +// // Other Payments +// List otherPayments = new ArrayList<>(); + +// PayrollEarningOtherPayment op1 = new PayrollEarningOtherPayment(); +// op1.setOtherPaymentTypeCode("002"); +// op1.setCode("ISRSUB"); +// op1.setConcept("Subsidio ISR para empleo"); +// op1.setAmount("0.0"); +// op1.setSubsidyCaused("0.0"); + +// BalanceCompensation balanceCompensation = new BalanceCompensation(); +// balanceCompensation.setFavorableBalance("0.0"); +// balanceCompensation.setYear(2022); +// balanceCompensation.setRemainingFavorableBalance("0.0"); + +// op1.setBalanceCompensation(balanceCompensation); + +// otherPayments.add(op1); + +// payrollEarnings.setEarnings(earnings); +// payrollEarnings.setOtherPayments(otherPayments); + +// // Deductions +// List payrollDeductions = new ArrayList<>(); + +// PayrollDeduction d1 = new PayrollDeduction(); +// d1.setDeductionTypeCode("004"); +// d1.setCode("ZA09"); +// d1.setConcept("APORTACION FONDO AHORRO"); +// d1.setAmount("121.03"); + +// PayrollDeduction d2 = new PayrollDeduction(); +// d2.setDeductionTypeCode("002"); +// d2.setCode("ISR"); +// d2.setConcept("ISR"); +// d2.setAmount("36.57"); + +// PayrollDeduction d3 = new PayrollDeduction(); +// d3.setDeductionTypeCode("001"); +// d3.setCode("IMSS"); +// d3.setConcept("Cuota de Seguridad Social EE"); +// d3.setAmount("30.08"); + +// PayrollDeduction d4 = new PayrollDeduction(); +// d4.setDeductionTypeCode("004"); +// d4.setCode("ZA68"); +// d4.setConcept("DEDUCCION FDO AHORRO PAT"); +// d4.setAmount("121.03"); + +// PayrollDeduction d5 = new PayrollDeduction(); +// d5.setDeductionTypeCode("018"); +// d5.setCode("ZA11"); +// d5.setConcept("APORTACION CAJA AHORRO"); +// d5.setAmount("300.00"); + +// payrollDeductions.add(d1); +// payrollDeductions.add(d2); +// payrollDeductions.add(d3); +// payrollDeductions.add(d4); +// payrollDeductions.add(d5); + +// payroll.setEarnings(payrollEarnings); +// payroll.setDeductions(payrollDeductions); + +// Complement complement = new Complement(); +// complement.setPayroll(payroll); + +// // Invoice +// Invoice invoice = new Invoice(); +// invoice.setVersionCode("4.0"); +// invoice.setSeries("F"); +// invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder +// invoice.setTypeCode("N"); +// invoice.setPaymentMethodCode("PUE"); +// invoice.setCurrencyCode("MXN"); +// invoice.setExpeditionZipCode("20000"); +// invoice.setExportCode("01"); +// invoice.setIssuer(issuer); +// invoice.setRecipient(recipient); +// invoice.setItems(items); +// invoice.setComplement(complement); + +// ApiResponse apiResponse = client.getInvoiceService().create(invoice); + +// System.out.println(apiResponse); + + // Nómina con horas extra + // Emisor +// InvoiceIssuer issuer = new InvoiceIssuer(); +// issuer.setTin("EKU9003173C9"); +// issuer.setLegalName("ESCUELA KEMPER URGATE"); +// issuer.setTaxRegimeCode("601"); + +// EmployerData employerData = new EmployerData(); +// employerData.setEmployerRegistration("B5510768108"); +// employerData.setOriginEmployerTin("URE180429TM6"); +// issuer.setEmployerData(employerData); + +// // Certificados del emisor +// // Certificados del emisor +// List credentials = new ArrayList<>(); + +// TaxCredential cer = new TaxCredential(); +// cer.setBase64File(base64Cer); +// cer.setFileType(0); // 0 = Certificado (.cer) +// cer.setPassword(password); + +// TaxCredential key = new TaxCredential(); +// key.setBase64File(base64Key); +// key.setFileType(1); // 1 = Clave privada (.key) +// key.setPassword(password); + +// credentials.add(cer); +// credentials.add(key); + +// issuer.setTaxCredentials(credentials); + +// // Receptor +// InvoiceRecipient recipient = new InvoiceRecipient(); +// recipient.setTin("XOJI740919U48"); +// recipient.setLegalName("INGRID XODAR JIMENEZ"); +// recipient.setZipCode("76028"); +// recipient.setTaxRegimeCode("605"); +// recipient.setCfdiUseCode("CN01"); + +// EmployeeData employeeData = new EmployeeData(); +// employeeData.setCurp("XEXX010101HNEXXXA4"); +// employeeData.setSocialSecurityNumber("000000"); +// employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); +// employeeData.setSeniority("P437W"); +// employeeData.setSatContractTypeId("01"); +// employeeData.setSatWorkdayTypeId("01"); +// employeeData.setSatTaxRegimeTypeId("03"); +// employeeData.setEmployeeNumber("120"); +// employeeData.setDepartment("Desarrollo"); +// employeeData.setPosition("Ingeniero de Software"); +// employeeData.setSatJobRiskId("1"); +// employeeData.setSatPaymentPeriodicityId("04"); +// employeeData.setSatBankId("002"); +// employeeData.setBankAccount("1111111111"); +// employeeData.setBaseSalaryForContributions("490.22"); +// employeeData.setIntegratedDailySalary("146.47"); +// employeeData.setSatPayrollStateId("JAL"); +// recipient.setEmployeeData(employeeData); + +// // Payroll +// Payroll payroll = new Payroll(); +// payroll.setVersion("1.2"); +// payroll.setPayrollTypeCode("O"); +// payroll.setPaymentDate("2023-05-24T00:00:00"); +// payroll.setInitialPaymentDate("2023-05-09T00:00:00"); +// payroll.setFinalPaymentDate("2023-05-24T00:00:00"); +// payroll.setDaysPaid(15); + +// // Earnings +// PayrollEarnings payrollEarnings = new PayrollEarnings(); +// List earnings = new ArrayList<>(); + +// PayrollEarning e1 = new PayrollEarning(); +// e1.setEarningTypeCode("001"); +// e1.setCode("00500"); +// e1.setConcept("Sueldos, Salarios Rayas y Jornales"); +// e1.setTaxedAmount("2808.8"); +// e1.setExemptAmount("2191.2"); + +// PayrollEarning e2 = new PayrollEarning(); +// e2.setEarningTypeCode("019"); +// e2.setCode("00100"); +// e2.setConcept("Horas Extra"); +// e2.setTaxedAmount("50.00"); +// e2.setExemptAmount("50.00"); + +// List overtimeList = new ArrayList<>(); +// PayrollEarningOvertime overtime1 = new PayrollEarningOvertime(); +// overtime1.setDays(1); +// overtime1.setHoursTypeCode("01"); +// overtime1.setExtraHours(2); +// overtime1.setAmountPaid("100.00"); +// overtimeList.add(overtime1); + +// e2.setOvertime(overtimeList); + +// earnings.add(e1); +// earnings.add(e2); + +// // Other Payments +// List otherPayments = new ArrayList<>(); + +// payrollEarnings.setEarnings(earnings); +// payrollEarnings.setOtherPayments(otherPayments); + +// // Deductions +// List payrollDeductions = new ArrayList<>(); + +// PayrollDeduction d1 = new PayrollDeduction(); +// d1.setDeductionTypeCode("001"); +// d1.setCode("00301"); +// d1.setConcept("Seguridad Social"); +// d1.setAmount("200.00"); + +// PayrollDeduction d2 = new PayrollDeduction(); +// d2.setDeductionTypeCode("002"); +// d2.setCode("00302"); +// d2.setConcept("ISR"); +// d2.setAmount("100.00"); + +// payrollDeductions.add(d1); +// payrollDeductions.add(d2); +// payroll.setEarnings(payrollEarnings); +// payroll.setDeductions(payrollDeductions); + +// Complement complement = new Complement(); +// complement.setPayroll(payroll); + +// // Invoice +// Invoice invoice = new Invoice(); +// invoice.setVersionCode("4.0"); +// invoice.setSeries("F"); +// invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder +// invoice.setTypeCode("N"); +// invoice.setPaymentMethodCode("PUE"); +// invoice.setCurrencyCode("MXN"); +// invoice.setExpeditionZipCode("20000"); +// invoice.setExportCode("01"); +// invoice.setIssuer(issuer); +// invoice.setRecipient(recipient); +// invoice.setComplement(complement); + +// ApiResponse apiResponse = client.getInvoiceService().create(invoice); + +// System.out.println(apiResponse); + + // Nómina con incapacidades + // Emisor +// InvoiceIssuer issuer = new InvoiceIssuer(); +// issuer.setTin("EKU9003173C9"); +// issuer.setLegalName("ESCUELA KEMPER URGATE"); +// issuer.setTaxRegimeCode("601"); + +// EmployerData employerData = new EmployerData(); +// employerData.setEmployerRegistration("B5510768108"); +// employerData.setOriginEmployerTin("URE180429TM6"); +// issuer.setEmployerData(employerData); + +// // Certificados del emisor +// // Certificados del emisor +// List credentials = new ArrayList<>(); + +// TaxCredential cer = new TaxCredential(); +// cer.setBase64File(base64Cer); +// cer.setFileType(0); // 0 = Certificado (.cer) +// cer.setPassword(password); + +// TaxCredential key = new TaxCredential(); +// key.setBase64File(base64Key); +// key.setFileType(1); // 1 = Clave privada (.key) +// key.setPassword(password); + +// credentials.add(cer); +// credentials.add(key); + +// issuer.setTaxCredentials(credentials); + +// // Receptor +// InvoiceRecipient recipient = new InvoiceRecipient(); +// recipient.setTin("XOJI740919U48"); +// recipient.setLegalName("INGRID XODAR JIMENEZ"); +// recipient.setZipCode("76028"); +// recipient.setTaxRegimeCode("605"); +// recipient.setCfdiUseCode("CN01"); + +// EmployeeData employeeData = new EmployeeData(); +// employeeData.setCurp("XEXX010101HNEXXXA4"); +// employeeData.setSocialSecurityNumber("000000"); +// employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); +// employeeData.setSeniority("P437W"); +// employeeData.setSatContractTypeId("01"); +// employeeData.setSatWorkdayTypeId("01"); +// employeeData.setSatTaxRegimeTypeId("03"); +// employeeData.setEmployeeNumber("120"); +// employeeData.setDepartment("Desarrollo"); +// employeeData.setPosition("Ingeniero de Software"); +// employeeData.setSatJobRiskId("1"); +// employeeData.setSatPaymentPeriodicityId("04"); +// employeeData.setSatBankId("002"); +// employeeData.setBankAccount("1111111111"); +// employeeData.setBaseSalaryForContributions("490.22"); +// employeeData.setIntegratedDailySalary("146.47"); +// employeeData.setSatPayrollStateId("JAL"); +// recipient.setEmployeeData(employeeData); + +// // Payroll +// Payroll payroll = new Payroll(); +// payroll.setVersion("1.2"); +// payroll.setPayrollTypeCode("O"); +// payroll.setPaymentDate("2023-05-24T00:00:00"); +// payroll.setInitialPaymentDate("2023-05-09T00:00:00"); +// payroll.setFinalPaymentDate("2023-05-24T00:00:00"); +// payroll.setDaysPaid(15); + +// // Earnings +// PayrollEarnings payrollEarnings = new PayrollEarnings(); +// List earnings = new ArrayList<>(); + +// PayrollEarning e1 = new PayrollEarning(); +// e1.setEarningTypeCode("001"); +// e1.setCode("00500"); +// e1.setConcept("Sueldos, Salarios Rayas y Jornales"); +// e1.setTaxedAmount("2808.8"); +// e1.setExemptAmount("2191.2"); + +// earnings.add(e1); + +// // Other Payments +// List otherPayments = new ArrayList<>(); + +// payrollEarnings.setEarnings(earnings); +// payrollEarnings.setOtherPayments(otherPayments); + +// // Deductions +// List payrollDeductions = new ArrayList<>(); + +// PayrollDeduction d1 = new PayrollDeduction(); +// d1.setDeductionTypeCode("001"); +// d1.setCode("00301"); +// d1.setConcept("Seguridad Social"); +// d1.setAmount("200.00"); + +// PayrollDeduction d2 = new PayrollDeduction(); +// d2.setDeductionTypeCode("002"); +// d2.setCode("00302"); +// d2.setConcept("ISR"); +// d2.setAmount("100.00"); + +// payrollDeductions.add(d1); +// payrollDeductions.add(d2); + +// // Disabilities +// List disabilities = new ArrayList<>(); + +// PayrollDisability disability1 = new PayrollDisability(); +// disability1.setDisabilityDays(1); +// disability1.setDisabilityTypeCode("01"); + +// disabilities.add(disability1); + +// payroll.setEarnings(payrollEarnings); +// payroll.setDeductions(payrollDeductions); +// payroll.setDisabilities(disabilities); + +// Complement complement = new Complement(); +// complement.setPayroll(payroll); + +// // Invoice +// Invoice invoice = new Invoice(); +// invoice.setVersionCode("4.0"); +// invoice.setSeries("F"); +// invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder +// invoice.setTypeCode("N"); +// invoice.setPaymentMethodCode("PUE"); +// invoice.setCurrencyCode("MXN"); +// invoice.setExpeditionZipCode("20000"); +// invoice.setExportCode("01"); +// invoice.setIssuer(issuer); +// invoice.setRecipient(recipient); +// invoice.setComplement(complement); + +// ApiResponse apiResponse = client.getInvoiceService().create(invoice); + +// System.out.println(apiResponse); + +// Nómina con SNCF +// Emisor +// InvoiceIssuer issuer = new InvoiceIssuer(); +// issuer.setTin("OÑO120726RX3"); +// issuer.setLegalName("ORGANICOS ÑAVEZ OSORIO"); +// issuer.setTaxRegimeCode("601"); + +// EmployerData employerData = new EmployerData(); +// employerData.setEmployerRegistration("27112029"); +// employerData.setSatFundSourceId("IP"); +// issuer.setEmployerData(employerData); + +// // Certificados del emisor +// // Certificados del emisor +// List credentials = new ArrayList<>(); + +// TaxCredential cer = new TaxCredential(); +// cer.setBase64File(base64Cer); +// cer.setFileType(0); // 0 = Certificado (.cer) +// cer.setPassword(password); + +// TaxCredential key = new TaxCredential(); +// key.setBase64File(base64Key); +// key.setFileType(1); // 1 = Clave privada (.key) +// key.setPassword(password); + +// credentials.add(cer); +// credentials.add(key); + +// issuer.setTaxCredentials(credentials); + +// // Receptor +// InvoiceRecipient recipient = new InvoiceRecipient(); +// recipient.setTin("CACX7605101P8"); +// recipient.setLegalName("XOCHILT CASAS CHAVEZ"); +// recipient.setZipCode("36257"); +// recipient.setTaxRegimeCode("605"); +// recipient.setCfdiUseCode("CN01"); + +// EmployeeData employeeData = new EmployeeData(); +// employeeData.setCurp("XEXX010101HNEXXXA4"); +// employeeData.setSocialSecurityNumber("80997742673"); +// employeeData.setLaborRelationStartDate("2021-09-01T00:00:00"); +// employeeData.setSeniority("P88W"); +// employeeData.setSatContractTypeId("01"); +// employeeData.setSatTaxRegimeTypeId("02"); +// employeeData.setEmployeeNumber("273"); +// employeeData.setSatJobRiskId("1"); +// employeeData.setSatPaymentPeriodicityId("04"); +// employeeData.setIntegratedDailySalary("221.48"); +// employeeData.setSatPayrollStateId("GRO"); +// recipient.setEmployeeData(employeeData); + +// // Payroll +// Payroll payroll = new Payroll(); +// payroll.setVersion("1.2"); +// payroll.setPayrollTypeCode("O"); +// payroll.setPaymentDate("2023-05-16T00:00:00"); +// payroll.setInitialPaymentDate("2023-05-01T00:00:00"); +// payroll.setFinalPaymentDate("2023-05-16T00:00:00"); +// payroll.setDaysPaid(15); + +// // Earnings +// PayrollEarnings payrollEarnings = new PayrollEarnings(); +// List earnings = new ArrayList<>(); + +// PayrollEarning e1 = new PayrollEarning(); +// e1.setEarningTypeCode("001"); +// e1.setCode("P001"); +// e1.setConcept("Sueldos, Salarios Rayas y Jornales"); +// e1.setTaxedAmount("3322.20"); +// e1.setExemptAmount("0"); + +// PayrollEarning e2 = new PayrollEarning(); +// e2.setEarningTypeCode("038"); +// e2.setCode("P540"); +// e2.setConcept("Compensacion"); +// e2.setTaxedAmount("100.00"); +// e2.setExemptAmount("0"); + +// PayrollEarning e3 = new PayrollEarning(); +// e3.setEarningTypeCode("038"); +// e3.setCode("P550"); +// e3.setConcept("Compensación Garantizada Extraordinaria"); +// e3.setTaxedAmount("2200.00"); +// e3.setExemptAmount("0"); + +// PayrollEarning e4 = new PayrollEarning(); +// e4.setEarningTypeCode("038"); +// e4.setCode("P530"); +// e4.setConcept("Servicio Extraordinario"); +// e4.setTaxedAmount("200.00"); +// e4.setExemptAmount("0"); + +// PayrollEarning e5 = new PayrollEarning(); +// e5.setEarningTypeCode("001"); +// e5.setCode("P506"); +// e5.setConcept("Otras Prestaciones"); +// e5.setTaxedAmount("1500.00"); +// e5.setExemptAmount("0"); + +// PayrollEarning e6 = new PayrollEarning(); +// e6.setEarningTypeCode("001"); +// e6.setCode("P505"); +// e6.setConcept("Remuneración al Desempeño Legislativo"); +// e6.setTaxedAmount("17500.00"); +// e6.setExemptAmount("0"); + +// earnings.add(e1); +// earnings.add(e2); +// earnings.add(e3); +// earnings.add(e4); +// earnings.add(e5); +// earnings.add(e6); + +// // Other Payments +// List otherPayments = new ArrayList<>(); + +// PayrollEarningOtherPayment op1 = new PayrollEarningOtherPayment(); +// op1.setOtherPaymentTypeCode("002"); +// op1.setCode("002"); +// op1.setConcept("Subsidio para el empleo efectivamente entregado al trabajador"); +// op1.setAmount("0"); +// op1.setSubsidyCaused("0"); + +// otherPayments.add(op1); + +// payrollEarnings.setEarnings(earnings); +// payrollEarnings.setOtherPayments(otherPayments); + +// // Deductions +// List payrollDeductions = new ArrayList<>(); + +// PayrollDeduction d1 = new PayrollDeduction(); +// d1.setDeductionTypeCode("002"); +// d1.setCode("D002"); +// d1.setConcept("ISR"); +// d1.setAmount("4716.61"); + +// PayrollDeduction d2 = new PayrollDeduction(); +// d2.setDeductionTypeCode("004"); +// d2.setCode("D525"); +// d2.setConcept("Redondeo"); +// d2.setAmount("0.81"); + +// PayrollDeduction d3 = new PayrollDeduction(); +// d3.setDeductionTypeCode("001"); +// d3.setCode("D510"); +// d3.setConcept("Cuota Trabajador ISSSTE"); +// d3.setAmount("126.78"); + +// payrollDeductions.add(d1); +// payrollDeductions.add(d2); +// payrollDeductions.add(d3); + +// payroll.setEarnings(payrollEarnings); +// payroll.setDeductions(payrollDeductions); + +// Complement complement = new Complement(); +// complement.setPayroll(payroll); + +// // Invoice +// Invoice invoice = new Invoice(); +// invoice.setVersionCode("4.0"); +// invoice.setSeries("F"); +// invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder +// invoice.setTypeCode("N"); +// invoice.setPaymentMethodCode("PUE"); +// invoice.setCurrencyCode("MXN"); +// invoice.setExpeditionZipCode("39074"); +// invoice.setExportCode("01"); +// invoice.setIssuer(issuer); +// invoice.setRecipient(recipient); +// invoice.setComplement(complement); + +// ApiResponse apiResponse = client.getInvoiceService().create(invoice); + +// System.out.println(apiResponse); + +// Nómina extraordinaria +// Emisor +// InvoiceIssuer issuer = new InvoiceIssuer(); +// issuer.setTin("EKU9003173C9"); +// issuer.setLegalName("ESCUELA KEMPER URGATE"); +// issuer.setTaxRegimeCode("601"); + +// EmployerData employerData = new EmployerData(); +// employerData.setEmployerRegistration("B5510768108"); +// employerData.setOriginEmployerTin("URE180429TM6"); +// issuer.setEmployerData(employerData); + +// // Certificados del emisor +// // Certificados del emisor +// List credentials = new ArrayList<>(); + +// TaxCredential cer = new TaxCredential(); +// cer.setBase64File(base64Cer); +// cer.setFileType(0); // 0 = Certificado (.cer) +// cer.setPassword(password); + +// TaxCredential key = new TaxCredential(); +// key.setBase64File(base64Key); +// key.setFileType(1); // 1 = Clave privada (.key) +// key.setPassword(password); + +// credentials.add(cer); +// credentials.add(key); + +// issuer.setTaxCredentials(credentials); + +// // Receptor +// InvoiceRecipient recipient = new InvoiceRecipient(); +// recipient.setTin("XOJI740919U48"); +// recipient.setLegalName("INGRID XODAR JIMENEZ"); +// recipient.setZipCode("76028"); +// recipient.setTaxRegimeCode("605"); +// recipient.setCfdiUseCode("CN01"); + +// EmployeeData employeeData = new EmployeeData(); +// employeeData.setCurp("XEXX010101HNEXXXA4"); +// employeeData.setSocialSecurityNumber("000000"); +// employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); +// employeeData.setSeniority("P439W"); +// employeeData.setSatContractTypeId("01"); +// employeeData.setSatWorkdayTypeId("01"); +// employeeData.setSatTaxRegimeTypeId("03"); +// employeeData.setEmployeeNumber("120"); +// employeeData.setDepartment("Desarrollo"); +// employeeData.setPosition("Ingeniero de Software"); +// employeeData.setSatJobRiskId("1"); +// employeeData.setSatPaymentPeriodicityId("99"); +// employeeData.setSatBankId("002"); +// employeeData.setBankAccount("1111111111"); +// employeeData.setIntegratedDailySalary("146.47"); +// employeeData.setSatPayrollStateId("JAL"); +// recipient.setEmployeeData(employeeData); + +// // Payroll +// Payroll payroll = new Payroll(); +// payroll.setVersion("1.2"); +// payroll.setPayrollTypeCode("E"); +// payroll.setPaymentDate("2023-06-04T00:00:00"); +// payroll.setInitialPaymentDate("2023-06-04T00:00:00"); +// payroll.setFinalPaymentDate("2023-06-04T00:00:00"); +// payroll.setDaysPaid(30); + +// // Earnings +// PayrollEarnings payrollEarnings = new PayrollEarnings(); +// List earnings = new ArrayList<>(); + +// PayrollEarning e1 = new PayrollEarning(); +// e1.setEarningTypeCode("002"); +// e1.setCode("00500"); +// e1.setConcept("Gratificación Anual (Aguinaldo)"); +// e1.setTaxedAmount("0.00"); +// e1.setExemptAmount("10000.00"); + +// earnings.add(e1); + +// // Other Payments +// List otherPayments = new ArrayList<>(); + +// payrollEarnings.setEarnings(earnings); +// payrollEarnings.setOtherPayments(otherPayments); + +// // Deductions (empty list) +// List payrollDeductions = new ArrayList<>(); + +// payroll.setEarnings(payrollEarnings); +// payroll.setDeductions(payrollDeductions); + +// Complement complement = new Complement(); +// complement.setPayroll(payroll); + +// // Invoice +// Invoice invoice = new Invoice(); +// invoice.setVersionCode("4.0"); +// invoice.setSeries("F"); +// invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder +// invoice.setTypeCode("N"); +// invoice.setPaymentMethodCode("PUE"); +// invoice.setCurrencyCode("MXN"); +// invoice.setExpeditionZipCode("20000"); +// invoice.setExportCode("01"); +// invoice.setIssuer(issuer); +// invoice.setRecipient(recipient); +// invoice.setComplement(complement); + +// ApiResponse apiResponse = client.getInvoiceService().create(invoice); + +// System.out.println(apiResponse); + +// Nómina separación +// InvoiceIssuer issuer = new InvoiceIssuer(); +// issuer.setTin("EKU9003173C9"); +// issuer.setLegalName("ESCUELA KEMPER URGATE"); +// issuer.setTaxRegimeCode("601"); + +// EmployerData employerData = new EmployerData(); +// employerData.setEmployerRegistration("B5510768108"); +// employerData.setOriginEmployerTin("URE180429TM6"); +// issuer.setEmployerData(employerData); + +// // Certificados del emisor +// // Certificados del emisor +// List credentials = new ArrayList<>(); + +// TaxCredential cer = new TaxCredential(); +// cer.setBase64File(base64Cer); +// cer.setFileType(0); // 0 = Certificado (.cer) +// cer.setPassword(password); + +// TaxCredential key = new TaxCredential(); +// key.setBase64File(base64Key); +// key.setFileType(1); // 1 = Clave privada (.key) +// key.setPassword(password); + +// credentials.add(cer); +// credentials.add(key); + +// issuer.setTaxCredentials(credentials); + +// // Receptor +// InvoiceRecipient recipient = new InvoiceRecipient(); +// recipient.setTin("XOJI740919U48"); +// recipient.setLegalName("INGRID XODAR JIMENEZ"); +// recipient.setZipCode("76028"); +// recipient.setTaxRegimeCode("605"); +// recipient.setCfdiUseCode("CN01"); + +// EmployeeData employeeData = new EmployeeData(); +// employeeData.setCurp("XEXX010101HNEXXXA4"); +// employeeData.setSocialSecurityNumber("000000"); +// employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); +// employeeData.setSeniority("P439W"); +// employeeData.setSatContractTypeId("01"); +// employeeData.setSatWorkdayTypeId("01"); +// employeeData.setSatTaxRegimeTypeId("03"); +// employeeData.setEmployeeNumber("120"); +// employeeData.setDepartment("Desarrollo"); +// employeeData.setPosition("Ingeniero de Software"); +// employeeData.setSatJobRiskId("1"); +// employeeData.setSatPaymentPeriodicityId("99"); +// employeeData.setSatBankId("002"); +// employeeData.setBankAccount("1111111111"); +// employeeData.setIntegratedDailySalary("146.47"); +// employeeData.setSatPayrollStateId("JAL"); +// recipient.setEmployeeData(employeeData); + +// Payroll payroll = new Payroll(); +// payroll.setVersion("1.2"); +// payroll.setPayrollTypeCode("E"); +// payroll.setPaymentDate("2023-06-04T00:00:00"); +// payroll.setInitialPaymentDate("2023-06-04T00:00:00"); +// payroll.setFinalPaymentDate("2023-06-04T00:00:00"); +// payroll.setDaysPaid(30); +// PayrollEarnings payrollEarnings = new PayrollEarnings(); +// List earnings = new ArrayList<>(); + +// PayrollEarning e1 = new PayrollEarning(); +// e1.setEarningTypeCode("023"); +// e1.setCode("00500"); +// e1.setConcept("Pagos por separación"); +// e1.setTaxedAmount("0"); +// e1.setExemptAmount("10000.0"); + +// PayrollEarning e2 = new PayrollEarning(); +// e2.setEarningTypeCode("025"); +// e2.setCode("00900"); +// e2.setConcept("Indemnizaciones"); +// e2.setTaxedAmount("0"); +// e2.setExemptAmount("500.0"); + +// earnings.add(e1); +// earnings.add(e2); + +// List otherPayments = new ArrayList<>(); +// PayrollSeverance severance = new PayrollSeverance(); +// severance.setTotalPaid("10500.00"); +// severance.setYearsOfService(1); +// severance.setLastMonthlySalary("10000.00"); +// severance.setAccumulableIncome("10000.00"); +// severance.setNonAccumulableIncome("0"); + +// payrollEarnings.setEarnings(earnings); +// payrollEarnings.setOtherPayments(otherPayments); +// payrollEarnings.setSeverance(severance); +// payroll.setEarnings(payrollEarnings); + +// List payrollDeductions = new ArrayList<>(); + +// payroll.setDeductions(payrollDeductions); +// Complement complement = new Complement(); +// complement.setPayroll(payroll); + +// Invoice invoice = new Invoice(); +// invoice.setVersionCode("4.0"); +// invoice.setSeries("F"); +// invoice.setDate("2026-02-09T10:00:00"); +// invoice.setTypeCode("N"); +// invoice.setExpeditionZipCode("20000"); +// invoice.setIssuer(issuer); +// invoice.setRecipient(recipient); +// invoice.setDate("2026-02-09T10:00:00"); +// invoice.setPaymentMethodCode("PUE"); +// invoice.setComplement(complement); + +// ApiResponse apiResponse = client.getInvoiceService().create(invoice); +// System.out.println(apiResponse); + +// Nómina jubilación +// Emisor +// InvoiceIssuer issuer = new InvoiceIssuer(); +// issuer.setTin("EKU9003173C9"); +// issuer.setLegalName("ESCUELA KEMPER URGATE"); +// issuer.setTaxRegimeCode("601"); + +// EmployerData employerData = new EmployerData(); +// employerData.setEmployerRegistration("B5510768108"); +// employerData.setOriginEmployerTin("URE180429TM6"); +// issuer.setEmployerData(employerData); + +// // Certificados del emisor +// // Certificados del emisor +// List credentials = new ArrayList<>(); + +// TaxCredential cer = new TaxCredential(); +// cer.setBase64File(base64Cer); +// cer.setFileType(0); // 0 = Certificado (.cer) +// cer.setPassword(password); + +// TaxCredential key = new TaxCredential(); +// key.setBase64File(base64Key); +// key.setFileType(1); // 1 = Clave privada (.key) +// key.setPassword(password); + +// credentials.add(cer); +// credentials.add(key); + +// issuer.setTaxCredentials(credentials); + +// // Receptor +// InvoiceRecipient recipient = new InvoiceRecipient(); +// recipient.setTin("XOJI740919U48"); +// recipient.setLegalName("INGRID XODAR JIMENEZ"); +// recipient.setZipCode("76028"); +// recipient.setTaxRegimeCode("605"); +// recipient.setCfdiUseCode("CN01"); + +// EmployeeData employeeData = new EmployeeData(); +// employeeData.setCurp("XEXX010101HNEXXXA4"); +// employeeData.setSocialSecurityNumber("000000"); +// employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); +// employeeData.setSeniority("P439W"); +// employeeData.setSatContractTypeId("01"); +// employeeData.setSatWorkdayTypeId("01"); +// employeeData.setSatTaxRegimeTypeId("03"); +// employeeData.setEmployeeNumber("120"); +// employeeData.setDepartment("Desarrollo"); +// employeeData.setPosition("Ingeniero de Software"); +// employeeData.setSatJobRiskId("1"); +// employeeData.setSatPaymentPeriodicityId("99"); +// employeeData.setSatBankId("002"); +// employeeData.setBankAccount("1111111111"); +// employeeData.setIntegratedDailySalary("146.47"); +// employeeData.setSatPayrollStateId("JAL"); +// recipient.setEmployeeData(employeeData); + +// // Payroll +// Payroll payroll = new Payroll(); +// payroll.setVersion("1.2"); +// payroll.setPayrollTypeCode("E"); +// payroll.setPaymentDate("2023-05-05T00:00:00"); +// payroll.setInitialPaymentDate("2023-06-04T00:00:00"); +// payroll.setFinalPaymentDate("2023-06-04T00:00:00"); +// payroll.setDaysPaid(30); + +// // Earnings +// PayrollEarnings payrollEarnings = new PayrollEarnings(); +// List earnings = new ArrayList<>(); + +// PayrollEarning e1 = new PayrollEarning(); +// e1.setEarningTypeCode("039"); +// e1.setCode("00500"); +// e1.setConcept("Jubilaciones, pensiones o haberes de retiro"); +// e1.setTaxedAmount("0.00"); +// e1.setExemptAmount("10000.00"); + +// earnings.add(e1); + +// // Other Payments +// List otherPayments = new ArrayList<>(); + +// // Retirement +// PayrollRetirement retirement = new PayrollRetirement(); +// retirement.setTotalOneTime("10000.00"); +// retirement.setAccumulableIncome("10000.00"); +// retirement.setNonAccumulableIncome("0.00"); + +// payrollEarnings.setEarnings(earnings); +// payrollEarnings.setOtherPayments(otherPayments); +// payrollEarnings.setRetirement(retirement); + +// // Deductions (empty list) +// List payrollDeductions = new ArrayList<>(); + +// payroll.setEarnings(payrollEarnings); +// payroll.setDeductions(payrollDeductions); + +// Complement complement = new Complement(); +// complement.setPayroll(payroll); + +// // Invoice +// Invoice invoice = new Invoice(); +// invoice.setVersionCode("4.0"); +// invoice.setSeries("F"); +// invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder +// invoice.setTypeCode("N"); +// invoice.setPaymentMethodCode("PUE"); +// invoice.setCurrencyCode("MXN"); +// invoice.setExpeditionZipCode("20000"); +// invoice.setExportCode("01"); +// invoice.setIssuer(issuer); +// invoice.setRecipient(recipient); +// invoice.setComplement(complement); + +// ApiResponse apiResponse = client.getInvoiceService().create(invoice); + +// System.out.println(apiResponse); + +// Nómina sin deducciones +// Emisor +// InvoiceIssuer issuer = new InvoiceIssuer(); +// issuer.setTin("EKU9003173C9"); +// issuer.setLegalName("ESCUELA KEMPER URGATE"); +// issuer.setTaxRegimeCode("601"); + +// EmployerData employerData = new EmployerData(); +// employerData.setEmployerRegistration("B5510768108"); +// employerData.setOriginEmployerTin("URE180429TM6"); +// issuer.setEmployerData(employerData); + +// // Certificados del emisor +// // Certificados del emisor +// List credentials = new ArrayList<>(); + +// TaxCredential cer = new TaxCredential(); +// cer.setBase64File(base64Cer); +// cer.setFileType(0); // 0 = Certificado (.cer) +// cer.setPassword(password); + +// TaxCredential key = new TaxCredential(); +// key.setBase64File(base64Key); +// key.setFileType(1); // 1 = Clave privada (.key) +// key.setPassword(password); + +// credentials.add(cer); +// credentials.add(key); + +// issuer.setTaxCredentials(credentials); + +// // Receptor +// InvoiceRecipient recipient = new InvoiceRecipient(); +// recipient.setTin("XOJI740919U48"); +// recipient.setLegalName("INGRID XODAR JIMENEZ"); +// recipient.setZipCode("76028"); +// recipient.setTaxRegimeCode("605"); +// recipient.setCfdiUseCode("CN01"); + +// EmployeeData employeeData = new EmployeeData(); +// employeeData.setCurp("XEXX010101HNEXXXA4"); +// employeeData.setSocialSecurityNumber("000000"); +// employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); +// employeeData.setSeniority("P437W"); +// employeeData.setSatContractTypeId("01"); +// employeeData.setSatWorkdayTypeId("01"); +// employeeData.setSatTaxRegimeTypeId("03"); +// employeeData.setEmployeeNumber("120"); +// employeeData.setDepartment("Desarrollo"); +// employeeData.setPosition("Ingeniero de Software"); +// employeeData.setSatJobRiskId("1"); +// employeeData.setSatPaymentPeriodicityId("04"); +// employeeData.setSatBankId("002"); +// employeeData.setBankAccount("1111111111"); +// employeeData.setBaseSalaryForContributions("490.22"); +// employeeData.setIntegratedDailySalary("146.47"); +// employeeData.setSatPayrollStateId("JAL"); +// recipient.setEmployeeData(employeeData); + +// // Payroll +// Payroll payroll = new Payroll(); +// payroll.setVersion("1.2"); +// payroll.setPayrollTypeCode("O"); +// payroll.setPaymentDate("2023-05-24T00:00:00"); +// payroll.setInitialPaymentDate("2023-05-09T00:00:00"); +// payroll.setFinalPaymentDate("2023-05-24T00:00:00"); +// payroll.setDaysPaid(15); + +// // Earnings +// PayrollEarnings payrollEarnings = new PayrollEarnings(); +// List earnings = new ArrayList<>(); + +// PayrollEarning e1 = new PayrollEarning(); +// e1.setEarningTypeCode("001"); +// e1.setCode("00500"); +// e1.setConcept("Sueldos, Salarios Rayas y Jornales"); +// e1.setTaxedAmount("2808.8"); +// e1.setExemptAmount("2191.2"); + +// earnings.add(e1); + +// // Other Payments +// List otherPayments = new ArrayList<>(); + +// payrollEarnings.setEarnings(earnings); +// payrollEarnings.setOtherPayments(otherPayments); + +// // Deductions (empty list) +// List payrollDeductions = new ArrayList<>(); + +// payroll.setEarnings(payrollEarnings); +// payroll.setDeductions(payrollDeductions); + +// Complement complement = new Complement(); +// complement.setPayroll(payroll); +// // Invoice +// Invoice invoice = new Invoice(); +// invoice.setVersionCode("4.0"); +// invoice.setSeries("F"); +// invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder +// invoice.setTypeCode("N"); +// invoice.setPaymentMethodCode("PUE"); +// invoice.setCurrencyCode("MXN"); +// invoice.setExpeditionZipCode("20000"); +// invoice.setExportCode("01"); +// invoice.setIssuer(issuer); +// invoice.setRecipient(recipient); +// invoice.setComplement(complement); + +// ApiResponse apiResponse = client.getInvoiceService().create(invoice); + +// System.out.println(apiResponse); + +// Nómina viáticos +// Emisor +// InvoiceIssuer issuer = new InvoiceIssuer(); +// issuer.setTin("EKU9003173C9"); +// issuer.setLegalName("ESCUELA KEMPER URGATE"); +// issuer.setTaxRegimeCode("601"); + +// EmployerData employerData = new EmployerData(); +// employerData.setEmployerRegistration("B5510768108"); +// employerData.setOriginEmployerTin("URE180429TM6"); +// issuer.setEmployerData(employerData); + +// // Certificados del emisor +// // Certificados del emisor +// List credentials = new ArrayList<>(); + +// TaxCredential cer = new TaxCredential(); +// cer.setBase64File(base64Cer); +// cer.setFileType(0); // 0 = Certificado (.cer) +// cer.setPassword(password); + +// TaxCredential key = new TaxCredential(); +// key.setBase64File(base64Key); +// key.setFileType(1); // 1 = Clave privada (.key) +// key.setPassword(password); + +// credentials.add(cer); +// credentials.add(key); + +// issuer.setTaxCredentials(credentials); + +// // Receptor +// InvoiceRecipient recipient = new InvoiceRecipient(); +// recipient.setTin("XOJI740919U48"); +// recipient.setLegalName("INGRID XODAR JIMENEZ"); +// recipient.setZipCode("76028"); +// recipient.setTaxRegimeCode("605"); +// recipient.setCfdiUseCode("CN01"); + +// EmployeeData employeeData = new EmployeeData(); +// employeeData.setCurp("XEXX010101HNEXXXA4"); +// employeeData.setSocialSecurityNumber("000000"); +// employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); +// employeeData.setSeniority("P438W"); +// employeeData.setSatContractTypeId("01"); +// employeeData.setSatWorkdayTypeId("01"); +// employeeData.setSatTaxRegimeTypeId("03"); +// employeeData.setEmployeeNumber("120"); +// employeeData.setDepartment("Desarrollo"); +// employeeData.setPosition("Ingeniero de Software"); +// employeeData.setSatJobRiskId("1"); +// employeeData.setSatPaymentPeriodicityId("04"); +// employeeData.setSatBankId("002"); +// employeeData.setBankAccount("1111111111"); +// employeeData.setBaseSalaryForContributions("490.22"); +// employeeData.setIntegratedDailySalary("146.47"); +// employeeData.setSatPayrollStateId("JAL"); +// recipient.setEmployeeData(employeeData); + +// // Payroll +// Payroll payroll = new Payroll(); +// payroll.setVersion("1.2"); +// payroll.setPayrollTypeCode("O"); +// payroll.setPaymentDate("2023-09-26T00:00:00"); +// payroll.setInitialPaymentDate("2023-09-11T00:00:00"); +// payroll.setFinalPaymentDate("2023-09-26T00:00:00"); +// payroll.setDaysPaid(15); + +// // Earnings +// PayrollEarnings payrollEarnings = new PayrollEarnings(); +// List earnings = new ArrayList<>(); + +// PayrollEarning e1 = new PayrollEarning(); +// e1.setEarningTypeCode("050"); +// e1.setCode("050"); +// e1.setConcept("Viaticos"); +// e1.setTaxedAmount("0"); +// e1.setExemptAmount("3000"); + +// earnings.add(e1); + +// // Other Payments +// List otherPayments = new ArrayList<>(); + +// payrollEarnings.setEarnings(earnings); +// payrollEarnings.setOtherPayments(otherPayments); + +// // Deductions +// List payrollDeductions = new ArrayList<>(); + +// PayrollDeduction d1 = new PayrollDeduction(); +// d1.setDeductionTypeCode("081"); +// d1.setCode("081"); +// d1.setConcept("Ajuste en viaticos entregados al trabajador"); +// d1.setAmount("3000.00"); + +// payrollDeductions.add(d1); + +// payroll.setEarnings(payrollEarnings); +// payroll.setDeductions(payrollDeductions); + +// Complement complement = new Complement(); +// complement.setPayroll(payroll); + +// // Invoice +// Invoice invoice = new Invoice(); +// invoice.setVersionCode("4.0"); +// invoice.setSeries("F"); +// invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder +// invoice.setTypeCode("N"); +// invoice.setPaymentMethodCode("PUE"); +// invoice.setCurrencyCode("MXN"); +// invoice.setExpeditionZipCode("20000"); +// invoice.setExportCode("01"); +// invoice.setIssuer(issuer); +// invoice.setRecipient(recipient); +// invoice.setComplement(complement); + +// ApiResponse apiResponse = client.getInvoiceService().create(invoice); + +// System.out.println(apiResponse); + +// Nómina subsidio causado al empleo +// Emisor +// InvoiceIssuer issuer = new InvoiceIssuer(); +// issuer.setTin("EKU9003173C9"); +// issuer.setLegalName("ESCUELA KEMPER URGATE"); +// issuer.setTaxRegimeCode("601"); + +// EmployerData employerData = new EmployerData(); +// employerData.setEmployerRegistration("B5510768108"); +// employerData.setOriginEmployerTin("URE180429TM6"); +// issuer.setEmployerData(employerData); + +// // Certificados del emisor +// // Certificados del emisor +// List credentials = new ArrayList<>(); + +// TaxCredential cer = new TaxCredential(); +// cer.setBase64File(base64Cer); +// cer.setFileType(0); // 0 = Certificado (.cer) +// cer.setPassword(password); + +// TaxCredential key = new TaxCredential(); +// key.setBase64File(base64Key); +// key.setFileType(1); // 1 = Clave privada (.key) +// key.setPassword(password); + +// credentials.add(cer); +// credentials.add(key); + +// issuer.setTaxCredentials(credentials); + +// // Receptor +// InvoiceRecipient recipient = new InvoiceRecipient(); +// recipient.setTin("XOJI740919U48"); +// recipient.setLegalName("INGRID XODAR JIMENEZ"); +// recipient.setZipCode("76028"); +// recipient.setTaxRegimeCode("605"); +// recipient.setCfdiUseCode("CN01"); + +// EmployeeData employeeData = new EmployeeData(); +// employeeData.setCurp("XEXX010101HNEXXXA4"); +// employeeData.setSocialSecurityNumber("000000"); +// employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); +// employeeData.setSeniority("P437W"); +// employeeData.setSatContractTypeId("01"); +// employeeData.setSatWorkdayTypeId("01"); +// employeeData.setSatTaxRegimeTypeId("0aa2ad8c3-6ec5-4601-91be-d827d9a865bc2"); +// employeeData.setEmployeeNumber("120"); +// employeeData.setDepartment("Desarrollo"); +// employeeData.setPosition("Ingeniero de Software"); +// employeeData.setSatJobRiskId("1"); +// employeeData.setSatPaymentPeriodicityId("04"); +// employeeData.setSatBankId("002"); +// employeeData.setBankAccount("1111111111"); +// employeeData.setBaseSalaryForContributions("490.22"); +// employeeData.setIntegratedDailySalary("146.47"); +// employeeData.setSatPayrollStateId("JAL"); +// recipient.setEmployeeData(employeeData); + +// // Payroll +// Payroll payroll = new Payroll(); +// payroll.setVersion("1.2"); +// payroll.setPayrollTypeCode("O"); +// payroll.setPaymentDate("2023-05-24T00:00:00"); +// payroll.setInitialPaymentDate("2023-05-09T00:00:00"); +// payroll.setFinalPaymentDate("2023-05-24T00:00:00"); +// payroll.setDaysPaid(15); + +// // Earnings +// PayrollEarnings payrollEarnings = new PayrollEarnings(); +// List earnings = new ArrayList<>(); + +// PayrollEarning e1 = new PayrollEarning(); +// e1.setEarningTypeCode("001"); +// e1.setCode("00500"); +// e1.setConcept("Sueldos, Salarios Rayas y Jornales"); +// e1.setTaxedAmount("2808.8"); +// e1.setExemptAmount("2191.2"); + +// earnings.add(e1); + +// // Other Payments +// List otherPayments = new ArrayList<>(); + +// PayrollEarningOtherPayment op1 = new PayrollEarningOtherPayment(); +// op1.setOtherPaymentTypeCode("007"); +// op1.setCode("0002"); +// op1.setConcept("ISR ajustado por subsidio"); +// op1.setAmount("145.80"); +// op1.setSubsidyCaused("0.0"); + +// otherPayments.add(op1); + +// payrollEarnings.setEarnings(earnings); +// payrollEarnings.setOtherPayments(otherPayments); + +// // Deductions +// List payrollDeductions = new ArrayList<>(); + +// PayrollDeduction d1 = new PayrollDeduction(); +// d1.setDeductionTypeCode("107"); +// d1.setCode("D002"); +// d1.setConcept("Ajuste al Subsidio Causado"); +// d1.setAmount("160.35"); + +// PayrollDeduction d2 = new PayrollDeduction(); +// d2.setDeductionTypeCode("002"); +// d2.setCode("D002"); +// d2.setConcept("ISR"); +// d2.setAmount("145.80"); + +// payrollDeductions.add(d1); +// payrollDeductions.add(d2); + +// payroll.setEarnings(payrollEarnings); +// payroll.setDeductions(payrollDeductions); + +// Complement complement = new Complement(); +// complement.setPayroll(payroll); + +// // Invoice +// Invoice invoice = new Invoice(); +// invoice.setVersionCode("4.0"); +// invoice.setSeries("F"); +// invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder +// invoice.setTypeCode("N"); +// invoice.setPaymentMethodCode("PUE"); +// invoice.setCurrencyCode("MXN"); +// invoice.setExpeditionZipCode("20000"); +// invoice.setExportCode("01"); +// invoice.setIssuer(issuer); +// invoice.setRecipient(recipient); +// invoice.setComplement(complement); + +// ApiResponse apiResponse = client.getInvoiceService().create(invoice); + +// System.out.println(apiResponse); + +// Nómina +// Emisor +// InvoiceIssuer issuer = new InvoiceIssuer(); +// issuer.setTin("EKU9003173C9"); +// issuer.setLegalName("ESCUELA KEMPER URGATE"); +// issuer.setTaxRegimeCode("601"); + +// EmployerData employerData = new EmployerData(); +// employerData.setEmployerRegistration("B5510768108"); +// employerData.setOriginEmployerTin("URE180429TM6"); +// issuer.setEmployerData(employerData); + +// // Certificados del emisor +// // Certificados del emisor +// List credentials = new ArrayList<>(); + +// TaxCredential cer = new TaxCredential(); +// cer.setBase64File(base64Cer); +// cer.setFileType(0); // 0 = Certificado (.cer) +// cer.setPassword(password); + +// TaxCredential key = new TaxCredential(); +// key.setBase64File(base64Key); +// key.setFileType(1); // 1 = Clave privada (.key) +// key.setPassword(password); + +// credentials.add(cer); +// credentials.add(key); + +// issuer.setTaxCredentials(credentials); + +// // Receptor +// InvoiceRecipient recipient = new InvoiceRecipient(); +// recipient.setTin("XOJI740919U48"); +// recipient.setLegalName("INGRID XODAR JIMENEZ"); +// recipient.setZipCode("76028"); +// recipient.setTaxRegimeCode("605"); +// recipient.setCfdiUseCode("CN01"); + +// EmployeeData employeeData = new EmployeeData(); +// employeeData.setCurp("XEXX010101HNEXXXA4"); +// employeeData.setSocialSecurityNumber("000000"); +// employeeData.setLaborRelationStartDate("2015-01-01T00:00:00"); +// employeeData.setSeniority("P437W"); +// employeeData.setSatContractTypeId("01"); +// employeeData.setSatWorkdayTypeId("01"); +// employeeData.setSatTaxRegimeTypeId("03"); +// employeeData.setEmployeeNumber("120"); +// employeeData.setDepartment("Desarrollo"); +// employeeData.setPosition("Ingeniero de Software"); +// employeeData.setSatJobRiskId("1"); +// employeeData.setSatPaymentPeriodicityId("04"); +// employeeData.setSatBankId("002"); +// employeeData.setBankAccount("1111111111"); +// employeeData.setBaseSalaryForContributions("490.22"); +// employeeData.setIntegratedDailySalary("146.47"); +// employeeData.setSatPayrollStateId("JAL"); +// recipient.setEmployeeData(employeeData); + +// // Payroll +// Payroll payroll = new Payroll(); +// payroll.setVersion("1.2"); +// payroll.setPayrollTypeCode("O"); +// payroll.setPaymentDate("2023-05-24T00:00:00"); +// payroll.setInitialPaymentDate("2023-05-09T00:00:00"); +// payroll.setFinalPaymentDate("2023-05-24T00:00:00"); +// payroll.setDaysPaid(15); + +// // Earnings +// PayrollEarnings payrollEarnings = new PayrollEarnings(); +// List earnings = new ArrayList<>(); + +// PayrollEarning e1 = new PayrollEarning(); +// e1.setEarningTypeCode("001"); +// e1.setCode("00500"); +// e1.setConcept("Sueldos, Salarios Rayas y Jornales"); +// e1.setTaxedAmount("2808.8"); +// e1.setExemptAmount("2191.2"); + +// earnings.add(e1); + +// // Other Payments +// List otherPayments = new ArrayList<>(); + +// payrollEarnings.setEarnings(earnings); +// payrollEarnings.setOtherPayments(otherPayments); + +// // Deductions +// List payrollDeductions = new ArrayList<>(); + +// PayrollDeduction d1 = new PayrollDeduction(); +// d1.setDeductionTypeCode("001"); +// d1.setCode("00301"); +// d1.setConcept("Seguridad Social"); +// d1.setAmount("200.00"); + +// PayrollDeduction d2 = new PayrollDeduction(); +// d2.setDeductionTypeCode("002"); +// d2.setCode("00302"); +// d2.setConcept("ISR"); +// d2.setAmount("100.00"); + +// payrollDeductions.add(d1); +// payrollDeductions.add(d2); + +// payroll.setEarnings(payrollEarnings); +// payroll.setDeductions(payrollDeductions); + +// Complement complement = new Complement(); +// complement.setPayroll(payroll); + +// // Invoice +// Invoice invoice = new Invoice(); +// invoice.setVersionCode("4.0"); +// invoice.setSeries("F"); +// invoice.setDate("2026-02-09T10:00:00"); // Or use {{currentDate}} placeholder +// invoice.setTypeCode("N"); +// invoice.setPaymentMethodCode("PUE"); +// invoice.setCurrencyCode("MXN"); +// invoice.setExpeditionZipCode("20000"); +// invoice.setExportCode("01"); +// invoice.setIssuer(issuer); +// invoice.setRecipient(recipient); +// invoice.setComplement(complement); + +// ApiResponse apiResponse = client.getInvoiceService().create(invoice); + +// System.out.println(apiResponse); +// endregion +//region timbres +// Listar movimientos +// ApiResponse> apiResponse = client.getStampService().getList(1, 10); +// System.out.println(apiResponse); + +// Obtener movimiento por ID +// ApiResponse transactionResponse = client.getStampService().getById("77678d6d-94b1-4635-aa91-15cdd7423aab", false); +// System.out.println(transactionResponse); +// Transferir timbres + // StampTransactionParams transParams = new StampTransactionParams(); + // transParams.setFromPersonId("1"); + // transParams.setToPersonId("bef56254-0892-4558-95c3-f9c8729e4b0e"); + // transParams.setAmount(1); + // transParams.setComments("venta de timbres"); + // ApiResponse apiResponse = client.getStampService().transferStamps(transParams); + // System.out.println(apiResponse); + + // //Retirar timbres + // StampTransactionParams transParams = new StampTransactionParams(); + // transParams.setFromPersonId("bef56254-0892-4558-95c3-f9c8729e4b0e"); + // transParams.setToPersonId("1"); + // transParams.setAmount(1); + // transParams.setComments("prestamo"); + // ApiResponse apiResponse = client.getStampService().withdrawStamps(transParams); + // System.out.println(apiResponse); +//end region System.out.printf("%s\n", "End Fiscalapi!"); } } \ No newline at end of file diff --git a/src/main/java/com/fiscalapi/OptUtil.java b/src/main/java/com/fiscalapi/OptUtil.java new file mode 100644 index 0000000..c3a984b --- /dev/null +++ b/src/main/java/com/fiscalapi/OptUtil.java @@ -0,0 +1,43 @@ +package com.fiscalapi; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.ZonedDateTime; +import java.time.format.DateTimeParseException; + +import static com.fiscalapi.models.invoicing.InvoiceConstants.SAT_DATE_FORMAT_IN; + +public class OptUtil { + public static LocalDateTime formatInputDateToSATFormat(String stringDate) { + LocalDateTime parsedDate = null; + if (stringDate == null || stringDate.isEmpty()) { + return parsedDate; + } + + try { + // Intenta primero parsearlo como LocalDateTime + parsedDate = LocalDateTime.parse(stringDate, SAT_DATE_FORMAT_IN); + } catch (DateTimeParseException e) { + try { + // Si falla, intenta parsearlo como ZonedDateTime y convertirlo a LocalDateTime + ZonedDateTime zdt = ZonedDateTime.parse(stringDate); + parsedDate = zdt.toLocalDateTime(); + } catch (DateTimeParseException e2) { + throw new IllegalArgumentException("Formato de fecha inválido: " + stringDate + + " (debe ser compatible con el formato yyyy-MM-ddTHH:mm:ss)", e); + } + } + return parsedDate; + } + + public static BigDecimal parseBigDecimal(String value) { + if (value == null || value.isEmpty()) { + throw new IllegalArgumentException("Valor numérico inválido: " + value); + } + try { + return new BigDecimal(value); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Valor numérico inválido: " + value, e); + } + } +} diff --git a/src/main/java/com/fiscalapi/abstractions/IEmployeeService.java b/src/main/java/com/fiscalapi/abstractions/IEmployeeService.java new file mode 100644 index 0000000..11928ab --- /dev/null +++ b/src/main/java/com/fiscalapi/abstractions/IEmployeeService.java @@ -0,0 +1,11 @@ +package com.fiscalapi.abstractions; + +import com.fiscalapi.common.ApiResponse; +import com.fiscalapi.models.invoicing.payroll.EmployeeData; + +public interface IEmployeeService { + ApiResponse getById(String id); + ApiResponse create(EmployeeData requestModel); + ApiResponse update(EmployeeData requestModel); + ApiResponse delete(String id); +} diff --git a/src/main/java/com/fiscalapi/abstractions/IEmployerService.java b/src/main/java/com/fiscalapi/abstractions/IEmployerService.java new file mode 100644 index 0000000..0430924 --- /dev/null +++ b/src/main/java/com/fiscalapi/abstractions/IEmployerService.java @@ -0,0 +1,11 @@ +package com.fiscalapi.abstractions; + +import com.fiscalapi.common.ApiResponse; +import com.fiscalapi.models.invoicing.payroll.EmployerData; + +public interface IEmployerService { + ApiResponse getById(String id); + ApiResponse create(EmployerData requestModel); + ApiResponse update(EmployerData requestModel); + ApiResponse delete(String id); +} diff --git a/src/main/java/com/fiscalapi/abstractions/IFiscalApiClient.java b/src/main/java/com/fiscalapi/abstractions/IFiscalApiClient.java index 6ba828f..e286ed1 100644 --- a/src/main/java/com/fiscalapi/abstractions/IFiscalApiClient.java +++ b/src/main/java/com/fiscalapi/abstractions/IFiscalApiClient.java @@ -10,5 +10,6 @@ public interface IFiscalApiClient { IDownloadCatalogService getDownloadCatalogService(); IDownloadRuleService getDownloadRuleService(); IDownloadRequestService getDownloadRequestService(); + IStampService getStampService(); // ... etc } diff --git a/src/main/java/com/fiscalapi/abstractions/IFiscalApiHttpClient.java b/src/main/java/com/fiscalapi/abstractions/IFiscalApiHttpClient.java index 3a572c9..7dddcd9 100644 --- a/src/main/java/com/fiscalapi/abstractions/IFiscalApiHttpClient.java +++ b/src/main/java/com/fiscalapi/abstractions/IFiscalApiHttpClient.java @@ -2,8 +2,6 @@ import com.fiscalapi.common.ApiResponse; -import java.util.concurrent.CompletableFuture; - public interface IFiscalApiHttpClient { ApiResponse get(String url, Class responseType); ApiResponse post(String url, Object body, Class responseType); diff --git a/src/main/java/com/fiscalapi/abstractions/IPersonService.java b/src/main/java/com/fiscalapi/abstractions/IPersonService.java index 2543a5b..742ded8 100644 --- a/src/main/java/com/fiscalapi/abstractions/IPersonService.java +++ b/src/main/java/com/fiscalapi/abstractions/IPersonService.java @@ -7,6 +7,9 @@ * Hereda las operaciones básicas (CRUD) de IFiscalApiService<Person>. */ public interface IPersonService extends IFiscalApiService { + IEmployerService employerService = null; + IEmployeeService employeeService = null; - // other specific methods + IEmployeeService getEmployeeService(); + IEmployerService getEmployerService(); } \ No newline at end of file diff --git a/src/main/java/com/fiscalapi/abstractions/IStampService.java b/src/main/java/com/fiscalapi/abstractions/IStampService.java new file mode 100644 index 0000000..09ff691 --- /dev/null +++ b/src/main/java/com/fiscalapi/abstractions/IStampService.java @@ -0,0 +1,10 @@ +package com.fiscalapi.abstractions; + +import com.fiscalapi.common.ApiResponse; +import com.fiscalapi.models.StampTransaction; +import com.fiscalapi.models.StampTransactionParams; + +public interface IStampService extends IFiscalApiService{ + ApiResponse transferStamps(StampTransactionParams requestModel); + ApiResponse withdrawStamps(StampTransactionParams requestModel); +} diff --git a/src/main/java/com/fiscalapi/models/Person.java b/src/main/java/com/fiscalapi/models/Person.java index a41a7d2..6bf4281 100644 --- a/src/main/java/com/fiscalapi/models/Person.java +++ b/src/main/java/com/fiscalapi/models/Person.java @@ -5,6 +5,7 @@ import com.fiscalapi.common.CatalogDto; import com.fiscalapi.common.StripePaymentMethodDto; +import java.math.BigDecimal; import java.time.LocalDateTime; @@ -23,8 +24,8 @@ public class Person extends BaseDto { private String zipCode; private String base64Photo; private String taxPassword; - private Double availableBalance; - private Double committedBalance; + private BigDecimal availableBalance; + private BigDecimal committedBalance; private String tenantId; // private String phoneNumber; // private LocalDateTime validTo; @@ -146,19 +147,19 @@ public void setTaxPassword(String taxPassword) { this.taxPassword = taxPassword; } - public Double getAvailableBalance() { + public BigDecimal getAvailableBalance() { return availableBalance; } - public void setAvailableBalance(Double availableBalance) { + public void setAvailableBalance(BigDecimal availableBalance) { this.availableBalance = availableBalance; } - public Double getCommittedBalance() { + public BigDecimal getCommittedBalance() { return committedBalance; } - public void setCommittedBalance(Double committedBalance) { + public void setCommittedBalance(BigDecimal committedBalance) { this.committedBalance = committedBalance; } @@ -169,4 +170,4 @@ public String getTenantId() { public void setTenantId(String tenantId) { this.tenantId = tenantId; } -} +} \ No newline at end of file diff --git a/src/main/java/com/fiscalapi/models/Product.java b/src/main/java/com/fiscalapi/models/Product.java index d1aa097..e2465a8 100644 --- a/src/main/java/com/fiscalapi/models/Product.java +++ b/src/main/java/com/fiscalapi/models/Product.java @@ -5,6 +5,7 @@ import com.fiscalapi.common.CatalogDto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; /** * Representa un producto o servicio con toda su información, incluyendo precios, @@ -29,7 +30,7 @@ public class Product extends BaseDto { /** * Precio unitario del producto sin impuestos (requerido). */ - private double unitPrice; + private BigDecimal unitPrice; /** * Código de la unidad de medida. Catálogo del SAT c_ClaveUnidad. @@ -101,7 +102,7 @@ public void setDescription(String description) { * * @return el precio unitario. */ - public double getUnitPrice() { + public BigDecimal getUnitPrice() { return unitPrice; } @@ -110,7 +111,7 @@ public double getUnitPrice() { * * @param unitPrice el precio unitario a establecer. */ - public void setUnitPrice(double unitPrice) { + public void setUnitPrice(BigDecimal unitPrice) { this.unitPrice = unitPrice; } diff --git a/src/main/java/com/fiscalapi/models/ProductTax.java b/src/main/java/com/fiscalapi/models/ProductTax.java index 51bd4c9..735bc18 100644 --- a/src/main/java/com/fiscalapi/models/ProductTax.java +++ b/src/main/java/com/fiscalapi/models/ProductTax.java @@ -31,7 +31,7 @@ public class ProductTax extends BaseDto { /** * Tasa del impuesto. El valor debe estar entre 0.00000 y 1.000000 (ej: 0.160000). */ - private double rate; + private BigDecimal rate; /** * Código del impuesto según el catálogo del SAT (valores: "001", "002", "003"). @@ -93,7 +93,7 @@ public void setProductId(String productId) { * * @return la tasa del impuesto. */ - public double getRate() { + public BigDecimal getRate() { return rate; } @@ -102,7 +102,7 @@ public double getRate() { * * @param rate la tasa a establecer. */ - public void setRate(double rate) { + public void setRate(BigDecimal rate) { this.rate = rate; } diff --git a/src/main/java/com/fiscalapi/models/StampTransaction.java b/src/main/java/com/fiscalapi/models/StampTransaction.java new file mode 100644 index 0000000..072e02e --- /dev/null +++ b/src/main/java/com/fiscalapi/models/StampTransaction.java @@ -0,0 +1,78 @@ +package com.fiscalapi.models; + +import com.fiscalapi.common.BaseDto; + +public class StampTransaction extends BaseDto { + private int consecutive; + private UserLookupDto fromPerson; + private UserLookupDto toPerson; + private int amount; + private StampTransactionType transactionType; + private StampTransactionStatus transactionStatus; + private String referenceId; + private String comments; + + public int getConsecutive() { + return consecutive; + } + + public void setConsecutive(int consecutive) { + this.consecutive = consecutive; + } + + public UserLookupDto getFromPerson() { + return fromPerson; + } + + public void setFromPerson(UserLookupDto fromPerson) { + this.fromPerson = fromPerson; + } + + public UserLookupDto getToPerson() { + return toPerson; + } + + public void setToPerson(UserLookupDto toPerson) { + this.toPerson = toPerson; + } + + public int getAmount() { + return amount; + } + + public void setAmount(int amount) { + this.amount = amount; + } + + public StampTransactionType getTransactionType() { + return transactionType; + } + + public void setTransactionType(StampTransactionType transactionType) { + this.transactionType = transactionType; + } + + public String getReferenceId() { + return referenceId; + } + + public void setReferenceId(String referenceId) { + this.referenceId = referenceId; + } + + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } + + public StampTransactionStatus getTransactionStatus() { + return transactionStatus; + } + + public void setTransactionStatus(StampTransactionStatus transactionStatus) { + this.transactionStatus = transactionStatus; + } +} diff --git a/src/main/java/com/fiscalapi/models/StampTransactionParams.java b/src/main/java/com/fiscalapi/models/StampTransactionParams.java new file mode 100644 index 0000000..e87a6ae --- /dev/null +++ b/src/main/java/com/fiscalapi/models/StampTransactionParams.java @@ -0,0 +1,41 @@ +package com.fiscalapi.models; + +public class StampTransactionParams +{ + private String fromPersonId; + private String toPersonId; + private int amount; + private String comments; + + public String getFromPersonId() { + return fromPersonId; + } + + public void setFromPersonId(String fromPersonId) { + this.fromPersonId = fromPersonId; + } + + public String getToPersonId() { + return toPersonId; + } + + public void setToPersonId(String toPersonId) { + this.toPersonId = toPersonId; + } + + public int getAmount() { + return amount; + } + + public void setAmount(int amount) { + this.amount = amount; + } + + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } +} diff --git a/src/main/java/com/fiscalapi/models/StampTransactionStatus.java b/src/main/java/com/fiscalapi/models/StampTransactionStatus.java new file mode 100644 index 0000000..5a83aad --- /dev/null +++ b/src/main/java/com/fiscalapi/models/StampTransactionStatus.java @@ -0,0 +1,7 @@ +package com.fiscalapi.models; + +public enum StampTransactionStatus { + COMPLETED, + CANCELLED, + ROLLEDBACK +} diff --git a/src/main/java/com/fiscalapi/models/StampTransactionType.java b/src/main/java/com/fiscalapi/models/StampTransactionType.java new file mode 100644 index 0000000..d1df5e1 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/StampTransactionType.java @@ -0,0 +1,9 @@ +package com.fiscalapi.models; + +public enum StampTransactionType { + PURCHASE, + TRANSFER, + CONSUMPTION, + AUTOINVOICE, + ROLLBACK +} \ No newline at end of file diff --git a/src/main/java/com/fiscalapi/models/UserLookupDto.java b/src/main/java/com/fiscalapi/models/UserLookupDto.java new file mode 100644 index 0000000..bb493ea --- /dev/null +++ b/src/main/java/com/fiscalapi/models/UserLookupDto.java @@ -0,0 +1,25 @@ +package com.fiscalapi.models; + +import com.fiscalapi.common.BaseDto; + +public class UserLookupDto extends BaseDto { + private String tin; + + public String getLegalName() { + return legalName; + } + + public void setLegalName(String legalName) { + this.legalName = legalName; + } + + public String getTin() { + return tin; + } + + public void setTin(String tin) { + this.tin = tin; + } + + private String legalName; +} diff --git a/src/main/java/com/fiscalapi/models/downloading/DownloadRequest.java b/src/main/java/com/fiscalapi/models/downloading/DownloadRequest.java index 8384e2f..4e42106 100644 --- a/src/main/java/com/fiscalapi/models/downloading/DownloadRequest.java +++ b/src/main/java/com/fiscalapi/models/downloading/DownloadRequest.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; +import com.fiscalapi.OptUtil; import com.fiscalapi.common.BaseDto; import com.fiscalapi.common.CatalogDto; import java.time.LocalDateTime; @@ -222,9 +223,16 @@ public LocalDateTime getStartDate() { } /** - * @param startDate Fecha inicial - Fecha de inicio para la solicitud asociada + * @param startDate Fecha inicial - Fecha de inicio para la solicitud asociada como String */ - public void setStartDate(LocalDateTime startDate) { + public void setStartDate(String startDate) { + this.startDate = OptUtil.formatInputDateToSATFormat(startDate); + } + + /** + * @param startDate Fecha inicial - Fecha de inicio para la solicitud asociada como LocalDateTime + */ + public void setStartDateFromLocalDateTime(LocalDateTime startDate) { this.startDate = startDate; } @@ -236,9 +244,16 @@ public LocalDateTime getEndDate() { } /** - * @param endDate Fecha final - Fecha de fin para la solicitud asociada + * @param endDate Fecha final - Fecha de fin para la solicitud asociada como String + */ + public void setEndDate(String endDate) { + this.endDate = OptUtil.formatInputDateToSATFormat(endDate); + } + + /** + * @param endDate Fecha final - Fecha de fin para la solicitud asociada como LocalDateTime */ - public void setEndDate(LocalDateTime endDate) { + public void setEndDateFromLocalDateTime(LocalDateTime endDate) { this.endDate = endDate; } @@ -420,7 +435,11 @@ public LocalDateTime getLastAttemptDate() { /** * @param lastAttemptDate Fecha del último intento para la solicitud asociada */ - public void setLastAttemptDate(LocalDateTime lastAttemptDate) { + public void setLastAttemptDate(String lastAttemptDate) { + this.lastAttemptDate = OptUtil.formatInputDateToSATFormat(lastAttemptDate); + } + + public void setLastAttemptDateFromLocalDateTime(LocalDateTime lastAttemptDate) { this.lastAttemptDate = lastAttemptDate; } @@ -434,7 +453,11 @@ public LocalDateTime getNextAttemptDate() { /** * @param nextAttemptDate Fecha del siguiente intento para la solicitud asociada */ - public void setNextAttemptDate(LocalDateTime nextAttemptDate) { + public void setNextAttemptDate(String nextAttemptDate) { + this.nextAttemptDate = OptUtil.formatInputDateToSATFormat(nextAttemptDate); + } + + public void setNextAttemptDateFromLocalDateTime(LocalDateTime nextAttemptDate) { this.nextAttemptDate = nextAttemptDate; } diff --git a/src/main/java/com/fiscalapi/models/downloading/MetadataItem.java b/src/main/java/com/fiscalapi/models/downloading/MetadataItem.java index a2e52de..e30b1bf 100644 --- a/src/main/java/com/fiscalapi/models/downloading/MetadataItem.java +++ b/src/main/java/com/fiscalapi/models/downloading/MetadataItem.java @@ -2,13 +2,10 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fiscalapi.OptUtil; import com.fiscalapi.common.BaseDto; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.time.ZonedDateTime; -import java.time.format.DateTimeParseException; - -import static com.fiscalapi.models.invoicing.InvoiceConstants.SAT_DATE_FORMAT_IN; import static com.fiscalapi.models.invoicing.InvoiceConstants.SAT_DATE_FORMAT_OUT; /** @@ -154,20 +151,7 @@ public String getSatInvoiceDate() { @JsonProperty("invoiceDate") public void setSatInvoiceDate(String satDate) { - if (satDate == null || satDate.isEmpty()) { - this.invoiceDate = null; - return; - } - try { - this.invoiceDate = LocalDateTime.parse(satDate, SAT_DATE_FORMAT_IN); - } catch (DateTimeParseException e) { - try { - ZonedDateTime zdt = ZonedDateTime.parse(satDate); - this.invoiceDate = zdt.toLocalDateTime(); - } catch (DateTimeParseException e2) { - throw new IllegalArgumentException("Formato de fecha inválido: " + satDate, e); - } - } + this.invoiceDate = OptUtil.formatInputDateToSATFormat(satDate); } @JsonIgnore @@ -190,20 +174,7 @@ public String getSatCertificationDateFormatted() { @JsonProperty("satCertificationDate") public void setSatCertificationDateFormatted(String satDate) { - if (satDate == null || satDate.isEmpty()) { - this.satCertificationDate = null; - return; - } - try { - this.satCertificationDate = LocalDateTime.parse(satDate, SAT_DATE_FORMAT_IN); - } catch (DateTimeParseException e) { - try { - ZonedDateTime zdt = ZonedDateTime.parse(satDate); - this.satCertificationDate = zdt.toLocalDateTime(); - } catch (DateTimeParseException e2) { - throw new IllegalArgumentException("Formato de fecha inválido: " + satDate, e); - } - } + this.satCertificationDate = OptUtil.formatInputDateToSATFormat(satDate); } public BigDecimal getAmount() { @@ -250,20 +221,7 @@ public String getSatCancellationDate() { @JsonProperty("cancellationDate") public void setSatCancellationDate(String satDate) { - if (satDate == null || satDate.isEmpty()) { - this.cancellationDate = null; - return; - } - try { - this.cancellationDate = LocalDateTime.parse(satDate, SAT_DATE_FORMAT_IN); - } catch (DateTimeParseException e) { - try { - ZonedDateTime zdt = ZonedDateTime.parse(satDate); - this.cancellationDate = zdt.toLocalDateTime(); - } catch (DateTimeParseException e2) { - throw new IllegalArgumentException("Formato de fecha inválido: " + satDate, e); - } - } + this.cancellationDate = OptUtil.formatInputDateToSATFormat(satDate); } public String getDownloadPackageId() { diff --git a/src/main/java/com/fiscalapi/models/downloading/Xml.java b/src/main/java/com/fiscalapi/models/downloading/Xml.java index 3e938fe..fc1d208 100644 --- a/src/main/java/com/fiscalapi/models/downloading/Xml.java +++ b/src/main/java/com/fiscalapi/models/downloading/Xml.java @@ -3,16 +3,14 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fiscalapi.OptUtil; import com.fiscalapi.common.BaseDto; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.time.ZonedDateTime; -import java.time.format.DateTimeParseException; import java.util.ArrayList; import java.util.List; -import static com.fiscalapi.models.invoicing.InvoiceConstants.SAT_DATE_FORMAT_IN; import static com.fiscalapi.models.invoicing.InvoiceConstants.SAT_DATE_FORMAT_OUT; /** @@ -176,25 +174,15 @@ public String getSatDate() { */ @JsonProperty("date") public void setSatDate(String satDate) { - if (satDate == null || satDate.isEmpty()) { - this.date = null; - return; - } + this.date = OptUtil.formatInputDateToSATFormat(satDate); + } - try { - // Intenta primero parsearlo como LocalDateTime - this.date = LocalDateTime.parse(satDate, SAT_DATE_FORMAT_IN); - } catch (DateTimeParseException e) { - try { - // Si falla, intenta parsearlo como ZonedDateTime y convertirlo a LocalDateTime - ZonedDateTime zdt = ZonedDateTime.parse(satDate); - this.date = zdt.toLocalDateTime(); - } catch (DateTimeParseException e2) { - - throw new IllegalArgumentException("Formato de fecha inválido: " + satDate + - " (debe ser compatible con el formato yyyy-MM-ddTHH:mm:ss)", e); - } - } + @JsonIgnore + /** + * @param dateString Fecha y hora de expedición como String en formato SAT + */ + public void setDate(String dateString) { + this.date = OptUtil.formatInputDateToSATFormat(dateString); } public String getPaymentForm() { diff --git a/src/main/java/com/fiscalapi/models/invoicing/Complement.java b/src/main/java/com/fiscalapi/models/invoicing/Complement.java new file mode 100644 index 0000000..a6295cb --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/Complement.java @@ -0,0 +1,35 @@ +package com.fiscalapi.models.invoicing; + +import com.fiscalapi.models.invoicing.localTaxes.LocalTaxes; +import com.fiscalapi.models.invoicing.paymentComplement.InvoicePayment; +import com.fiscalapi.models.invoicing.payroll.Payroll; + +public class Complement { + private Payroll payroll; + private InvoicePayment payment; + private LocalTaxes localTaxes; + + public Payroll getPayroll() { + return payroll; + } + + public void setPayroll(Payroll payroll) { + this.payroll = payroll; + } + + public InvoicePayment getPayment() { + return payment; + } + + public void setPayment(InvoicePayment payment) { + this.payment = payment; + } + + public LocalTaxes getLocalTaxes() { + return localTaxes; + } + + public void setLocalTaxes(LocalTaxes localTaxes) { + this.localTaxes = localTaxes; + } +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/Invoice.java b/src/main/java/com/fiscalapi/models/invoicing/Invoice.java index f6e3722..ae7c9d2 100644 --- a/src/main/java/com/fiscalapi/models/invoicing/Invoice.java +++ b/src/main/java/com/fiscalapi/models/invoicing/Invoice.java @@ -1,14 +1,14 @@ package com.fiscalapi.models.invoicing; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fiscalapi.OptUtil; import com.fiscalapi.common.BaseDto; import com.fiscalapi.common.CatalogDto; +import com.fiscalapi.models.invoicing.paymentComplement.InvoicePayment; +import java.math.BigDecimal; import java.time.LocalDateTime; -import java.time.ZonedDateTime; -import java.time.format.DateTimeParseException; import java.util.List; -import static com.fiscalapi.models.invoicing.InvoiceConstants.SAT_DATE_FORMAT_IN; import static com.fiscalapi.models.invoicing.InvoiceConstants.SAT_DATE_FORMAT_OUT; @@ -24,24 +24,26 @@ public class Invoice extends BaseDto{ private String number; private String uuid; private Integer consecutive; - private Double subtotal; - private Double discount; - private Double total; + private BigDecimal subtotal; + private BigDecimal discount; + private BigDecimal total; @JsonIgnore private LocalDateTime date; private String paymentFormCode; + private String paymentConditions; private String currencyCode; private String typeCode; private String expeditionZipCode; private String exportCode; private String paymentMethodCode; - private Double exchangeRate; + private BigDecimal exchangeRate; private InvoiceIssuer issuer; private InvoiceRecipient recipient; private List items; private GlobalInformation globalInformation; private List relatedInvoices; private List payments; + private Complement complement; private List responses; @@ -102,43 +104,43 @@ public void setConsecutive(Integer consecutive) { /** * @return Subtotal de la factura antes de impuestos y descuentos */ - public Double getSubtotal() { + public BigDecimal getSubtotal() { return subtotal; } /** * @param subtotal Suma de los importes de los conceptos antes de descuentos e impuestos */ - public void setSubtotal(Double subtotal) { - this.subtotal = subtotal; + public void setSubtotal(String subtotal) { + this.subtotal = OptUtil.parseBigDecimal(subtotal); } /** * @return Monto total de descuentos aplicados a la factura */ - public Double getDiscount() { + public BigDecimal getDiscount() { return discount; } /** * @param discount Monto total de los descuentos aplicables */ - public void setDiscount(Double discount) { - this.discount = discount; + public void setDiscount(String discount) { + this.discount = OptUtil.parseBigDecimal(discount); } /** * @return Monto total de la factura incluyendo impuestos */ - public Double getTotal() { + public BigDecimal getTotal() { return total; } /** * @param total Monto total de la factura incluyendo impuestos */ - public void setTotal(Double total) { - this.total = total; + public void setTotal(String total) { + this.total = OptUtil.parseBigDecimal(total); } @@ -211,26 +213,16 @@ public String getSatDate() { */ @JsonProperty("date") public void setSatDate(String satDate) { - if (satDate == null || satDate.isEmpty()) { - this.date = null; - return; - } - - try { - // Intenta primero parsearlo como LocalDateTime - this.date = LocalDateTime.parse(satDate, SAT_DATE_FORMAT_IN); - } catch (DateTimeParseException e) { - try { - // Si falla, intenta parsearlo como ZonedDateTime y convertirlo a LocalDateTime - ZonedDateTime zdt = ZonedDateTime.parse(satDate); - this.date = zdt.toLocalDateTime(); - } catch (DateTimeParseException e2) { - throw new IllegalArgumentException("Formato de fecha inválido: " + satDate + - " (debe ser compatible con el formato yyyy-MM-ddTHH:mm:ss)", e); - } - } + this.date = OptUtil.formatInputDateToSATFormat(satDate); } + @JsonIgnore + /** + * @param dateString Fecha y hora de expedición como String en formato SAT + */ + public void setDate(String dateString) { + this.date = OptUtil.formatInputDateToSATFormat(dateString); + } /** * @return Código de la forma de pago para la factura @@ -319,15 +311,15 @@ public void setPaymentMethodCode(String paymentMethodCode) { /** * @return Tipo de cambio conforme a la moneda registrada */ - public Double getExchangeRate() { + public BigDecimal getExchangeRate() { return exchangeRate; } /** * @param exchangeRate Tipo de cambio FIX (Si la moneda es MXN, el valor debe ser 1) */ - public void setExchangeRate(Double exchangeRate) { - this.exchangeRate = exchangeRate; + public void setExchangeRate(String exchangeRate) { + this.exchangeRate = OptUtil.parseBigDecimal(exchangeRate); } /** @@ -435,5 +427,27 @@ public void setResponses(List responses) { this.responses = responses; } + /** + * + * @return Complemento de la factura + */ + public Complement getComplement() { + return complement; + } + /** + * + * @param complement Complemento asociado a la factura + */ + public void setComplement(Complement complement) { + this.complement = complement; + } + + public String getPaymentConditions() { + return paymentConditions; + } + + public void setPaymentConditions(String paymentConditions) { + this.paymentConditions = paymentConditions; + } } \ No newline at end of file diff --git a/src/main/java/com/fiscalapi/models/invoicing/InvoiceIssuer.java b/src/main/java/com/fiscalapi/models/invoicing/InvoiceIssuer.java index 17a72e2..219405f 100644 --- a/src/main/java/com/fiscalapi/models/invoicing/InvoiceIssuer.java +++ b/src/main/java/com/fiscalapi/models/invoicing/InvoiceIssuer.java @@ -2,12 +2,15 @@ import java.util.List; +import com.fiscalapi.models.invoicing.payroll.EmployerData; + // Emisor de la factura public class InvoiceIssuer { private String id; private String tin; private String legalName; private String taxRegimeCode; + private EmployerData employerData; private List taxCredentials; public String getId() { @@ -40,4 +43,12 @@ public List getTaxCredentials() { public void setTaxCredentials(List taxCredentials) { this.taxCredentials = taxCredentials; } + + public EmployerData getEmployerData() { + return employerData; + } + + public void setEmployerData(EmployerData employerData) { + this.employerData = employerData; + } } \ No newline at end of file diff --git a/src/main/java/com/fiscalapi/models/invoicing/InvoiceItem.java b/src/main/java/com/fiscalapi/models/invoicing/InvoiceItem.java index 4a7532f..628f706 100644 --- a/src/main/java/com/fiscalapi/models/invoicing/InvoiceItem.java +++ b/src/main/java/com/fiscalapi/models/invoicing/InvoiceItem.java @@ -1,19 +1,24 @@ package com.fiscalapi.models.invoicing; +import com.fiscalapi.OptUtil; + +import java.math.BigDecimal; import java.util.List; // Concepto de la factura (producto o servicio) public class InvoiceItem { private String id; private String itemCode; - private Double quantity; - private Double discount; + private BigDecimal quantity; + private BigDecimal discount; private String unitOfMeasurementCode; + private String unitOfMeasurement; private String description; - private Double unitPrice; + private BigDecimal unitPrice; private String taxObjectCode; private String itemSku; private List itemTaxes; + private OnBehalfOf onBehalfOf; public String getId() { return id; @@ -27,17 +32,17 @@ public String getItemCode() { public void setItemCode(String itemCode) { this.itemCode = itemCode; } - public Double getQuantity() { + public BigDecimal getQuantity() { return quantity; } - public void setQuantity(Double quantity) { - this.quantity = quantity; + public void setQuantity(String quantity) { + this.quantity = OptUtil.parseBigDecimal(quantity); } - public Double getDiscount() { + public BigDecimal getDiscount() { return discount; } - public void setDiscount(Double discount) { - this.discount = discount; + public void setDiscount(String discount) { + this.discount = OptUtil.parseBigDecimal(discount); } public String getUnitOfMeasurementCode() { return unitOfMeasurementCode; @@ -51,11 +56,11 @@ public String getDescription() { public void setDescription(String description) { this.description = description; } - public Double getUnitPrice() { + public BigDecimal getUnitPrice() { return unitPrice; } - public void setUnitPrice(Double unitPrice) { - this.unitPrice = unitPrice; + public void setUnitPrice(String unitPrice) { + this.unitPrice = OptUtil.parseBigDecimal(unitPrice); } public String getTaxObjectCode() { return taxObjectCode; @@ -75,4 +80,20 @@ public List getItemTaxes() { public void setItemTaxes(List itemTaxes) { this.itemTaxes = itemTaxes; } + + public String getUnitOfMeasurement() { + return unitOfMeasurement; + } + + public void setUnitOfMeasurement(String unitOfMeasurement) { + this.unitOfMeasurement = unitOfMeasurement; + } + + public OnBehalfOf getOnBehalfOf() { + return onBehalfOf; + } + + public void setOnBehalfOf(OnBehalfOf onBehalfOf) { + this.onBehalfOf = onBehalfOf; + } } \ No newline at end of file diff --git a/src/main/java/com/fiscalapi/models/invoicing/InvoiceRecipient.java b/src/main/java/com/fiscalapi/models/invoicing/InvoiceRecipient.java index fc8bf2e..49127fd 100644 --- a/src/main/java/com/fiscalapi/models/invoicing/InvoiceRecipient.java +++ b/src/main/java/com/fiscalapi/models/invoicing/InvoiceRecipient.java @@ -1,5 +1,7 @@ package com.fiscalapi.models.invoicing; +import com.fiscalapi.models.invoicing.payroll.EmployeeData; + // Receptor de la factura public class InvoiceRecipient { private String id; @@ -7,6 +9,16 @@ public class InvoiceRecipient { private String legalName; private String taxRegimeCode; private String cfdiUseCode; + + public EmployeeData getEmployeeData() { + return employeeData; + } + + public void setEmployeeData(EmployeeData employeeData) { + this.employeeData = employeeData; + } + + private EmployeeData employeeData; private String zipCode; private String email; diff --git a/src/main/java/com/fiscalapi/models/invoicing/InvoiceStatusRequest.java b/src/main/java/com/fiscalapi/models/invoicing/InvoiceStatusRequest.java index dee988b..2f343de 100644 --- a/src/main/java/com/fiscalapi/models/invoicing/InvoiceStatusRequest.java +++ b/src/main/java/com/fiscalapi/models/invoicing/InvoiceStatusRequest.java @@ -1,5 +1,7 @@ package com.fiscalapi.models.invoicing; +import com.fiscalapi.OptUtil; + import java.math.BigDecimal; /** @@ -42,7 +44,7 @@ public BigDecimal getInvoiceTotal() { } public void setInvoiceTotal(String invoiceTotal) { - this.invoiceTotal = new BigDecimal(invoiceTotal); + this.invoiceTotal = OptUtil.parseBigDecimal(invoiceTotal); } public String getInvoiceUuid() { diff --git a/src/main/java/com/fiscalapi/models/invoicing/ItemTax.java b/src/main/java/com/fiscalapi/models/invoicing/ItemTax.java index 4c5346f..ffdb268 100644 --- a/src/main/java/com/fiscalapi/models/invoicing/ItemTax.java +++ b/src/main/java/com/fiscalapi/models/invoicing/ItemTax.java @@ -1,5 +1,7 @@ package com.fiscalapi.models.invoicing; +import com.fiscalapi.OptUtil; + import java.math.BigDecimal; // Impuestos aplicables al concepto @@ -27,7 +29,7 @@ public BigDecimal getTaxRate() { //string para facilitar la asignación de valores, Big decimal para evitar la perdida de escala y presición del dooble. public void setTaxRate(String taxRate) { - this.taxRate = new BigDecimal(taxRate); + this.taxRate = OptUtil.parseBigDecimal(taxRate); } public String getTaxFlagCode() { return taxFlagCode; diff --git a/src/main/java/com/fiscalapi/models/invoicing/OnBehalfOf.java b/src/main/java/com/fiscalapi/models/invoicing/OnBehalfOf.java new file mode 100644 index 0000000..7648da0 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/OnBehalfOf.java @@ -0,0 +1,40 @@ +package com.fiscalapi.models.invoicing; + +public class OnBehalfOf { + private String tin; + private String legalName; + private String taxRegimeCode; + private String zipCode; + + public String getTin() { + return tin; + } + + public void setTin(String tin) { + this.tin = tin; + } + + public String getLegalName() { + return legalName; + } + + public void setLegalName(String legalName) { + this.legalName = legalName; + } + + public String getTaxRegimeCode() { + return taxRegimeCode; + } + + public void setTaxRegimeCode(String taxRegimeCode) { + this.taxRegimeCode = taxRegimeCode; + } + + public String getZipCode() { + return zipCode; + } + + public void setZipCode(String zipCode) { + this.zipCode = zipCode; + } +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/localTaxes/LocalTax.java b/src/main/java/com/fiscalapi/models/invoicing/localTaxes/LocalTax.java new file mode 100644 index 0000000..95d9039 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/localTaxes/LocalTax.java @@ -0,0 +1,44 @@ +package com.fiscalapi.models.invoicing.localTaxes; + +import com.fiscalapi.OptUtil; + +import java.math.BigDecimal; + +public class LocalTax { + private String taxName; + private BigDecimal taxRate; + private String taxFlagCode; + private BigDecimal taxAmount; + + public String getTaxName() { + return taxName; + } + + public void setTaxName(String taxName) { + this.taxName = taxName; + } + + public BigDecimal getTaxRate() { + return taxRate; + } + + public void setTaxRate(String taxRate) { + this.taxRate = OptUtil.parseBigDecimal(taxRate); + } + + public String getTaxFlagCode() { + return taxFlagCode; + } + + public void setTaxFlagCode(String taxFlagCode) { + this.taxFlagCode = taxFlagCode; + } + + public BigDecimal getTaxAmount() { + return taxAmount; + } + + public void setTaxAmount(String taxAmount) { + this.taxAmount = OptUtil.parseBigDecimal(taxAmount); + } +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/localTaxes/LocalTaxes.java b/src/main/java/com/fiscalapi/models/invoicing/localTaxes/LocalTaxes.java new file mode 100644 index 0000000..d96df70 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/localTaxes/LocalTaxes.java @@ -0,0 +1,15 @@ +package com.fiscalapi.models.invoicing.localTaxes; + +import java.util.List; + +public class LocalTaxes { + private List taxes; + + public List getTaxes() { + return taxes; + } + + public void setTaxes(List taxes) { + this.taxes = taxes; + } +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/InvoicePayment.java b/src/main/java/com/fiscalapi/models/invoicing/paymentComplement/InvoicePayment.java similarity index 70% rename from src/main/java/com/fiscalapi/models/invoicing/InvoicePayment.java rename to src/main/java/com/fiscalapi/models/invoicing/paymentComplement/InvoicePayment.java index 14bcb4d..075341b 100644 --- a/src/main/java/com/fiscalapi/models/invoicing/InvoicePayment.java +++ b/src/main/java/com/fiscalapi/models/invoicing/paymentComplement/InvoicePayment.java @@ -1,14 +1,13 @@ -package com.fiscalapi.models.invoicing; +package com.fiscalapi.models.invoicing.paymentComplement; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fiscalapi.OptUtil; +import java.math.BigDecimal; import java.time.LocalDateTime; -import java.time.ZonedDateTime; -import java.time.format.DateTimeParseException; import java.util.List; -import static com.fiscalapi.models.invoicing.InvoiceConstants.SAT_DATE_FORMAT_IN; import static com.fiscalapi.models.invoicing.InvoiceConstants.SAT_DATE_FORMAT_OUT; @@ -18,8 +17,8 @@ public class InvoicePayment { private LocalDateTime paymentDate; private String paymentFormCode; private String currencyCode; - private Double exchangeRate; - private Double amount; + private BigDecimal exchangeRate; + private BigDecimal amount; private String sourceBankTin; private String sourceBankAccount; private String targetBankTin; @@ -67,25 +66,15 @@ public String getSatDate() { */ @JsonProperty("paymentDate") public void setSatDate(String satDate) { - if (satDate == null || satDate.isEmpty()) { - this.paymentDate = null; - return; - } + this.paymentDate = OptUtil.formatInputDateToSATFormat(satDate); + } - try { - // Intenta primero parsearlo como LocalDateTime - this.paymentDate = LocalDateTime.parse(satDate, SAT_DATE_FORMAT_IN); - } catch (DateTimeParseException e) { - try { - // Si falla, intenta parsearlo como ZonedDateTime y convertirlo a LocalDateTime - ZonedDateTime zdt = ZonedDateTime.parse(satDate); - this.paymentDate = zdt.toLocalDateTime(); - } catch (DateTimeParseException e2) { - // Si todo falla, lanza la excepción original - throw new IllegalArgumentException("Formato de fecha inválido: " + satDate + - " (debe ser compatible con el formato yyyy-MM-ddTHH:mm:ss)", e); - } - } + @JsonIgnore + /** + * @param date Fecha y hora de expedición como String en formato SAT + */ + public void setPaymentDate(String date) { + this.paymentDate = OptUtil.formatInputDateToSATFormat(date); } @@ -102,17 +91,17 @@ public String getCurrencyCode() { public void setCurrencyCode(String currencyCode) { this.currencyCode = currencyCode; } - public Double getExchangeRate() { + public BigDecimal getExchangeRate() { return exchangeRate; } - public void setExchangeRate(Double exchangeRate) { - this.exchangeRate = exchangeRate; + public void setExchangeRate(String exchangeRate) { + this.exchangeRate = OptUtil.parseBigDecimal(exchangeRate); } - public Double getAmount() { + public BigDecimal getAmount() { return amount; } - public void setAmount(Double amount) { - this.amount = amount; + public void setAmount(String amount) { + this.amount = OptUtil.parseBigDecimal(amount); } public String getSourceBankTin() { return sourceBankTin; diff --git a/src/main/java/com/fiscalapi/models/invoicing/PaidInvoice.java b/src/main/java/com/fiscalapi/models/invoicing/paymentComplement/PaidInvoice.java similarity index 60% rename from src/main/java/com/fiscalapi/models/invoicing/PaidInvoice.java rename to src/main/java/com/fiscalapi/models/invoicing/paymentComplement/PaidInvoice.java index 36ad23e..cc2df44 100644 --- a/src/main/java/com/fiscalapi/models/invoicing/PaidInvoice.java +++ b/src/main/java/com/fiscalapi/models/invoicing/paymentComplement/PaidInvoice.java @@ -1,20 +1,23 @@ -package com.fiscalapi.models.invoicing; +package com.fiscalapi.models.invoicing.paymentComplement; +import com.fiscalapi.OptUtil; + +import java.math.BigDecimal; import java.util.List; // Factura pagada parcial o totalmente public class PaidInvoice { private String uuid; private String series; - private Double paymentAmount; + private BigDecimal paymentAmount; private String number; private String currencyCode; private Integer partialityNumber; - private Double subTotal; - private Double previousBalance; - private Double remainingBalance; + private BigDecimal subTotal; + private BigDecimal previousBalance; + private BigDecimal remainingBalance; private String taxObjectCode; - private Double equivalence; + private BigDecimal equivalence; private List paidInvoiceTaxes; public String getUuid() { @@ -29,11 +32,11 @@ public String getSeries() { public void setSeries(String series) { this.series = series; } - public Double getPaymentAmount() { + public BigDecimal getPaymentAmount() { return paymentAmount; } - public void setPaymentAmount(Double amount) { - this.paymentAmount = amount; + public void setPaymentAmount(String amount) { + this.paymentAmount = OptUtil.parseBigDecimal(amount); } public String getNumber() { return number; @@ -53,23 +56,23 @@ public Integer getPartialityNumber() { public void setPartialityNumber(Integer partialityNumber) { this.partialityNumber = partialityNumber; } - public Double getSubTotal() { + public BigDecimal getSubTotal() { return subTotal; } - public void setSubTotal(Double subTotal) { - this.subTotal = subTotal; + public void setSubTotal(String subTotal) { + this.subTotal = OptUtil.parseBigDecimal(subTotal); } - public Double getPreviousBalance() { + public BigDecimal getPreviousBalance() { return previousBalance; } - public void setPreviousBalance(Double previousBalance) { - this.previousBalance = previousBalance; + public void setPreviousBalance(String previousBalance) { + this.previousBalance = OptUtil.parseBigDecimal(previousBalance); } - public Double getRemainingBalance() { + public BigDecimal getRemainingBalance() { return remainingBalance; } - public void setRemainingBalance(Double remainingBalance) { - this.remainingBalance = remainingBalance; + public void setRemainingBalance(String remainingBalance) { + this.remainingBalance = OptUtil.parseBigDecimal(remainingBalance); } public String getTaxObjectCode() { return taxObjectCode; @@ -77,11 +80,11 @@ public String getTaxObjectCode() { public void setTaxObjectCode(String taxObjectCode) { this.taxObjectCode = taxObjectCode; } - public Double getEquivalence() { + public BigDecimal getEquivalence() { return equivalence; } - public void setEquivalence(Double equivalence) { - this.equivalence = equivalence; + public void setEquivalence(String equivalence) { + this.equivalence = OptUtil.parseBigDecimal(equivalence); } public List getPaidInvoiceTaxes() { return paidInvoiceTaxes; diff --git a/src/main/java/com/fiscalapi/models/invoicing/PaidInvoiceTax.java b/src/main/java/com/fiscalapi/models/invoicing/paymentComplement/PaidInvoiceTax.java similarity index 74% rename from src/main/java/com/fiscalapi/models/invoicing/PaidInvoiceTax.java rename to src/main/java/com/fiscalapi/models/invoicing/paymentComplement/PaidInvoiceTax.java index 488d39d..cab4568 100644 --- a/src/main/java/com/fiscalapi/models/invoicing/PaidInvoiceTax.java +++ b/src/main/java/com/fiscalapi/models/invoicing/paymentComplement/PaidInvoiceTax.java @@ -1,20 +1,22 @@ -package com.fiscalapi.models.invoicing; +package com.fiscalapi.models.invoicing.paymentComplement; + +import com.fiscalapi.OptUtil; import java.math.BigDecimal; // Impuestos aplicables a la factura pagada public class PaidInvoiceTax { - private Double base; + private BigDecimal base; private String taxCode; private String taxTypeCode; private BigDecimal taxRate; private String taxFlagCode; - public Double getBase() { + public BigDecimal getBase() { return base; } - public void setBase(Double base) { - this.base = base; + public void setBase(String base) { + this.base = OptUtil.parseBigDecimal(base); } public String getTaxCode() { return taxCode; @@ -32,7 +34,7 @@ public BigDecimal getTaxRate() { return taxRate; } public void setTaxRate(String taxRate) { - this.taxRate = new BigDecimal(taxRate); + this.taxRate = OptUtil.parseBigDecimal(taxRate); } public String getTaxFlagCode() { return taxFlagCode; diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/BalanceCompensation.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/BalanceCompensation.java new file mode 100644 index 0000000..0c1df2a --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/BalanceCompensation.java @@ -0,0 +1,34 @@ +package com.fiscalapi.models.invoicing.payroll; + +import com.fiscalapi.common.CatalogDto; +import java.math.BigDecimal; + +public class BalanceCompensation extends CatalogDto { + private BigDecimal favorableBalance; + private int year; + private BigDecimal remainingFavorableBalance; + + public BigDecimal getRemainingFavorableBalance() { + return remainingFavorableBalance; + } + + public void setRemainingFavorableBalance(BigDecimal remainingFavorableBalance) { + this.remainingFavorableBalance = remainingFavorableBalance; + } + + public int getYear() { + return year; + } + + public void setYear(int year) { + this.year = year; + } + + public BigDecimal getFavorableBalance() { + return favorableBalance; + } + + public void setFavorableBalance(BigDecimal favorableBalance) { + this.favorableBalance = favorableBalance; + } +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/EmployeeData.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/EmployeeData.java new file mode 100644 index 0000000..c130f2a --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/EmployeeData.java @@ -0,0 +1,288 @@ +package com.fiscalapi.models.invoicing.payroll; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fiscalapi.OptUtil; +import com.fiscalapi.common.CatalogDto; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import static com.fiscalapi.models.invoicing.InvoiceConstants.SAT_DATE_FORMAT_OUT; + +public class EmployeeData { + private String curp; + private String employerPersonId; + private String employeePersonId; + private String employeeNumber; + private String socialSecurityNumber; + private LocalDateTime laborRelationStartDate; + private CatalogDto satContractType; + private CatalogDto satTaxRegimeType; + private CatalogDto satWorkdayType; + private CatalogDto satJobRisk; + private CatalogDto satPaymentPeriodicity; + private CatalogDto satBank; + private CatalogDto satPayrollState; + private CatalogDto satUnionizedStatus; + private String department; + private String position; + private String seniority; + private String satUnionizedStatusId; + private String satContractTypeId; + private String satWorkdayTypeId; + private String satTaxRegimeTypeId; + private String satJobRiskId; + private String satPaymentPeriodicityId; + private String satBankId; + private String satPayrollStateId; + private String bankAccount; + private BigDecimal baseSalaryForContributions; + private BigDecimal integratedDailySalary; + private String subcontractorRfc; + private BigDecimal timePercentage; + + public String getCurp() { + return curp; + } + + public void setCurp(String curp) { + this.curp = curp; + } + + public String getEmployerPersonId() { + return employerPersonId; + } + + public void setEmployerPersonId(String employerPersonId) { + this.employerPersonId = employerPersonId; + } + + public String getEmployeePersonId() { + return employeePersonId; + } + + public void setEmployeePersonId(String employeePersonId) { + this.employeePersonId = employeePersonId; + } + + public String getEmployeeNumber() { + return employeeNumber; + } + + public void setEmployeeNumber(String employeeNumber) { + this.employeeNumber = employeeNumber; + } + + public String getSocialSecurityNumber() { + return socialSecurityNumber; + } + + public void setSocialSecurityNumber(String socialSecurityNumber) { + this.socialSecurityNumber = socialSecurityNumber; + } + + @JsonProperty("laborRelationStartDate") + public String getLaborRelationStartDate() { + if (laborRelationStartDate == null) { + return null; + } + return laborRelationStartDate.format(SAT_DATE_FORMAT_OUT); + } + + @JsonProperty("laborRelationStartDate") + public void setLaborRelationStartDate(String laborRelationStartDate) { + this.laborRelationStartDate = OptUtil.formatInputDateToSATFormat(laborRelationStartDate); + } + + public CatalogDto getSatContractType() { + return satContractType; + } + + public void setSatContractType(CatalogDto satContractType) { + this.satContractType = satContractType; + } + + public CatalogDto getSatTaxRegimeType() { + return satTaxRegimeType; + } + + public void setSatTaxRegimeType(CatalogDto satTaxRegimeType) { + this.satTaxRegimeType = satTaxRegimeType; + } + + public CatalogDto getSatWorkdayType() { + return satWorkdayType; + } + + public void setSatWorkdayType(CatalogDto satWorkdayType) { + this.satWorkdayType = satWorkdayType; + } + + public CatalogDto getSatJobRisk() { + return satJobRisk; + } + + public void setSatJobRisk(CatalogDto satJobRisk) { + this.satJobRisk = satJobRisk; + } + + public CatalogDto getSatPaymentPeriodicity() { + return satPaymentPeriodicity; + } + + public void setSatPaymentPeriodicity(CatalogDto satPaymentPeriodicity) { + this.satPaymentPeriodicity = satPaymentPeriodicity; + } + + public CatalogDto getSatBank() { + return satBank; + } + + public void setSatBank(CatalogDto satBank) { + this.satBank = satBank; + } + + public CatalogDto getSatPayrollState() { + return satPayrollState; + } + + public void setSatPayrollState(CatalogDto satPayrollState) { + this.satPayrollState = satPayrollState; + } + + public CatalogDto getSatUnionizedStatus() { + return satUnionizedStatus; + } + + public void setSatUnionizedStatus(CatalogDto satUnionizedStatus) { + this.satUnionizedStatus = satUnionizedStatus; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getSeniority() { + return seniority; + } + + public void setSeniority(String seniority) { + this.seniority = seniority; + } + + public String getSatUnionizedStatusId() { + return satUnionizedStatusId; + } + + public void setSatUnionizedStatusId(String satUnionizedStatusId) { + this.satUnionizedStatusId = satUnionizedStatusId; + } + + public String getSatContractTypeId() { + return satContractTypeId; + } + + public void setSatContractTypeId(String satContractTypeId) { + this.satContractTypeId = satContractTypeId; + } + + public String getSatWorkdayTypeId() { + return satWorkdayTypeId; + } + + public void setSatWorkdayTypeId(String satWorkdayTypeId) { + this.satWorkdayTypeId = satWorkdayTypeId; + } + + public String getSatTaxRegimeTypeId() { + return satTaxRegimeTypeId; + } + + public void setSatTaxRegimeTypeId(String satTaxRegimeTypeId) { + this.satTaxRegimeTypeId = satTaxRegimeTypeId; + } + + public String getSatJobRiskId() { + return satJobRiskId; + } + + public void setSatJobRiskId(String satJobRiskId) { + this.satJobRiskId = satJobRiskId; + } + + public String getSatPaymentPeriodicityId() { + return satPaymentPeriodicityId; + } + + public void setSatPaymentPeriodicityId(String satPaymentPeriodicityId) { + this.satPaymentPeriodicityId = satPaymentPeriodicityId; + } + + public String getSatBankId() { + return satBankId; + } + + public void setSatBankId(String satBankId) { + this.satBankId = satBankId; + } + + public String getSatPayrollStateId() { + return satPayrollStateId; + } + + public void setSatPayrollStateId(String satPayrollStateId) { + this.satPayrollStateId = satPayrollStateId; + } + + public String getBankAccount() { + return bankAccount; + } + + public void setBankAccount(String bankAccount) { + this.bankAccount = bankAccount; + } + + public BigDecimal getBaseSalaryForContributions() { + return baseSalaryForContributions; + } + + public void setBaseSalaryForContributions(String baseSalaryForContributions) { + this.baseSalaryForContributions = OptUtil.parseBigDecimal(baseSalaryForContributions); + } + + public BigDecimal getIntegratedDailySalary() { + return integratedDailySalary; + } + + public void setIntegratedDailySalary(String integratedDailySalary) { + this.integratedDailySalary = OptUtil.parseBigDecimal(integratedDailySalary); + } + + public String getSubcontractorRfc() { + return subcontractorRfc; + } + + public void setSubcontractorRfc(String subcontractorRfc) { + this.subcontractorRfc = subcontractorRfc; + } + + public BigDecimal getTimePercentage() { + return timePercentage; + } + + public void setTimePercentage(BigDecimal timePercentage) { + this.timePercentage = timePercentage; + } +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/EmployerData.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/EmployerData.java new file mode 100644 index 0000000..c795f54 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/EmployerData.java @@ -0,0 +1,61 @@ +package com.fiscalapi.models.invoicing.payroll; + +import com.fiscalapi.common.CatalogDto; +import java.math.BigDecimal; + +public class EmployerData { + private String personId; + private String employerRegistration; + private CatalogDto satFundSource; + private String satFundSourceId; + private BigDecimal ownResourceAmount; + private String originEmployerTin; + + public void setPersonId(String personId) { + this.personId = personId; + } + + public void setEmployerRegistration(String employerRegistration) { + this.employerRegistration = employerRegistration; + } + + public void setSatFundSourceId(String satFundSourceId) { + this.satFundSourceId = satFundSourceId; + } + + public void setOwnResourceAmount(BigDecimal ownResourceAmount) { + this.ownResourceAmount = ownResourceAmount; + } + + public String getPersonId() { + return personId; + } + + public String getEmployerRegistration() { + return employerRegistration; + } + + public CatalogDto getSatFundSource() { + return satFundSource; + } + + public String getSatFundSourceId() { + return satFundSourceId; + } + + public BigDecimal getOwnResourceAmount() { + return ownResourceAmount; + } + + public void setSatFundSource(CatalogDto satFundSource) { + this.satFundSource = satFundSource; + } + + public String getOriginEmployerTin() { + return originEmployerTin; + } + + public void setOriginEmployerTin(String originEmployerTin) { + this.originEmployerTin = originEmployerTin; + } +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/Payroll.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/Payroll.java new file mode 100644 index 0000000..292dc80 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/Payroll.java @@ -0,0 +1,105 @@ +package com.fiscalapi.models.invoicing.payroll; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fiscalapi.OptUtil; + +import java.time.LocalDateTime; +import java.util.List; + +import static com.fiscalapi.models.invoicing.InvoiceConstants.SAT_DATE_FORMAT_OUT; + +public class Payroll { + private String version; + private String payrollTypeCode; + private LocalDateTime paymentDate; + private LocalDateTime initialPaymentDate; + private LocalDateTime finalPaymentDate; + private int daysPaid; + private PayrollEarnings earnings; + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getPayrollTypeCode() { + return payrollTypeCode; + } + + public void setPayrollTypeCode(String payrollTypeCode) { + this.payrollTypeCode = payrollTypeCode; + } + + @JsonProperty("paymentDate") + public String getPaymentDate() { + if (paymentDate == null) { + return null; + } + return paymentDate.format(SAT_DATE_FORMAT_OUT); + } + + @JsonProperty("paymentDate") + public void setPaymentDate(String paymentDate) { + this.paymentDate = OptUtil.formatInputDateToSATFormat(paymentDate); + } + + public String getInitialPaymentDate() { + if (initialPaymentDate == null) { + return null; + } + return initialPaymentDate.format(SAT_DATE_FORMAT_OUT); + } + + public void setInitialPaymentDate(String initialPaymentDate) { + this.initialPaymentDate = OptUtil.formatInputDateToSATFormat(initialPaymentDate); + } + + public String getFinalPaymentDate() { + if (finalPaymentDate == null) { + return null; + } + return finalPaymentDate.format(SAT_DATE_FORMAT_OUT); + } + + public void setFinalPaymentDate(String finalPaymentDate) { + this.finalPaymentDate = OptUtil.formatInputDateToSATFormat(finalPaymentDate); + } + + public int getDaysPaid() { + return daysPaid; + } + + public void setDaysPaid(int daysPaid) { + this.daysPaid = daysPaid; + } + + public PayrollEarnings getEarnings() { + return earnings; + } + + public void setEarnings(PayrollEarnings earnings) { + this.earnings = earnings; + } + + public List getDeductions() { + return deductions; + } + + public void setDeductions(List deductions) { + this.deductions = deductions; + } + + public List getDisabilities() { + return disabilities; + } + + public void setDisabilities(List disabilities) { + this.disabilities = disabilities; + } + + private List deductions; + private List disabilities; +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollDeduction.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollDeduction.java new file mode 100644 index 0000000..1b0a2a9 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollDeduction.java @@ -0,0 +1,44 @@ +package com.fiscalapi.models.invoicing.payroll; + +import com.fiscalapi.OptUtil; + +import java.math.BigDecimal; + +public class PayrollDeduction { + private String deductionTypeCode; + private String code; + private String concept; + private BigDecimal amount; + + public String getDeductionTypeCode() { + return deductionTypeCode; + } + + public void setDeductionTypeCode(String deductionTypeCode) { + this.deductionTypeCode = deductionTypeCode; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getConcept() { + return concept; + } + + public void setConcept(String concept) { + this.concept = concept; + } + + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(String amount) { + this.amount = OptUtil.parseBigDecimal(amount); + } +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollDisability.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollDisability.java new file mode 100644 index 0000000..c964565 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollDisability.java @@ -0,0 +1,33 @@ +package com.fiscalapi.models.invoicing.payroll; + +import java.math.BigDecimal; + +public class PayrollDisability { + private int DisabilityDays; + private String DisabilityTypeCode; + private BigDecimal MonetaryAmount; + + public int getDisabilityDays() { + return DisabilityDays; + } + + public void setDisabilityDays(int disabilityDays) { + DisabilityDays = disabilityDays; + } + + public String getDisabilityTypeCode() { + return DisabilityTypeCode; + } + + public void setDisabilityTypeCode(String disabilityTypeCode) { + DisabilityTypeCode = disabilityTypeCode; + } + + public BigDecimal getMonetaryAmount() { + return MonetaryAmount; + } + + public void setMonetaryAmount(BigDecimal monetaryAmount) { + MonetaryAmount = monetaryAmount; + } +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollEarning.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollEarning.java new file mode 100644 index 0000000..0c3204b --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollEarning.java @@ -0,0 +1,71 @@ +package com.fiscalapi.models.invoicing.payroll; + +import java.math.BigDecimal; +import java.util.List; + +public class PayrollEarning { + private String earningTypeCode; + private String code; + + public String getEarningTypeCode() { + return earningTypeCode; + } + + public void setEarningTypeCode(String earningTypeCode) { + this.earningTypeCode = earningTypeCode; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getConcept() { + return concept; + } + + public void setConcept(String concept) { + this.concept = concept; + } + + public BigDecimal getTaxedAmount() { + return taxedAmount; + } + + public void setTaxedAmount(BigDecimal taxedAmount) { + this.taxedAmount = taxedAmount; + } + + public BigDecimal getExemptAmount() { + return exemptAmount; + } + + public void setExemptAmount(BigDecimal exemptAmount) { + this.exemptAmount = exemptAmount; + } + + public List getOvertime() { + return overtime; + } + + public void setOvertime(List overtime) { + this.overtime = overtime; + } + + public PayrollStockOptions getStockOptions() { + return stockOptions; + } + + public void setStockOptions(PayrollStockOptions stockOptions) { + this.stockOptions = stockOptions; + } + + private String concept; + private BigDecimal taxedAmount; + private BigDecimal exemptAmount; + private List overtime; + private PayrollStockOptions stockOptions; +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollEarningOtherPayment.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollEarningOtherPayment.java new file mode 100644 index 0000000..3039eb0 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollEarningOtherPayment.java @@ -0,0 +1,61 @@ +package com.fiscalapi.models.invoicing.payroll; + +import java.math.BigDecimal; + +public class PayrollEarningOtherPayment { + private String otherPaymentTypeCode; + private String code; + private String concept; + private BigDecimal amount; + private BigDecimal subsidyCaused; + + public String getOtherPaymentTypeCode() { + return otherPaymentTypeCode; + } + + public void setOtherPaymentTypeCode(String otherPaymentTypeCode) { + this.otherPaymentTypeCode = otherPaymentTypeCode; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getConcept() { + return concept; + } + + public void setConcept(String concept) { + this.concept = concept; + } + + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public BigDecimal getSubsidyCaused() { + return subsidyCaused; + } + + public void setSubsidyCaused(BigDecimal subsidyCaused) { + this.subsidyCaused = subsidyCaused; + } + + public BalanceCompensation getBalanceCompensation() { + return balanceCompensation; + } + + public void setBalanceCompensation(BalanceCompensation balanceCompensation) { + this.balanceCompensation = balanceCompensation; + } + + private BalanceCompensation balanceCompensation; +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollEarningOvertime.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollEarningOvertime.java new file mode 100644 index 0000000..409eb13 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollEarningOvertime.java @@ -0,0 +1,43 @@ +package com.fiscalapi.models.invoicing.payroll; + +import java.math.BigDecimal; + +public class PayrollEarningOvertime { + private int days; + private String hoursTypeCode; + private int extraHours; + + public int getDays() { + return days; + } + + public void setDays(int days) { + this.days = days; + } + + public String getHoursTypeCode() { + return hoursTypeCode; + } + + public void setHoursTypeCode(String hoursTypeCode) { + this.hoursTypeCode = hoursTypeCode; + } + + public int getExtraHours() { + return extraHours; + } + + public void setExtraHours(int extraHours) { + this.extraHours = extraHours; + } + + public BigDecimal getAmountPaid() { + return amountPaid; + } + + public void setAmountPaid(BigDecimal amountPaid) { + this.amountPaid = amountPaid; + } + + private BigDecimal amountPaid; +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollEarnings.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollEarnings.java new file mode 100644 index 0000000..602c404 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollEarnings.java @@ -0,0 +1,43 @@ +package com.fiscalapi.models.invoicing.payroll; + +import java.util.List; + +public class PayrollEarnings { + private List earnings; + private List otherPayments; + private PayrollRetirement retirement; + private PayrollSeverance severance; + + + public List getEarnings() { + return earnings; + } + + public void setEarnings(List earnings) { + this.earnings = earnings; + } + + public List getOtherPayments() { + return otherPayments; + } + + public void setOtherPayments(List otherPayments) { + this.otherPayments = otherPayments; + } + + public PayrollRetirement getRetirement() { + return retirement; + } + + public void setRetirement(PayrollRetirement retirement) { + this.retirement = retirement; + } + + public PayrollSeverance getSeverance() { + return severance; + } + + public void setSeverance(PayrollSeverance severance) { + this.severance = severance; + } +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollRetirement.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollRetirement.java new file mode 100644 index 0000000..54f28be --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollRetirement.java @@ -0,0 +1,51 @@ +package com.fiscalapi.models.invoicing.payroll; + +import java.math.BigDecimal; + +public class PayrollRetirement { + private BigDecimal totalOneTime; + private BigDecimal totalInstallments; + private BigDecimal dailyAmount; + private BigDecimal accumulableIncome; + private BigDecimal nonAccumulableIncome; + + public BigDecimal getTotalOneTime() { + return totalOneTime; + } + + public void setTotalOneTime(BigDecimal totalOneTime) { + this.totalOneTime = totalOneTime; + } + + public BigDecimal getTotalInstallments() { + return totalInstallments; + } + + public void setTotalInstallments(BigDecimal totalInstallments) { + this.totalInstallments = totalInstallments; + } + + public BigDecimal getDailyAmount() { + return dailyAmount; + } + + public void setDailyAmount(BigDecimal dailyAmount) { + this.dailyAmount = dailyAmount; + } + + public BigDecimal getAccumulableIncome() { + return accumulableIncome; + } + + public void setAccumulableIncome(BigDecimal accumulableIncome) { + this.accumulableIncome = accumulableIncome; + } + + public BigDecimal getNonAccumulableIncome() { + return nonAccumulableIncome; + } + + public void setNonAccumulableIncome(BigDecimal nonAccumulableIncome) { + this.nonAccumulableIncome = nonAccumulableIncome; + } +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollSeverance.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollSeverance.java new file mode 100644 index 0000000..a082d45 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollSeverance.java @@ -0,0 +1,51 @@ +package com.fiscalapi.models.invoicing.payroll; + +import java.math.BigDecimal; + +public class PayrollSeverance { + private BigDecimal totalPaid; + private int yearsOfService; + private BigDecimal lastMonthlySalary; + private BigDecimal accumulableIncome; + private BigDecimal nonAccumulableIncome; + + public BigDecimal getTotalPaid() { + return totalPaid; + } + + public void setTotalPaid(BigDecimal totalPaid) { + this.totalPaid = totalPaid; + } + + public int getYearsOfService() { + return yearsOfService; + } + + public void setYearsOfService(int yearsOfService) { + this.yearsOfService = yearsOfService; + } + + public BigDecimal getLastMonthlySalary() { + return lastMonthlySalary; + } + + public void setLastMonthlySalary(BigDecimal lastMonthlySalary) { + this.lastMonthlySalary = lastMonthlySalary; + } + + public BigDecimal getAccumulableIncome() { + return accumulableIncome; + } + + public void setAccumulableIncome(BigDecimal accumulableIncome) { + this.accumulableIncome = accumulableIncome; + } + + public BigDecimal getNonAccumulableIncome() { + return nonAccumulableIncome; + } + + public void setNonAccumulableIncome(BigDecimal nonAccumulableIncome) { + this.nonAccumulableIncome = nonAccumulableIncome; + } +} diff --git a/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollStockOptions.java b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollStockOptions.java new file mode 100644 index 0000000..a0e0ec4 --- /dev/null +++ b/src/main/java/com/fiscalapi/models/invoicing/payroll/PayrollStockOptions.java @@ -0,0 +1,26 @@ +package com.fiscalapi.models.invoicing.payroll; + +import com.fiscalapi.OptUtil; + +import java.math.BigDecimal; + +public class PayrollStockOptions { + private BigDecimal marketPrice; + private BigDecimal grantPrice; + + public BigDecimal getMarketPrice() { + return marketPrice; + } + + public void setMarketPrice(String marketPrice) { + this.marketPrice = OptUtil.parseBigDecimal(marketPrice); + } + + public BigDecimal getGrantPrice() { + return grantPrice; + } + + public void setGrantPrice(String grantPrice) { + this.grantPrice = OptUtil.parseBigDecimal(grantPrice); + } +} diff --git a/src/main/java/com/fiscalapi/services/EmployeeService.java b/src/main/java/com/fiscalapi/services/EmployeeService.java new file mode 100644 index 0000000..013e724 --- /dev/null +++ b/src/main/java/com/fiscalapi/services/EmployeeService.java @@ -0,0 +1,42 @@ +package com.fiscalapi.services; + +import com.fiscalapi.abstractions.IEmployeeService; +import com.fiscalapi.abstractions.IFiscalApiHttpClient; +import com.fiscalapi.common.ApiResponse; +import com.fiscalapi.models.invoicing.payroll.EmployeeData; + +public class EmployeeService implements IEmployeeService { + IFiscalApiHttpClient httpClient; + private final String baseEndpoint = "api/v4/people"; + + public EmployeeService(IFiscalApiHttpClient httpClient) + { + this.httpClient = httpClient; + } + + private String buildEndpoint(String personId) { + return String.format("%s/%s/employee", baseEndpoint, personId); + } + + public ApiResponse getById(String id) { + String endpoint = buildEndpoint(id); + + return httpClient.get(endpoint, EmployeeData.class); + } + + public ApiResponse create(EmployeeData requestModel) { + String endpoint = buildEndpoint(requestModel.getEmployeePersonId()); + + return httpClient.post(endpoint, requestModel, EmployeeData.class); + } + + public ApiResponse update(EmployeeData requestModel) { + String endpoint = buildEndpoint(requestModel.getEmployeePersonId()); + + return httpClient.put(endpoint, requestModel, EmployeeData.class); + } + + public ApiResponse delete(String id) { + return httpClient.delete(buildEndpoint(id)); + } +} diff --git a/src/main/java/com/fiscalapi/services/EmployerService.java b/src/main/java/com/fiscalapi/services/EmployerService.java new file mode 100644 index 0000000..aaa1c40 --- /dev/null +++ b/src/main/java/com/fiscalapi/services/EmployerService.java @@ -0,0 +1,40 @@ +package com.fiscalapi.services; + +import com.fiscalapi.abstractions.IEmployerService; +import com.fiscalapi.abstractions.IFiscalApiHttpClient; +import com.fiscalapi.common.ApiResponse; +import com.fiscalapi.models.invoicing.payroll.EmployerData; + +public class EmployerService implements IEmployerService { + public IFiscalApiHttpClient getHttpClient() { + return httpClient; + } + + private IFiscalApiHttpClient httpClient; + private final String baseEndpoint = "api/v4/people"; + + public EmployerService(IFiscalApiHttpClient httpClient) + { + this.httpClient = httpClient; + } + + private String buildEndpoint(String personId) { + return String.format("%s/%s/employer", baseEndpoint, personId); + } + + public ApiResponse getById(String id) { + return httpClient.get(buildEndpoint(id), EmployerData.class); + } + + public ApiResponse create(EmployerData requestModel) { + return httpClient.post(buildEndpoint(requestModel.getPersonId()), requestModel, EmployerData.class); + } + + public ApiResponse update(EmployerData requestModel) { + return httpClient.put(buildEndpoint(requestModel.getPersonId()), requestModel, EmployerData.class); + } + + public ApiResponse delete(String id) { + return httpClient.delete(buildEndpoint(id)); + } +} diff --git a/src/main/java/com/fiscalapi/services/FiscalApiClient.java b/src/main/java/com/fiscalapi/services/FiscalApiClient.java index 0c6811e..6557131 100644 --- a/src/main/java/com/fiscalapi/services/FiscalApiClient.java +++ b/src/main/java/com/fiscalapi/services/FiscalApiClient.java @@ -17,6 +17,7 @@ public class FiscalApiClient implements IFiscalApiClient { private final IDownloadCatalogService downloadCatalogService; private final IDownloadRuleService downloadRuleService; private final IDownloadRequestService downloadRequestService; + private final IStampService stampService; private FiscalApiClient(FiscalApiSettings settings) { validateSettings(settings); @@ -35,6 +36,7 @@ private FiscalApiClient(FiscalApiSettings settings) { this.downloadCatalogService = new DownloadCatalogService(httpClient, settings); this.downloadRuleService = new DownloadRuleService(httpClient, settings); this.downloadRequestService = new DownloadRequestService(httpClient, settings); + this.stampService = new StampService(httpClient, settings); // ... } @@ -88,7 +90,10 @@ public IDownloadRequestService getDownloadRequestService() { return downloadRequestService; } - + @Override + public IStampService getStampService() { + return stampService; + } // etc... private void validateSettings(FiscalApiSettings settings) { diff --git a/src/main/java/com/fiscalapi/services/InvoiceService.java b/src/main/java/com/fiscalapi/services/InvoiceService.java index da2d6c8..485cfc6 100644 --- a/src/main/java/com/fiscalapi/services/InvoiceService.java +++ b/src/main/java/com/fiscalapi/services/InvoiceService.java @@ -59,25 +59,6 @@ public ApiResponse getXml(String id) { @Override public ApiResponse create(Invoice model) { - - String path =""; - - switch (model.getTypeCode()) { - case "I": - path = "income"; - break; - case "E": - path = "credit-note"; - break; - case "P": - path = "payment"; - break; - default: - throw new IllegalArgumentException("Invalid invoice type"); - } - - String endpoint = buildEndpoint(path, null); - return httpClient.post(endpoint, model, Invoice.class); - + return httpClient.post(buildEndpoint("", null), model, Invoice.class); } } \ No newline at end of file diff --git a/src/main/java/com/fiscalapi/services/PersonService.java b/src/main/java/com/fiscalapi/services/PersonService.java index 7a77a63..ca46412 100644 --- a/src/main/java/com/fiscalapi/services/PersonService.java +++ b/src/main/java/com/fiscalapi/services/PersonService.java @@ -10,6 +10,8 @@ * Implementa el servicio de "Person", usando la lógica base de BaseFiscalApiService. */ public class PersonService extends BaseFiscalApiService implements IPersonService { + private final EmployerService employerService; + private final EmployeeService employeeService; /** * Crea un PersonService con el path "people" y la versión de API dada. @@ -18,6 +20,8 @@ public class PersonService extends BaseFiscalApiService implements IPers */ public PersonService(IFiscalApiHttpClient httpClient, FiscalApiSettings settings) { super(httpClient, settings, "people", settings.getApiVersion()); + employerService = new EmployerService(httpClient); + employeeService = new EmployeeService(httpClient); } @Override @@ -25,4 +29,14 @@ protected Class getTypeParameterClass() { return Person.class; } -} \ No newline at end of file + @Override + public EmployerService getEmployerService() { + return employerService; + } + + @Override + public EmployeeService getEmployeeService() { + return employeeService; + } +} + diff --git a/src/main/java/com/fiscalapi/services/StampService.java b/src/main/java/com/fiscalapi/services/StampService.java new file mode 100644 index 0000000..9c2dffd --- /dev/null +++ b/src/main/java/com/fiscalapi/services/StampService.java @@ -0,0 +1,30 @@ +package com.fiscalapi.services; + +import com.fiscalapi.abstractions.BaseFiscalApiService; +import com.fiscalapi.abstractions.IFiscalApiHttpClient; +import com.fiscalapi.abstractions.IStampService; +import com.fiscalapi.common.ApiResponse; +import com.fiscalapi.common.FiscalApiSettings; +import com.fiscalapi.models.StampTransaction; +import com.fiscalapi.models.StampTransactionParams; + +public class StampService extends BaseFiscalApiService implements IStampService { + public StampService(IFiscalApiHttpClient httpClient, FiscalApiSettings settings) { + super(httpClient, settings, "stamps", settings.getApiVersion()); + } + + @Override + protected Class getTypeParameterClass() { + return StampTransaction.class; + } + + @Override + public ApiResponse transferStamps(StampTransactionParams requestModel) { + return httpClient.post(buildEndpoint("", null), requestModel, Boolean.class); + } + + @Override + public ApiResponse withdrawStamps(StampTransactionParams requestModel) { + return httpClient.post(buildEndpoint("", null), requestModel, Boolean.class); + } +}