From 7a0ef927c59de1056e0a1ac3c41a5d6346fe91cb Mon Sep 17 00:00:00 2001 From: Jose Antonio Medina Date: Thu, 26 Feb 2026 20:42:25 -0600 Subject: [PATCH 1/7] Updated interfaces --- src/Services/EmployeeServiceInterface.php | 47 +++++++++++++++++++++++ src/Services/EmployerServiceInterface.php | 47 +++++++++++++++++++++++ src/Services/FiscalApiClientInterface.php | 7 +++- 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 src/Services/EmployeeServiceInterface.php create mode 100644 src/Services/EmployerServiceInterface.php diff --git a/src/Services/EmployeeServiceInterface.php b/src/Services/EmployeeServiceInterface.php new file mode 100644 index 0000000..1c57849 --- /dev/null +++ b/src/Services/EmployeeServiceInterface.php @@ -0,0 +1,47 @@ + Date: Thu, 26 Feb 2026 20:43:31 -0600 Subject: [PATCH 2/7] Added interfaces --- src/Services/InvoiceServiceInterface.php | 2 +- src/Services/PersonServiceInterface.php | 14 +++++++++ src/Services/StampServiceInterface.php | 37 ++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/Services/StampServiceInterface.php diff --git a/src/Services/InvoiceServiceInterface.php b/src/Services/InvoiceServiceInterface.php index 8c36693..f646dfc 100644 --- a/src/Services/InvoiceServiceInterface.php +++ b/src/Services/InvoiceServiceInterface.php @@ -11,7 +11,7 @@ interface InvoiceServiceInterface extends FiscalApiServiceInterface { /** - * Crea una nueva factura, nota de crédito o complemento de pago + * Crea una nueva factura, nota de crédito, complemento de pago o nómina. * * @param array $data Datos de la factura * @return FiscalApiHttpResponseInterface diff --git a/src/Services/PersonServiceInterface.php b/src/Services/PersonServiceInterface.php index 43b8225..0e4b0c6 100644 --- a/src/Services/PersonServiceInterface.php +++ b/src/Services/PersonServiceInterface.php @@ -11,6 +11,20 @@ */ interface PersonServiceInterface extends FiscalApiServiceInterface { + /** + * Obtiene el sub-servicio de datos de empleado. + * + * @return EmployeeServiceInterface + */ + public function getEmployeeService(): EmployeeServiceInterface; + + /** + * Obtiene el sub-servicio de datos de empleador (patrón). + * + * @return EmployerServiceInterface + */ + public function getEmployerService(): EmployerServiceInterface; + /** * Obtiene una lista de personas * diff --git a/src/Services/StampServiceInterface.php b/src/Services/StampServiceInterface.php new file mode 100644 index 0000000..e6a100c --- /dev/null +++ b/src/Services/StampServiceInterface.php @@ -0,0 +1,37 @@ + Date: Thu, 26 Feb 2026 20:44:27 -0600 Subject: [PATCH 3/7] Updated services --- src/Services/EmployeeService.php | 103 +++++++++++++++++++++++++++++++ src/Services/EmployerService.php | 103 +++++++++++++++++++++++++++++++ src/Services/InvoiceService.php | 27 +------- src/Services/PersonService.php | 21 +++++++ src/Services/StampService.php | 75 ++++++++++++++++++++++ 5 files changed, 304 insertions(+), 25 deletions(-) create mode 100644 src/Services/EmployeeService.php create mode 100644 src/Services/EmployerService.php create mode 100644 src/Services/StampService.php diff --git a/src/Services/EmployeeService.php b/src/Services/EmployeeService.php new file mode 100644 index 0000000..64ec5d3 --- /dev/null +++ b/src/Services/EmployeeService.php @@ -0,0 +1,103 @@ +httpClient = $httpClient; + } + + /** + * {@inheritdoc} + */ + public function get(string $personId): FiscalApiHttpResponseInterface + { + $this->validatePersonId($personId); + + return $this->httpClient->get($this->buildSubResourceUrl($personId)); + } + + /** + * {@inheritdoc} + */ + public function create(string $personId, array $data): FiscalApiHttpResponseInterface + { + $this->validatePersonId($personId); + + return $this->httpClient->post( + $this->buildSubResourceUrl($personId), + [ + 'data' => $data + ] + ); + } + + /** + * {@inheritdoc} + */ + public function update(string $personId, array $data): FiscalApiHttpResponseInterface + { + $this->validatePersonId($personId); + + return $this->httpClient->put( + $this->buildSubResourceUrl($personId), + [ + 'data' => $data + ] + ); + } + + /** + * {@inheritdoc} + */ + public function delete(string $personId): FiscalApiHttpResponseInterface + { + $this->validatePersonId($personId); + + return $this->httpClient->delete($this->buildSubResourceUrl($personId)); + } + + /** + * Construye la URL del sub-recurso: /people/{personId}/employee + * + * @param string $personId ID de la persona + * @return string + */ + protected function buildSubResourceUrl(string $personId): string + { + return '/' . $this->resourcePath . '/' . urlencode($personId) . '/' . $this->subResourcePath; + } + + /** + * Valida que el ID de la persona no esté vacío + * + * @param string $personId ID de la persona + * @throws InvalidArgumentException + */ + protected function validatePersonId(string $personId): void + { + if (empty(trim($personId))) { + throw new InvalidArgumentException('El ID de la persona es obligatorio'); + } + } +} diff --git a/src/Services/EmployerService.php b/src/Services/EmployerService.php new file mode 100644 index 0000000..7972811 --- /dev/null +++ b/src/Services/EmployerService.php @@ -0,0 +1,103 @@ +httpClient = $httpClient; + } + + /** + * {@inheritdoc} + */ + public function get(string $personId): FiscalApiHttpResponseInterface + { + $this->validatePersonId($personId); + + return $this->httpClient->get($this->buildSubResourceUrl($personId)); + } + + /** + * {@inheritdoc} + */ + public function create(string $personId, array $data): FiscalApiHttpResponseInterface + { + $this->validatePersonId($personId); + + return $this->httpClient->post( + $this->buildSubResourceUrl($personId), + [ + 'data' => $data + ] + ); + } + + /** + * {@inheritdoc} + */ + public function update(string $personId, array $data): FiscalApiHttpResponseInterface + { + $this->validatePersonId($personId); + + return $this->httpClient->put( + $this->buildSubResourceUrl($personId), + [ + 'data' => $data + ] + ); + } + + /** + * {@inheritdoc} + */ + public function delete(string $personId): FiscalApiHttpResponseInterface + { + $this->validatePersonId($personId); + + return $this->httpClient->delete($this->buildSubResourceUrl($personId)); + } + + /** + * Construye la URL del sub-recurso: /people/{personId}/employer + * + * @param string $personId ID de la persona + * @return string + */ + protected function buildSubResourceUrl(string $personId): string + { + return '/' . $this->resourcePath . '/' . urlencode($personId) . '/' . $this->subResourcePath; + } + + /** + * Valida que el ID de la persona no esté vacío + * + * @param string $personId ID de la persona + * @throws InvalidArgumentException + */ + protected function validatePersonId(string $personId): void + { + if (empty(trim($personId))) { + throw new InvalidArgumentException('El ID de la persona es obligatorio'); + } + } +} diff --git a/src/Services/InvoiceService.php b/src/Services/InvoiceService.php index d298b1d..239feb3 100644 --- a/src/Services/InvoiceService.php +++ b/src/Services/InvoiceService.php @@ -12,10 +12,6 @@ */ class InvoiceService extends AbstractService implements InvoiceServiceInterface { - private const INCOME_ENDPOINT = 'income'; - private const CREDIT_NOTE_ENDPOINT = 'credit-note'; - private const PAYMENT_ENDPOINT = 'payment'; - /** * Constructor del servicio de facturas * @@ -27,33 +23,14 @@ public function __construct(FiscalApiHttpClientInterface $httpClient) } - + /** * {@inheritdoc} */ public function create(array $data): FiscalApiHttpResponseInterface { - if (!isset($data['typeCode'])) { - throw new InvalidArgumentException('El campo typeCode es obligatorio para crear una factura'); - } - - $endpoint = ''; - switch ($data['typeCode']) { - case 'I': - $endpoint = self::INCOME_ENDPOINT; - break; - case 'E': - $endpoint = self::CREDIT_NOTE_ENDPOINT; - break; - case 'P': - $endpoint = self::PAYMENT_ENDPOINT; - break; - default: - throw new InvalidArgumentException(sprintf('Tipo de factura no soportado: %s', $data['typeCode'])); - } - return $this->httpClient->post( - $this->buildResourceUrl($endpoint), + $this->buildResourceUrl(), [ 'data' => $data ] diff --git a/src/Services/PersonService.php b/src/Services/PersonService.php index fe4a801..318b9da 100644 --- a/src/Services/PersonService.php +++ b/src/Services/PersonService.php @@ -11,6 +11,9 @@ */ class PersonService extends AbstractService implements PersonServiceInterface { + private ?EmployeeServiceInterface $employeeService = null; + private ?EmployerServiceInterface $employerService = null; + /** * Constructor del servicio de personas * @@ -19,5 +22,23 @@ class PersonService extends AbstractService implements PersonServiceInterface public function __construct(FiscalApiHttpClientInterface $httpClient) { parent::__construct($httpClient, 'people'); + $this->employeeService = new EmployeeService($httpClient); + $this->employerService = new EmployerService($httpClient); + } + + /** + * {@inheritdoc} + */ + public function getEmployeeService(): EmployeeServiceInterface + { + return $this->employeeService; + } + + /** + * {@inheritdoc} + */ + public function getEmployerService(): EmployerServiceInterface + { + return $this->employerService; } } \ No newline at end of file diff --git a/src/Services/StampService.php b/src/Services/StampService.php new file mode 100644 index 0000000..3b36ef0 --- /dev/null +++ b/src/Services/StampService.php @@ -0,0 +1,75 @@ +validateStampTransaction($data); + + return $this->httpClient->post( + $this->buildResourceUrl(), + [ + 'data' => $data + ] + ); + } + + /** + * {@inheritdoc} + */ + public function withdrawStamps(array $data): FiscalApiHttpResponseInterface + { + $this->validateStampTransaction($data); + + return $this->httpClient->post( + $this->buildResourceUrl(), + [ + 'data' => $data + ] + ); + } + + /** + * Valida los datos de la transacción de timbres + * + * @param array $data Datos de la transacción + * @throws InvalidArgumentException + */ + private function validateStampTransaction(array $data): void + { + if (!isset($data['fromPersonId']) || empty(trim($data['fromPersonId']))) { + throw new InvalidArgumentException('Se requiere el ID de la persona de origen para la transferencia de timbres'); + } + + if (!isset($data['toPersonId']) || empty(trim($data['toPersonId']))) { + throw new InvalidArgumentException('Se requiere el ID de la persona de destino para la transferencia de timbres'); + } + + if (!isset($data['amount']) || $data['amount'] <= 0) { + throw new InvalidArgumentException('La cantidad debe ser mayor que cero'); + } + } +} From e1526571e72aad644b56d8f1a14f74e7ff89542a Mon Sep 17 00:00:00 2001 From: Jose Antonio Medina Date: Thu, 26 Feb 2026 20:44:56 -0600 Subject: [PATCH 4/7] Updated client --- src/Services/FiscalApiClient.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Services/FiscalApiClient.php b/src/Services/FiscalApiClient.php index a186c71..48e6f30 100644 --- a/src/Services/FiscalApiClient.php +++ b/src/Services/FiscalApiClient.php @@ -17,6 +17,7 @@ class FiscalApiClient implements FiscalApiClientInterface private ?DownloadRuleServiceInterface $downloadRuleService = null; private ?DownloadRequestServiceInterface $downloadRequestService = null; private ?InvoiceServiceInterface $invoiceService = null; + private ?StampServiceInterface $stampService = null; @@ -137,6 +138,18 @@ public function getDownloadRequestService(): DownloadRequestServiceInterface return $this->downloadRequestService; } + /** + * {@inheritdoc} + */ + public function getStampService(): StampServiceInterface + { + if ($this->stampService === null) { + $this->stampService = new StampService($this->httpClient); + } + + return $this->stampService; + } + /** * {@inheritdoc} */ From 372c2632eb22baa10da36df04def7ce16985103d Mon Sep 17 00:00:00 2001 From: Jose Antonio Medina Date: Mon, 2 Mar 2026 20:44:40 -0600 Subject: [PATCH 5/7] Updated examples --- README.md | 10 +- .../EjemplosImpuestosLocalesReferencias.php | 210 +++ examples/EjemplosImpuestosLocalesValores.php | 448 +++++ examples/EjemplosNominaReferencias.php | 1059 +++++++++++ examples/EjemplosNominaValores.php | 1568 +++++++++++++++++ examples/EjemplosTimbres.php | 86 + examples.php => examples/examples.php | 30 +- 7 files changed, 3395 insertions(+), 16 deletions(-) create mode 100644 examples/EjemplosImpuestosLocalesReferencias.php create mode 100644 examples/EjemplosImpuestosLocalesValores.php create mode 100644 examples/EjemplosNominaReferencias.php create mode 100644 examples/EjemplosNominaValores.php create mode 100644 examples/EjemplosTimbres.php rename examples.php => examples/examples.php (99%) diff --git a/README.md b/README.md index 0cc3d4a..6c719cd 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ - **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) +- **Gestión de datos de empleador** (patrón) asociados a una persona +- **Gestión de datos de empleado** (trabajador) asociados a una persona ## 🛍️ Gestión de Productos/Servicios - **Gestión de productos y servicios** con catálogo personalizable @@ -417,7 +419,13 @@ if ($apiResponse->succeeded) { ## 📋 Operaciones Principales - **Facturas (CFDI)** - Crear facturas de ingreso, notas de crédito, complementos de pago, cancelaciones, generación de PDF/XML. + Crear facturas de ingreso, notas de crédito, complementos de pago, nómina, cancelaciones, generación de PDF/XML. +- **Nómina** + Crear facturas de nómina (typeCode 'N') con complemento de nómina (percepciones, deducciones, etc.). +- **Impuestos Locales** + Agregar complemento de impuestos locales (traslados y retenciones locales) a facturas de ingreso. +- **Empleadores y Empleados** + Gestión de datos de empleador (patrón) y empleado asociados a personas, necesarios para factuación de nómina. - **Personas (Clientes/Emisores)** Alta y administración de personas, gestión de certificados (CSD). - **Productos y Servicios** diff --git a/examples/EjemplosImpuestosLocalesReferencias.php b/examples/EjemplosImpuestosLocalesReferencias.php new file mode 100644 index 0000000..4f40a4b --- /dev/null +++ b/examples/EjemplosImpuestosLocalesReferencias.php @@ -0,0 +1,210 @@ +', + '', + false, + false, +); + +// IDs de personas previamente registradas en FiscalAPI +$escuelaKemperUrgateId = "0e82a655-5f0c-4e07-abab-8f322e4123ef"; +$karlaFuenteNolascoId = "da71df0c-f328-45ee-9bd9-3096ed02c164"; + +// Definir la fecha actual +$currentDate = getCurrentDate(); + +// Crear cliente HTTP +$client = new FiscalApiClient($settings); + + +try { + + // ================================================================== + // FACTURA DE INGRESO CON IMPUESTOS LOCALES (CEDULAR + ISH) POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear factura de ingreso con impuesto CEDULAR + ISH por referencias + // ------------------------------------------------------------------ + // $invoiceWithLocalTaxes = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'paymentFormCode' => "01", + // 'paymentConditions' => "Contado", + // 'currencyCode' => "MXN", + // 'typeCode' => "I", + // 'expeditionZipCode' => "42501", + // 'paymentMethodCode' => "PUE", + // 'exchangeRate' => 1.0, + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $karlaFuenteNolascoId + // ], + // 'recipient' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'items' => [ + // ['id' => "2f3c65f3-ed02-452f-944c-97a47010df5c"], + // ['id' => "037b5705-a9a2-4422-b842-97c0f9347498"], + // ['id' => "40389443-2aa1-4121-b86a-e8c45fac6b17"] + // ], + // // Complemento de impuestos locales + // 'complement' => [ + // 'localTaxes' => [ + // 'taxes' => [ + // [ + // 'taxName' => "CEDULAR", + // 'taxRate' => 3.00, + // 'taxAmount' => 6.00, + // 'taxFlagCode' => "R" + // ], + // [ + // 'taxName' => "ISH", + // 'taxRate' => 8.00, + // 'taxAmount' => 16.00, + // 'taxFlagCode' => "R" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoiceWithLocalTaxes); + // consoleLog($apiResponse); + + + // ================================================================== + // FACTURA DE INGRESO CON IMPUESTO CEDULAR (SOLO) POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear factura de ingreso con impuesto CEDULAR por referencias + // ------------------------------------------------------------------ + // $invoiceWithCedular = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'paymentFormCode' => "01", + // 'paymentConditions' => "Contado", + // 'currencyCode' => "MXN", + // 'typeCode' => "I", + // 'expeditionZipCode' => "42501", + // 'paymentMethodCode' => "PUE", + // 'exchangeRate' => 1.0, + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $karlaFuenteNolascoId + // ], + // 'recipient' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'items' => [ + // ['id' => "2f3c65f3-ed02-452f-944c-97a47010df5c"], + // ['id' => "037b5705-a9a2-4422-b842-97c0f9347498"], + // ['id' => "40389443-2aa1-4121-b86a-e8c45fac6b17"] + // ], + // // Complemento de impuestos locales (solo CEDULAR) + // 'complement' => [ + // 'localTaxes' => [ + // 'taxes' => [ + // [ + // 'taxName' => "CEDULAR", + // 'taxRate' => 3.00, + // 'taxAmount' => 6.00, + // 'taxFlagCode' => "R" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoiceWithCedular); + // consoleLog($apiResponse); + + + // ================================================================== + // FACTURA DE INGRESO CON IMPUESTO ISH (SOLO) POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear factura de ingreso con impuesto ISH por referencias + // ------------------------------------------------------------------ + // $invoiceWithIsh = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'paymentFormCode' => "01", + // 'paymentConditions' => "Contado", + // 'currencyCode' => "MXN", + // 'typeCode' => "I", + // 'expeditionZipCode' => "42501", + // 'paymentMethodCode' => "PUE", + // 'exchangeRate' => 1.0, + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $karlaFuenteNolascoId + // ], + // 'recipient' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'items' => [ + // ['id' => "2f3c65f3-ed02-452f-944c-97a47010df5c"], + // ['id' => "037b5705-a9a2-4422-b842-97c0f9347498"], + // ['id' => "40389443-2aa1-4121-b86a-e8c45fac6b17"] + // ], + // // Complemento de impuestos locales (solo ISH) + // 'complement' => [ + // 'localTaxes' => [ + // 'taxes' => [ + // [ + // 'taxName' => "ISH", + // 'taxRate' => 8.00, + // 'taxAmount' => 16.00, + // 'taxFlagCode' => "R" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoiceWithIsh); + // consoleLog($apiResponse); + + +} catch (\Exception $e) { + consoleError($e); +} + +function consoleLog(FiscalApiHttpResponseInterface $apiResponse) { + echo "apiResponse:\n" . json_encode($apiResponse->getJson(), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n\n"; +} + +function consoleError(\Exception $e) { + echo "Error en la ejecución: " . $e->getMessage() . "\n"; + echo "Traza: " . $e->getTraceAsString() . "\n"; +} + +/** + * Obtiene la fecha y hora actual en la zona horaria de México Central + */ +function getCurrentDate(): string { + date_default_timezone_set('Etc/GMT+6'); + return date('Y-m-d\TH:i:s'); +} diff --git a/examples/EjemplosImpuestosLocalesValores.php b/examples/EjemplosImpuestosLocalesValores.php new file mode 100644 index 0000000..932e549 --- /dev/null +++ b/examples/EjemplosImpuestosLocalesValores.php @@ -0,0 +1,448 @@ +', + '', + false, + false, +); + +// Sellos SAT de prueba (KARLA FUENTE NOLASCO FUNK671228PH6) +$base64Cert = "MIIFgDCCA2igAwIBAgIUMzAwMDEwMDAwMDA1MDAwMDM0NDYwDQYJKoZIhvcNAQELBQAwggErMQ8wDQYDVQQDDAZBQyBVQVQxLjAsBgNVBAoMJVNFUlZJQ0lPIERFIEFETUlOSVNUUkFDSU9OIFRSSUJVVEFSSUExGjAYBgNVBAsMEVNBVC1JRVMg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Vrrd2RhrYWMsDp7MpC4M0p/DA3E/qscYwq1OpwriewNdx6XXqMZbdUNqMP2viBY2VSGmNdHtVfbN/rnaeJetFGX7XgTVYD7wDq8TW9yseCK944jcT+y/o0YiT9j3OLQ2Ts0LDTQskpJSxRmXEQGy3NBDOYFTvRkcGJEQJItuol8NivJN1H9LoLIUAlAHBZxfHpUYx66YnP4PdTdMIWH+nxyekKPFfAT7olQ="; +$password = "12345678a"; + +// Definir la fecha actual +$currentDate = getCurrentDate(); + +// Crear cliente HTTP +$client = new FiscalApiClient($settings); + + +try { + + // ================================================================== + // FACTURA DE INGRESO CON IMPUESTOS LOCALES (CEDULAR + ISH) POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear factura de ingreso con impuesto CEDULAR + ISH por valores + // ------------------------------------------------------------------ + // $invoiceWithLocalTaxes = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'paymentFormCode' => "01", + // 'paymentConditions' => "Contado", + // 'currencyCode' => "MXN", + // 'typeCode' => "I", + // 'expeditionZipCode' => "42501", + // 'paymentMethodCode' => "PUE", + // 'exchangeRate' => 1.0, + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "FUNK671228PH6", + // 'legalName' => "KARLA FUENTE NOLASCO", + // 'taxRegimeCode' => "621", + // 'taxCredentials' => [ + // [ + // 'base64File' => $base64Cert, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $base64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'zipCode' => "42501", + // 'taxRegimeCode' => "601", + // 'cfdiUseCode' => "G01", + // 'email' => "someone@somewhere.com" + // ], + // 'items' => [ + // // Item 1 + // [ + // 'itemCode' => "01010101", + // 'quantity' => 9.5, + // 'unitOfMeasurementCode' => "E48", + // 'unitOfMeasurement' => "Unidad de servicio", + // 'description' => "Invoicing software as a service", + // 'unitPrice' => 3587.75, + // 'taxObjectCode' => "02", + // 'itemSku' => "7506022301697", + // 'discount' => 255.85, + // 'itemTaxes' => [ + // [ + // 'taxCode' => "002", + // 'taxTypeCode' => "Tasa", + // 'taxRate' => "0.160000", + // 'taxFlagCode' => "T" + // ] + // ] + // ], + // // Item 2 + // [ + // 'itemCode' => "01010101", + // 'quantity' => 8.0, + // 'unitOfMeasurementCode' => "E48", + // 'unitOfMeasurement' => "Unidad de servicio2", + // 'description' => "Software Consultant", + // 'unitPrice' => 250.85, + // 'taxObjectCode' => "02", + // 'itemSku' => "7506022301698", + // 'discount' => 255.85, + // 'itemTaxes' => [ + // [ + // 'taxCode' => "002", + // 'taxTypeCode' => "Tasa", + // 'taxRate' => "0.160000", + // 'taxFlagCode' => "T" + // ] + // ] + // ], + // // Item 3 + // [ + // 'itemCode' => "01010101", + // 'quantity' => 6.0, + // 'unitOfMeasurementCode' => "E48", + // 'unitOfMeasurement' => "Unidad de servicio3", + // 'description' => "Computer software", + // 'unitPrice' => 1250.75, + // 'taxObjectCode' => "02", + // 'itemSku' => "7506022301699", + // 'itemTaxes' => [ + // [ + // 'taxCode' => "002", + // 'taxTypeCode' => "Tasa", + // 'taxRate' => "0.160000", + // 'taxFlagCode' => "T" + // ], + // [ + // 'taxCode' => "002", + // 'taxTypeCode' => "Tasa", + // 'taxRate' => "0.106666", + // 'taxFlagCode' => "R" + // ] + // ] + // ] + // ], + // // Complemento de impuestos locales + // 'complement' => [ + // 'localTaxes' => [ + // 'taxes' => [ + // [ + // 'taxName' => "CEDULAR", + // 'taxRate' => 3.00, + // 'taxAmount' => 6.00, + // 'taxFlagCode' => "R" + // ], + // [ + // 'taxName' => "ISH", + // 'taxRate' => 8.00, + // 'taxAmount' => 16.00, + // 'taxFlagCode' => "R" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoiceWithLocalTaxes); + // consoleLog($apiResponse); + + + // ================================================================== + // FACTURA DE INGRESO CON IMPUESTO CEDULAR (SOLO) POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear factura de ingreso con impuesto CEDULAR por valores + // ------------------------------------------------------------------ + // $invoiceWithCedular = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'paymentFormCode' => "01", + // 'paymentConditions' => "Contado", + // 'currencyCode' => "MXN", + // 'typeCode' => "I", + // 'expeditionZipCode' => "42501", + // 'paymentMethodCode' => "PUE", + // 'exchangeRate' => 1.0, + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "FUNK671228PH6", + // 'legalName' => "KARLA FUENTE NOLASCO", + // 'taxRegimeCode' => "621", + // 'taxCredentials' => [ + // [ + // 'base64File' => $base64Cert, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $base64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'zipCode' => "42501", + // 'taxRegimeCode' => "601", + // 'cfdiUseCode' => "G01", + // 'email' => "someone@somewhere.com" + // ], + // 'items' => [ + // [ + // 'itemCode' => "01010101", + // 'quantity' => 9.5, + // 'unitOfMeasurementCode' => "E48", + // 'unitOfMeasurement' => "Unidad de servicio", + // 'description' => "Invoicing software as a service", + // 'unitPrice' => 3587.75, + // 'taxObjectCode' => "02", + // 'itemSku' => "7506022301697", + // 'discount' => 255.85, + // 'itemTaxes' => [ + // [ + // 'taxCode' => "002", + // 'taxTypeCode' => "Tasa", + // 'taxRate' => "0.160000", + // 'taxFlagCode' => "T" + // ] + // ] + // ], + // [ + // 'itemCode' => "01010101", + // 'quantity' => 8.0, + // 'unitOfMeasurementCode' => "E48", + // 'unitOfMeasurement' => "Unidad de servicio2", + // 'description' => "Software Consultant", + // 'unitPrice' => 250.85, + // 'taxObjectCode' => "02", + // 'itemSku' => "7506022301698", + // 'discount' => 255.85, + // 'itemTaxes' => [ + // [ + // 'taxCode' => "002", + // 'taxTypeCode' => "Tasa", + // 'taxRate' => "0.160000", + // 'taxFlagCode' => "T" + // ] + // ] + // ], + // [ + // 'itemCode' => "01010101", + // 'quantity' => 6.0, + // 'unitOfMeasurementCode' => "E48", + // 'unitOfMeasurement' => "Unidad de servicio3", + // 'description' => "Computer software", + // 'unitPrice' => 1250.75, + // 'taxObjectCode' => "02", + // 'itemSku' => "7506022301699", + // 'itemTaxes' => [ + // [ + // 'taxCode' => "002", + // 'taxTypeCode' => "Tasa", + // 'taxRate' => "0.160000", + // 'taxFlagCode' => "T" + // ], + // [ + // 'taxCode' => "002", + // 'taxTypeCode' => "Tasa", + // 'taxRate' => "0.106666", + // 'taxFlagCode' => "R" + // ] + // ] + // ] + // ], + // // Complemento de impuestos locales (solo CEDULAR) + // 'complement' => [ + // 'localTaxes' => [ + // 'taxes' => [ + // [ + // 'taxName' => "CEDULAR", + // 'taxRate' => 3.00, + // 'taxAmount' => 6.00, + // 'taxFlagCode' => "R" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoiceWithCedular); + // consoleLog($apiResponse); + + + // ================================================================== + // FACTURA DE INGRESO CON IMPUESTO ISH (SOLO) POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear factura de ingreso con impuesto ISH por valores + // ------------------------------------------------------------------ + // $invoiceWithIsh = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'paymentFormCode' => "01", + // 'paymentConditions' => "Contado", + // 'currencyCode' => "MXN", + // 'typeCode' => "I", + // 'expeditionZipCode' => "42501", + // 'paymentMethodCode' => "PUE", + // 'exchangeRate' => 1.0, + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "FUNK671228PH6", + // 'legalName' => "KARLA FUENTE NOLASCO", + // 'taxRegimeCode' => "621", + // 'taxCredentials' => [ + // [ + // 'base64File' => $base64Cert, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $base64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'zipCode' => "42501", + // 'taxRegimeCode' => "601", + // 'cfdiUseCode' => "G01", + // 'email' => "someone@somewhere.com" + // ], + // 'items' => [ + // [ + // 'itemCode' => "01010101", + // 'quantity' => 9.5, + // 'unitOfMeasurementCode' => "E48", + // 'unitOfMeasurement' => "Unidad de servicio", + // 'description' => "Invoicing software as a service", + // 'unitPrice' => 3587.75, + // 'taxObjectCode' => "02", + // 'itemSku' => "7506022301697", + // 'discount' => 255.85, + // 'itemTaxes' => [ + // [ + // 'taxCode' => "002", + // 'taxTypeCode' => "Tasa", + // 'taxRate' => "0.160000", + // 'taxFlagCode' => "T" + // ] + // ] + // ], + // [ + // 'itemCode' => "01010101", + // 'quantity' => 8.0, + // 'unitOfMeasurementCode' => "E48", + // 'unitOfMeasurement' => "Unidad de servicio2", + // 'description' => "Software Consultant", + // 'unitPrice' => 250.85, + // 'taxObjectCode' => "02", + // 'itemSku' => "7506022301698", + // 'discount' => 255.85, + // 'itemTaxes' => [ + // [ + // 'taxCode' => "002", + // 'taxTypeCode' => "Tasa", + // 'taxRate' => "0.160000", + // 'taxFlagCode' => "T" + // ] + // ] + // ], + // [ + // 'itemCode' => "01010101", + // 'quantity' => 6.0, + // 'unitOfMeasurementCode' => "E48", + // 'unitOfMeasurement' => "Unidad de servicio3", + // 'description' => "Computer software", + // 'unitPrice' => 1250.75, + // 'taxObjectCode' => "02", + // 'itemSku' => "7506022301699", + // 'itemTaxes' => [ + // [ + // 'taxCode' => "002", + // 'taxTypeCode' => "Tasa", + // 'taxRate' => "0.160000", + // 'taxFlagCode' => "T" + // ], + // [ + // 'taxCode' => "002", + // 'taxTypeCode' => "Tasa", + // 'taxRate' => "0.106666", + // 'taxFlagCode' => "R" + // ] + // ] + // ] + // ], + // // Complemento de impuestos locales (solo ISH) + // 'complement' => [ + // 'localTaxes' => [ + // 'taxes' => [ + // [ + // 'taxName' => "ISH", + // 'taxRate' => 8.00, + // 'taxAmount' => 16.00, + // 'taxFlagCode' => "R" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoiceWithIsh); + // consoleLog($apiResponse); + + +} catch (\Exception $e) { + consoleError($e); +} + +function consoleLog(FiscalApiHttpResponseInterface $apiResponse) { + echo "apiResponse:\n" . json_encode($apiResponse->getJson(), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n\n"; +} + +function consoleError(\Exception $e) { + echo "Error en la ejecución: " . $e->getMessage() . "\n"; + echo "Traza: " . $e->getTraceAsString() . "\n"; +} + +/** + * Obtiene la fecha y hora actual en la zona horaria de México Central + */ +function getCurrentDate(): string { + date_default_timezone_set('Etc/GMT+6'); + return date('Y-m-d\TH:i:s'); +} diff --git a/examples/EjemplosNominaReferencias.php b/examples/EjemplosNominaReferencias.php new file mode 100644 index 0000000..814553d --- /dev/null +++ b/examples/EjemplosNominaReferencias.php @@ -0,0 +1,1059 @@ +', + '', + false, + false, +); + +// IDs de personas previamente registradas en FiscalAPI +$escuelaKemperUrgateId = "0e82a655-5f0c-4e07-abab-8f322e4123ef"; +$karlaFuenteNolascoId = "da71df0c-f328-45ee-9bd9-3096ed02c164"; +$organicosNavezOsorioId = "ab7ec306-6f81-4f9f-b55f-bbbb1ab2f153"; +$xochiltCasasChavezId = "acf43966-4672-48b6-a01a-d04cac6c3d64"; +$ingridXodarJimenezId = "aa2ad8c3-6ec5-4601-91be-d827d9a865bc"; + +// Definir la fecha actual +$currentDate = getCurrentDate(); + +// Crear cliente HTTP +$client = new FiscalApiClient($settings); + + +try { + + // ================================================================== + // NÓMINA ORDINARIA POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina ordinaria por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'expeditionZipCode' => "42501", + // 'issuer' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'recipient' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2025-08-30T00:00:00", + // 'initialPaymentDate' => "2025-07-31T00:00:00", + // 'finalPaymentDate' => "2025-08-30T00:00:00", + // 'daysPaid' => 30, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "1003", + // 'concept' => "Sueldo nominal", + // 'taxedAmount' => "95030.00", + // 'exemptAmount' => "0" + // ], + // [ + // 'earningTypeCode' => "005", + // 'code' => "5913", + // 'concept' => "Fondo de Ahorro Aportación Patrón", + // 'taxedAmount' => "0", + // 'exemptAmount' => "0" + // ], + // [ + // 'earningTypeCode' => "038", + // 'code' => "1885", + // 'concept' => "Bono Ingles", + // 'taxedAmount' => "14254.50", + // 'exemptAmount' => "0" + // ], + // [ + // 'earningTypeCode' => "029", + // 'code' => "1941", + // 'concept' => "Vales Despensa", + // 'taxedAmount' => "0", + // 'exemptAmount' => "3439" + // ], + // [ + // 'earningTypeCode' => "038", + // 'code' => "1824", + // 'concept' => "Herramientas Teletrabajo (telecom y prop. electri)", + // 'taxedAmount' => "273", + // 'exemptAmount' => "0" + // ], + // [ + // 'earningTypeCode' => "002", + // 'code' => "5050", + // 'concept' => "Exceso de subsidio al empleo", + // 'taxedAmount' => "0", + // 'exemptAmount' => "0" + // ] + // ], + // 'otherPayments' => [ + // [ + // 'otherPaymentTypeCode' => "002", + // 'code' => "5050", + // 'concept' => "exceso de subsidio al empleo", + // 'amount' => "0", + // 'subsidyCaused' => "0" + // ] + // ] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "002", + // 'code' => "5003", + // 'concept' => "ISR Causado", + // 'amount' => "27645" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "5910", + // 'concept' => "Fondo de ahorro Empleado Inversión", + // 'amount' => "4412.46" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "5914", + // 'concept' => "Fondo de Ahorro Patrón Inversión", + // 'amount' => "4412.46" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "1966", + // 'concept' => "Contribución póliza exceso GMM", + // 'amount' => "519.91" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "1934", + // 'concept' => "Descuento Vales Despensa", + // 'amount' => "1" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "1942", + // 'concept' => "Vales Despensa Electrónico", + // 'amount' => "3439" + // ], + // [ + // 'deductionTypeCode' => "001", + // 'code' => "1895", + // 'concept' => "IMSS", + // 'amount' => "2391.13" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA ASIMILADOS POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina asimilados por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "06880", + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'recipient' => [ + // 'id' => $xochiltCasasChavezId + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "E", + // 'paymentDate' => "2023-06-02T00:00:00", + // 'initialPaymentDate' => "2023-06-01T00:00:00", + // 'finalPaymentDate' => "2023-06-02T00:00:00", + // 'daysPaid' => 1, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "046", + // 'code' => "010046", + // 'concept' => "INGRESOS ASIMILADOS A SALARIOS", + // 'taxedAmount' => "111197.73", + // 'exemptAmount' => "0.00" + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "002", + // 'code' => "020002", + // 'concept' => "ISR", + // 'amount' => "36197.73" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA CON BONOS, FONDO DE AHORRO Y DEDUCCIONES POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina con bonos, fondo de ahorro y deducciones por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'recipient' => [ + // 'id' => $ingridXodarJimenezId + // ], + // 'items' => [ + // [ + // 'itemCode' => "84111505", + // 'itemSku' => "84111505", + // 'quantity' => 1, + // 'unitOfMeasurementCode' => "ACT", + // 'description' => "Pago de nómina", + // 'unitPrice' => "1842.82", + // 'discount' => "608.71", + // 'taxObjectCode' => "01" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-06-11T00:00:00", + // 'initialPaymentDate' => "2023-06-05T00:00:00", + // 'finalPaymentDate' => "2023-06-11T00:00:00", + // 'daysPaid' => 7, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "SP01", + // 'concept' => "SUELDO", + // 'taxedAmount' => "1210.30", + // 'exemptAmount' => "0.00" + // ], + // [ + // 'earningTypeCode' => "010", + // 'code' => "SP02", + // 'concept' => "PREMIO PUNTUALIDAD", + // 'taxedAmount' => "121.03", + // 'exemptAmount' => "0.00" + // ], + // [ + // 'earningTypeCode' => "029", + // 'code' => "SP03", + // 'concept' => "MONEDERO ELECTRONICO", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "269.43" + // ], + // [ + // 'earningTypeCode' => "010", + // 'code' => "SP04", + // 'concept' => "PREMIO DE ASISTENCIA", + // 'taxedAmount' => "121.03", + // 'exemptAmount' => "0.00" + // ], + // [ + // 'earningTypeCode' => "005", + // 'code' => "SP54", + // 'concept' => "APORTACION FONDO AHORRO", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "121.03" + // ] + // ], + // 'otherPayments' => [ + // [ + // 'otherPaymentTypeCode' => "002", + // 'code' => "ISRSUB", + // 'concept' => "Subsidio ISR para empleo", + // 'amount' => "0.0", + // 'subsidyCaused' => "0.0", + // 'balanceCompensation' => [ + // 'favorableBalance' => "0.0", + // 'year' => 2022, + // 'remainingFavorableBalance' => "0.0" + // ] + // ] + // ] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "004", + // 'code' => "ZA09", + // 'concept' => "APORTACION FONDO AHORRO", + // 'amount' => "121.03" + // ], + // [ + // 'deductionTypeCode' => "002", + // 'code' => "ISR", + // 'concept' => "ISR", + // 'amount' => "36.57" + // ], + // [ + // 'deductionTypeCode' => "001", + // 'code' => "IMSS", + // 'concept' => "Cuota de Seguridad Social EE", + // 'amount' => "30.08" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "ZA68", + // 'concept' => "DEDUCCION FDO AHORRO PAT", + // 'amount' => "121.03" + // ], + // [ + // 'deductionTypeCode' => "018", + // 'code' => "ZA11", + // 'concept' => "APORTACION CAJA AHORRO", + // 'amount' => "300.00" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA CON HORAS EXTRA POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina con horas extra por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'recipient' => [ + // 'id' => $ingridXodarJimenezId + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-05-24T00:00:00", + // 'initialPaymentDate' => "2023-05-09T00:00:00", + // 'finalPaymentDate' => "2023-05-24T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "00500", + // 'concept' => "Sueldos, Salarios Rayas y Jornales", + // 'taxedAmount' => "2808.8", + // 'exemptAmount' => "2191.2" + // ], + // [ + // 'earningTypeCode' => "019", + // 'code' => "00100", + // 'concept' => "Horas Extra", + // 'taxedAmount' => "50.00", + // 'exemptAmount' => "50.00", + // 'overtime' => [ + // [ + // 'days' => 1, + // 'hoursTypeCode' => "01", + // 'extraHours' => 2, + // 'amountPaid' => "100.00" + // ] + // ] + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "001", + // 'code' => "00301", + // 'concept' => "Seguridad Social", + // 'amount' => "200.00" + // ], + // [ + // 'deductionTypeCode' => "002", + // 'code' => "00302", + // 'concept' => "ISR", + // 'amount' => "100" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA CON INCAPACIDADES POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina con incapacidades por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'recipient' => [ + // 'id' => $ingridXodarJimenezId + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-05-24T00:00:00", + // 'initialPaymentDate' => "2023-05-09T00:00:00", + // 'finalPaymentDate' => "2023-05-24T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "00500", + // 'concept' => "Sueldos, Salarios Rayas y Jornales", + // 'taxedAmount' => "2808.80", + // 'exemptAmount' => "2191.20" + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "001", + // 'code' => "00301", + // 'concept' => "Seguridad Social", + // 'amount' => "200.00" + // ], + // [ + // 'deductionTypeCode' => "002", + // 'code' => "00302", + // 'concept' => "ISR", + // 'amount' => "100.00" + // ] + // ], + // 'disabilities' => [ + // [ + // 'disabilityDays' => 1, + // 'disabilityTypeCode' => "01" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA CON SNCF POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina con SNCF por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "39074", + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $organicosNavezOsorioId + // ], + // 'recipient' => [ + // 'id' => $xochiltCasasChavezId + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-05-16T00:00:00", + // 'initialPaymentDate' => "2023-05-01T00:00:00", + // 'finalPaymentDate' => "2023-05-16T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "P001", + // 'concept' => "Sueldos, Salarios Rayas y Jornales", + // 'taxedAmount' => "3322.20", + // 'exemptAmount' => "0.0" + // ], + // [ + // 'earningTypeCode' => "038", + // 'code' => "P540", + // 'concept' => "Compensacion", + // 'taxedAmount' => "100.0", + // 'exemptAmount' => "0.0" + // ], + // [ + // 'earningTypeCode' => "038", + // 'code' => "P550", + // 'concept' => "Compensación Garantizada Extraordinaria", + // 'taxedAmount' => "2200.0", + // 'exemptAmount' => "0.0" + // ], + // [ + // 'earningTypeCode' => "038", + // 'code' => "P530", + // 'concept' => "Servicio Extraordinario", + // 'taxedAmount' => "200.0", + // 'exemptAmount' => "0.0" + // ], + // [ + // 'earningTypeCode' => "001", + // 'code' => "P506", + // 'concept' => "Otras Prestaciones", + // 'taxedAmount' => "1500.0", + // 'exemptAmount' => "0.0" + // ], + // [ + // 'earningTypeCode' => "001", + // 'code' => "P505", + // 'concept' => "Remuneración al Desempeño Legislativo", + // 'taxedAmount' => "17500.0", + // 'exemptAmount' => "0.0" + // ] + // ], + // 'otherPayments' => [ + // [ + // 'otherPaymentTypeCode' => "002", + // 'code' => "o002", + // 'concept' => "Subsidio para el empleo efectivamente entregado al trabajador", + // 'amount' => "0.0", + // 'subsidyCaused' => "0.0" + // ] + // ] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "002", + // 'code' => "D002", + // 'concept' => "ISR", + // 'amount' => "4716.61" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "D525", + // 'concept' => "Redondeo", + // 'amount' => "0.81" + // ], + // [ + // 'deductionTypeCode' => "001", + // 'code' => "D510", + // 'concept' => "Cuota Trabajador ISSSTE", + // 'amount' => "126.78" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA EXTRAORDINARIA (AGUINALDO) POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina extraordinaria (aguinaldo) por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'recipient' => [ + // 'id' => $ingridXodarJimenezId + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "E", + // 'paymentDate' => "2023-06-04T00:00:00", + // 'initialPaymentDate' => "2023-06-04T00:00:00", + // 'finalPaymentDate' => "2023-06-04T00:00:00", + // 'daysPaid' => 30, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "002", + // 'code' => "00500", + // 'concept' => "Gratificación Anual (Aguinaldo)", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "10000.00" + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA SEPARACIÓN INDEMNIZACIÓN POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina separación indemnización por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'recipient' => [ + // 'id' => $ingridXodarJimenezId + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "E", + // 'paymentDate' => "2023-06-04T00:00:00", + // 'initialPaymentDate' => "2023-05-05T00:00:00", + // 'finalPaymentDate' => "2023-06-04T00:00:00", + // 'daysPaid' => 30, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "023", + // 'code' => "00500", + // 'concept' => "Pagos por separación", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "10000.00" + // ], + // [ + // 'earningTypeCode' => "025", + // 'code' => "00900", + // 'concept' => "Indemnizaciones", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "500.00" + // ] + // ], + // 'otherPayments' => [], + // 'severance' => [ + // 'totalPaid' => "10500.00", + // 'yearsOfService' => 1, + // 'lastMonthlySalary' => "10000.00", + // 'accumulableIncome' => "10000.00", + // 'nonAccumulableIncome' => "0.00" + // ] + // ], + // 'deductions' => [] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA JUBILACIÓN POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina jubilación por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'recipient' => [ + // 'id' => $ingridXodarJimenezId + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "E", + // 'paymentDate' => "2023-05-05T00:00:00", + // 'initialPaymentDate' => "2023-06-04T00:00:00", + // 'finalPaymentDate' => "2023-06-04T00:00:00", + // 'daysPaid' => 30, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "039", + // 'code' => "00500", + // 'concept' => "Jubilaciones, pensiones o haberes de retiro", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "10000.00" + // ] + // ], + // 'otherPayments' => [], + // 'retirement' => [ + // 'totalOneTime' => "10000.00", + // 'accumulableIncome' => "10000.00", + // 'nonAccumulableIncome' => "0.00" + // ] + // ], + // 'deductions' => [] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA SIN DEDUCCIONES POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina sin deducciones por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'recipient' => [ + // 'id' => $ingridXodarJimenezId + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-05-24T00:00:00", + // 'initialPaymentDate' => "2023-05-09T00:00:00", + // 'finalPaymentDate' => "2023-05-24T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "00500", + // 'concept' => "Sueldos, Salarios Rayas y Jornales", + // 'taxedAmount' => "2808.8", + // 'exemptAmount' => "2191.2" + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA VIÁTICOS POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina viáticos por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'recipient' => [ + // 'id' => $ingridXodarJimenezId + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-09-26T00:00:00", + // 'initialPaymentDate' => "2023-09-11T00:00:00", + // 'finalPaymentDate' => "2023-09-26T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "050", + // 'code' => "050", + // 'concept' => "Viaticos", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "3000.00" + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "081", + // 'code' => "081", + // 'concept' => "Ajuste en viaticos entregados al trabajador", + // 'amount' => "3000.00" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA SUBSIDIO CAUSADO AL EMPLEO POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina subsidio causado al empleo por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'recipient' => [ + // 'id' => $ingridXodarJimenezId + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-05-24T00:00:00", + // 'initialPaymentDate' => "2023-05-09T00:00:00", + // 'finalPaymentDate' => "2023-05-24T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "00500", + // 'concept' => "Sueldos, Salarios Rayas y Jornales", + // 'taxedAmount' => "2808.8", + // 'exemptAmount' => "2191.2" + // ] + // ], + // 'otherPayments' => [ + // [ + // 'otherPaymentTypeCode' => "007", + // 'code' => "0002", + // 'concept' => "ISR ajustado por subsidio", + // 'amount' => "145.80", + // 'subsidyCaused' => "0.0" + // ] + // ] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "107", + // 'code' => "D002", + // 'concept' => "Ajuste al Subsidio Causado", + // 'amount' => "160.35" + // ], + // [ + // 'deductionTypeCode' => "002", + // 'code' => "D002", + // 'concept' => "ISR", + // 'amount' => "145.80" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA SIMPLE POR REFERENCIAS + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina simple por referencias + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'id' => $escuelaKemperUrgateId + // ], + // 'recipient' => [ + // 'id' => $ingridXodarJimenezId + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-05-24T00:00:00", + // 'initialPaymentDate' => "2023-05-09T00:00:00", + // 'finalPaymentDate' => "2023-05-24T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "00500", + // 'concept' => "Sueldos, Salarios Rayas y Jornales", + // 'taxedAmount' => "2808.8", + // 'exemptAmount' => "2191.2" + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "001", + // 'code' => "00301", + // 'concept' => "Seguridad Social", + // 'amount' => "200" + // ], + // [ + // 'deductionTypeCode' => "002", + // 'code' => "00302", + // 'concept' => "ISR", + // 'amount' => "100" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + +} catch (\Exception $e) { + consoleError($e); +} + +function consoleLog(FiscalApiHttpResponseInterface $apiResponse) { + echo "apiResponse:\n" . json_encode($apiResponse->getJson(), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n\n"; +} + +function consoleError(\Exception $e) { + echo "Error en la ejecución: " . $e->getMessage() . "\n"; + echo "Traza: " . $e->getTraceAsString() . "\n"; +} + +/** + * Obtiene la fecha y hora actual en la zona horaria de México Central + */ +function getCurrentDate(): string { + date_default_timezone_set('Etc/GMT+6'); + return date('Y-m-d\TH:i:s'); +} diff --git a/examples/EjemplosNominaValores.php b/examples/EjemplosNominaValores.php new file mode 100644 index 0000000..6a5f194 --- /dev/null +++ b/examples/EjemplosNominaValores.php @@ -0,0 +1,1568 @@ +', + '', + false, + false, +); + +// Contraseña del CSD +$password = "12345678a"; + +// Sellos de KARLA FUENTE NOLASCO. Ver https://docs.fiscalapi.com/tax-files-info#codificacion-de-fiel-o-csd-en-base64 +$base64Cer = "MIIFgDCCA2igAwIBAgIUMzAwMDEwMDAwMDA1MDAwMDM0NDYwDQYJKoZIhvcNAQELBQAwggErMQ8wDQYDVQQDDAZBQyBVQVQxLjAsBgNVBAoMJVNFUlZJQ0lPIERFIEFETUlOSVNUUkFDSU9OIFRSSUJVVEFSSUExGjAYBgNVBAsMEVNBVC1JRVMgQXV0aG9yaXR5MSgwJgYJKoZIhvcNAQkBFhlvc2Nhci5tYXJ0aW5lekBzYXQuZ29iLm14MR0wGwYDVQQJDBQzcmEgY2VycmFkYSBkZSBjYWxpejEOMAwGA1UEEQwFMDYzNzAxCzAJBgNVBAYTAk1YMRkwFwYDVQQIDBBDSVVEQUQgREUgTUVYSUNPMREwDwYDVQQHDAhDT1lPQUNBTjERMA8GA1UELRMIMi41LjQuNDUxJTAjBgkqhkiG9w0BCQITFnJlc3BvbnNhYmxlOiBBQ0RNQS1TQVQwHhcNMjMwNTE4MTQzNTM3WhcNMjcwNTE4MTQzNTM3WjCBpzEdMBsGA1U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j/lv8p6xnVjWxYI+rBPdtkpfFYRp+MJiXjgPw5B6UGuoruv7+vHjOLHOotRo+RdjZt7NqL9dAJnl1Qb2jfW6+d7NYQSI/bAwxO0sk4taQIT6Gsu/8kfZOPC2xk9rphGqCSS/4q3Os0MMjA1bcJLyoWLp13pqhK6bmiiHw0BBXH4fbEp4xjSbpPx4tHXzbdn8oDsHKZkWh3pPC2J/nVl0k/yF1KDVowVtMDXE47k6TGVcBoqe8PDXCG9+vjRpzIidqNo5qebaUZu6riWMWzldz8x3Z/jLWXuDiM7/Yscn0Z2GIlfoeyz+GwP2eTdOw9EUedHjEQuJY32bq8LICimJ4Ht+zMJKUyhwVQyAER8byzQBwTYmYP5U0wdsyIFitphw+/IH8+v08Ia1iBLPQAeAvRfTTIFLCs8foyUrj5Zv2B/wTYIZy6ioUM+qADeXyo45uBLLqkN90Rf6kiTqDld78NxwsfyR5MxtJLVDFkmf2IMMJHTqSfhbi+7QJaC11OOUJTD0v9wo0X/oO5GvZhe0ZaGHnm9zqTopALuFEAxcaQlc4R81wjC4wrIrqWnbcl2dxiBtD73KW+wcC9ymsLf4I8BEmiN25lx/OUc1IHNyXZJYSFkEfaxCEZWKcnbiyf5sqFSSlEqZLc4lUPJFAoP6s1FHVcyO0odWqdadhRZLZC9RCzQgPlMRtji/OXy5phh7diOBZv5UYp5nb+MZ2NAB/eFXm2JLguxjvEstuvTDmZDUb6Uqv++RdhO5gvKf/AcwU38ifaHQ9uvRuDocYwVxZS2nr9rOwZ8nAh+P2o4e0tEXjxFKQGhxXYkn75H3hhfnFYjik/2qunHBBZfcdG148MaNP6DjX33M238T9Zw/GyGx00JMogr2pdP4JAErv9a5yt4YR41KGf8guSOUbOXVARw6+ybh7+meb7w4BeTlj3aZkv8tVGdfIt3lrwVnlbzhLjeQY6PplKp3/a5Kr5yM0T4wJoKQQ6v3vSNmrhpbuAtKxpMILe8CQoo="; + +// Definir la fecha actual +$currentDate = getCurrentDate(); + +// Crear cliente HTTP +$client = new FiscalApiClient($settings); + + +try { + + // ================================================================== + // NÓMINA ORDINARIA POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina ordinaria por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'expeditionZipCode' => "42501", + // 'issuer' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'employerRegistration' => "B5510768108" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $escuelaKemperUrgateBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $escuelaKemperUrgateBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "FUNK671228PH6", + // 'legalName' => "KARLA FUENTE NOLASCO", + // 'zipCode' => "01160", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'email' => "someone@somewhere.com", + // 'employeeData' => [ + // 'curp' => "XEXX010101MNEXXXA8", + // 'socialSecurityNumber' => "04078873454", + // 'laborRelationStartDate' => "2024-08-18T00:00:00", + // 'seniority' => "P54W", + // 'satContractTypeId' => "01", + // 'satTaxRegimeTypeId' => "02", + // 'employeeNumber' => "123456789", + // 'department' => "GenAI", + // 'position' => "Sr Software Engineer", + // 'satJobRiskId' => "1", + // 'satPaymentPeriodicityId' => "05", + // 'satBankId' => "012", + // 'baseSalaryForContributions' => "282.50", + // 'integratedDailySalary' => "2626.23", + // 'satPayrollStateId' => "JAL" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2025-08-30T00:00:00", + // 'initialPaymentDate' => "2025-07-31T00:00:00", + // 'finalPaymentDate' => "2025-08-30T00:00:00", + // 'daysPaid' => 30, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "1003", + // 'concept' => "Sueldo nominal", + // 'taxedAmount' => "95030.00", + // 'exemptAmount' => "0" + // ], + // [ + // 'earningTypeCode' => "005", + // 'code' => "5913", + // 'concept' => "Fondo de Ahorro Aportación Patrón", + // 'taxedAmount' => "0", + // 'exemptAmount' => "4412.46" + // ], + // [ + // 'earningTypeCode' => "038", + // 'code' => "1885", + // 'concept' => "Bono Ingles", + // 'taxedAmount' => "14254.50", + // 'exemptAmount' => "0" + // ], + // [ + // 'earningTypeCode' => "029", + // 'code' => "1941", + // 'concept' => "Vales Despensa", + // 'taxedAmount' => "0", + // 'exemptAmount' => "3439" + // ], + // [ + // 'earningTypeCode' => "038", + // 'code' => "1824", + // 'concept' => "Herramientas Teletrabajo (telecom y prop. electri)", + // 'taxedAmount' => "273", + // 'exemptAmount' => "0" + // ] + // ], + // 'otherPayments' => [ + // [ + // 'otherPaymentTypeCode' => "002", + // 'code' => "5050", + // 'concept' => "exceso de subsidio al empleo", + // 'amount' => "0", + // 'subsidyCaused' => "0" + // ] + // ] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "002", + // 'code' => "5003", + // 'concept' => "ISR Causado", + // 'amount' => "27645" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "5910", + // 'concept' => "Fondo de ahorro Empleado Inversión", + // 'amount' => "4412.46" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "5914", + // 'concept' => "Fondo de Ahorro Patrón Inversión", + // 'amount' => "4412.46" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "1966", + // 'concept' => "Contribución póliza exceso GMM", + // 'amount' => "519.91" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "1934", + // 'concept' => "Descuento Vales Despensa", + // 'amount' => "1" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "1942", + // 'concept' => "Vales Despensa Electrónico", + // 'amount' => "3439" + // ], + // [ + // 'deductionTypeCode' => "001", + // 'code' => "1895", + // 'concept' => "IMSS", + // 'amount' => "2391.13" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA ASIMILADOS POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina asimilados por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "06880", + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'originEmployerTin' => "EKU9003173C9" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $escuelaKemperUrgateBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $escuelaKemperUrgateBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "CACX7605101P8", + // 'legalName' => "XOCHILT CASAS CHAVEZ", + // 'zipCode' => "36257", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'employeeData' => [ + // 'curp' => "XEXX010101HNEXXXA4", + // 'satContractTypeId' => "09", + // 'satUnionizedStatusId' => "No", + // 'satTaxRegimeTypeId' => "09", + // 'employeeNumber' => "00002", + // 'department' => "ADMINISTRACION", + // 'position' => "DIRECTOR DE ADMINISTRACION", + // 'satPaymentPeriodicityId' => "99", + // 'satBankId' => "012", + // 'bankAccount' => "1111111111", + // 'satPayrollStateId' => "CMX" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "E", + // 'paymentDate' => "2023-06-02T00:00:00", + // 'initialPaymentDate' => "2023-06-01T00:00:00", + // 'finalPaymentDate' => "2023-06-02T00:00:00", + // 'daysPaid' => 1, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "046", + // 'code' => "010046", + // 'concept' => "INGRESOS ASIMILADOS A SALARIOS", + // 'taxedAmount' => "111197.73", + // 'exemptAmount' => "0.00" + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "002", + // 'code' => "020002", + // 'concept' => "ISR", + // 'amount' => "36197.73" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA CON BONOS, FONDO DE AHORRO Y DEDUCCIONES POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina con bonos, fondo de ahorro y deducciones por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'employerRegistration' => "Z0000001234" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $escuelaKemperUrgateBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $escuelaKemperUrgateBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "XOJI740919U48", + // 'legalName' => "INGRID XODAR JIMENEZ", + // 'zipCode' => "76028", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'employeeData' => [ + // 'curp' => "XEXX010101MNEXXXA8", + // 'socialSecurityNumber' => "0000000000", + // 'laborRelationStartDate' => "2022-03-02T00:00:00", + // 'seniority' => "P66W", + // 'satContractTypeId' => "01", + // 'satUnionizedStatusId' => "No", + // 'satTaxRegimeTypeId' => "02", + // 'employeeNumber' => "111111", + // 'satJobRiskId' => "4", + // 'satPaymentPeriodicityId' => "02", + // 'integratedDailySalary' => "180.96", + // 'satPayrollStateId' => "GUA" + // ] + // ], + // 'items' => [ + // [ + // 'itemCode' => "84111505", + // 'itemSku' => "84111505", + // 'quantity' => 1, + // 'unitOfMeasurementCode' => "ACT", + // 'description' => "Pago de nómina", + // 'unitPrice' => "1842.82", + // 'discount' => "608.71", + // 'taxObjectCode' => "01" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-06-11T00:00:00", + // 'initialPaymentDate' => "2023-06-05T00:00:00", + // 'finalPaymentDate' => "2023-06-11T00:00:00", + // 'daysPaid' => 7, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "SP01", + // 'concept' => "SUELDO", + // 'taxedAmount' => "1210.30", + // 'exemptAmount' => "0.00" + // ], + // [ + // 'earningTypeCode' => "010", + // 'code' => "SP02", + // 'concept' => "PREMIO PUNTUALIDAD", + // 'taxedAmount' => "121.03", + // 'exemptAmount' => "0.00" + // ], + // [ + // 'earningTypeCode' => "029", + // 'code' => "SP03", + // 'concept' => "MONEDERO ELECTRONICO", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "269.43" + // ], + // [ + // 'earningTypeCode' => "010", + // 'code' => "SP04", + // 'concept' => "PREMIO DE ASISTENCIA", + // 'taxedAmount' => "121.03", + // 'exemptAmount' => "0.00" + // ], + // [ + // 'earningTypeCode' => "005", + // 'code' => "SP54", + // 'concept' => "APORTACION FONDO AHORRO", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "121.03" + // ] + // ], + // 'otherPayments' => [ + // [ + // 'otherPaymentTypeCode' => "002", + // 'code' => "ISRSUB", + // 'concept' => "Subsidio ISR para empleo", + // 'amount' => "0.0", + // 'subsidyCaused' => "0.0", + // 'balanceCompensation' => [ + // 'favorableBalance' => "0.0", + // 'year' => 2022, + // 'remainingFavorableBalance' => "0.0" + // ] + // ] + // ] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "004", + // 'code' => "ZA09", + // 'concept' => "APORTACION FONDO AHORRO", + // 'amount' => "121.03" + // ], + // [ + // 'deductionTypeCode' => "002", + // 'code' => "ISR", + // 'concept' => "ISR", + // 'amount' => "36.57" + // ], + // [ + // 'deductionTypeCode' => "001", + // 'code' => "IMSS", + // 'concept' => "Cuota de Seguridad Social EE", + // 'amount' => "30.08" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "ZA68", + // 'concept' => "DEDUCCION FDO AHORRO PAT", + // 'amount' => "121.03" + // ], + // [ + // 'deductionTypeCode' => "018", + // 'code' => "ZA11", + // 'concept' => "APORTACION CAJA AHORRO", + // 'amount' => "300.00" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA CON HORAS EXTRA POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina con horas extra por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'employerRegistration' => "B5510768108", + // 'originEmployerTin' => "URE180429TM6" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $escuelaKemperUrgateBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $escuelaKemperUrgateBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "XOJI740919U48", + // 'legalName' => "INGRID XODAR JIMENEZ", + // 'zipCode' => "76028", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'employeeData' => [ + // 'curp' => "XEXX010101HNEXXXA4", + // 'socialSecurityNumber' => "000000", + // 'laborRelationStartDate' => "2015-01-01T00:00:00", + // 'seniority' => "P437W", + // 'satContractTypeId' => "01", + // 'satWorkdayTypeId' => "01", + // 'satTaxRegimeTypeId' => "03", + // 'employeeNumber' => "120", + // 'department' => "Desarrollo", + // 'position' => "Ingeniero de Software", + // 'satJobRiskId' => "1", + // 'satPaymentPeriodicityId' => "04", + // 'satBankId' => "002", + // 'bankAccount' => "1111111111", + // 'baseSalaryForContributions' => "490.22", + // 'integratedDailySalary' => "146.47", + // 'satPayrollStateId' => "JAL" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-05-24T00:00:00", + // 'initialPaymentDate' => "2023-05-09T00:00:00", + // 'finalPaymentDate' => "2023-05-24T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "00500", + // 'concept' => "Sueldos, Salarios Rayas y Jornales", + // 'taxedAmount' => "2808.8", + // 'exemptAmount' => "2191.2" + // ], + // [ + // 'earningTypeCode' => "019", + // 'code' => "00100", + // 'concept' => "Horas Extra", + // 'taxedAmount' => "50.00", + // 'exemptAmount' => "50.00", + // 'overtime' => [ + // [ + // 'days' => 1, + // 'hoursTypeCode' => "01", + // 'extraHours' => 2, + // 'amountPaid' => "100.00" + // ] + // ] + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "001", + // 'code' => "00301", + // 'concept' => "Seguridad Social", + // 'amount' => "200.00" + // ], + // [ + // 'deductionTypeCode' => "002", + // 'code' => "00302", + // 'concept' => "ISR", + // 'amount' => "100" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA CON INCAPACIDADES POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina con incapacidades por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'employerRegistration' => "B5510768108", + // 'originEmployerTin' => "URE180429TM6" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $escuelaKemperUrgateBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $escuelaKemperUrgateBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "XOJI740919U48", + // 'legalName' => "INGRID XODAR JIMENEZ", + // 'zipCode' => "76028", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'employeeData' => [ + // 'curp' => "XEXX010101HNEXXXA4", + // 'socialSecurityNumber' => "000000", + // 'laborRelationStartDate' => "2015-01-01T00:00:00", + // 'seniority' => "P437W", + // 'satContractTypeId' => "01", + // 'satWorkdayTypeId' => "01", + // 'satTaxRegimeTypeId' => "03", + // 'employeeNumber' => "120", + // 'department' => "Desarrollo", + // 'position' => "Ingeniero de Software", + // 'satJobRiskId' => "1", + // 'satPaymentPeriodicityId' => "04", + // 'satBankId' => "002", + // 'bankAccount' => "1111111111", + // 'baseSalaryForContributions' => "490.22", + // 'integratedDailySalary' => "146.47", + // 'satPayrollStateId' => "JAL" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-05-24T00:00:00", + // 'initialPaymentDate' => "2023-05-09T00:00:00", + // 'finalPaymentDate' => "2023-05-24T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "00500", + // 'concept' => "Sueldos, Salarios Rayas y Jornales", + // 'taxedAmount' => "2808.80", + // 'exemptAmount' => "2191.20" + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "001", + // 'code' => "00301", + // 'concept' => "Seguridad Social", + // 'amount' => "200.00" + // ], + // [ + // 'deductionTypeCode' => "002", + // 'code' => "00302", + // 'concept' => "ISR", + // 'amount' => "100.00" + // ] + // ], + // 'disabilities' => [ + // [ + // 'disabilityDays' => 1, + // 'disabilityTypeCode' => "01" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA CON SNCF POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina con SNCF por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "39074", + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "OÑO120726RX3", + // 'legalName' => "ORGANICOS ÑAVEZ OSORIO", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'employerRegistration' => "27112029", + // 'satFundSourceId' => "IP" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $organicosNavezOsorioBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $organicosNavezOsorioBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "CACX7605101P8", + // 'legalName' => "XOCHILT CASAS CHAVEZ", + // 'zipCode' => "36257", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'employeeData' => [ + // 'curp' => "XEXX010101HNEXXXA4", + // 'socialSecurityNumber' => "80997742673", + // 'laborRelationStartDate' => "2021-09-01T00:00:00", + // 'seniority' => "P88W", + // 'satContractTypeId' => "01", + // 'satTaxRegimeTypeId' => "02", + // 'employeeNumber' => "273", + // 'satJobRiskId' => "1", + // 'satPaymentPeriodicityId' => "04", + // 'integratedDailySalary' => "221.48", + // 'satPayrollStateId' => "GRO" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-05-16T00:00:00", + // 'initialPaymentDate' => "2023-05-01T00:00:00", + // 'finalPaymentDate' => "2023-05-16T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "P001", + // 'concept' => "Sueldos, Salarios Rayas y Jornales", + // 'taxedAmount' => "3322.20", + // 'exemptAmount' => "0.0" + // ], + // [ + // 'earningTypeCode' => "038", + // 'code' => "P540", + // 'concept' => "Compensacion", + // 'taxedAmount' => "100.0", + // 'exemptAmount' => "0.0" + // ], + // [ + // 'earningTypeCode' => "038", + // 'code' => "P550", + // 'concept' => "Compensación Garantizada Extraordinaria", + // 'taxedAmount' => "2200.0", + // 'exemptAmount' => "0.0" + // ], + // [ + // 'earningTypeCode' => "038", + // 'code' => "P530", + // 'concept' => "Servicio Extraordinario", + // 'taxedAmount' => "200.0", + // 'exemptAmount' => "0.0" + // ], + // [ + // 'earningTypeCode' => "001", + // 'code' => "P506", + // 'concept' => "Otras Prestaciones", + // 'taxedAmount' => "1500.0", + // 'exemptAmount' => "0.0" + // ], + // [ + // 'earningTypeCode' => "001", + // 'code' => "P505", + // 'concept' => "Remuneración al Desempeño Legislativo", + // 'taxedAmount' => "17500.0", + // 'exemptAmount' => "0.0" + // ] + // ], + // 'otherPayments' => [ + // [ + // 'otherPaymentTypeCode' => "002", + // 'code' => "o002", + // 'concept' => "Subsidio para el empleo efectivamente entregado al trabajador", + // 'amount' => "0.0", + // 'subsidyCaused' => "0.0" + // ] + // ] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "002", + // 'code' => "D002", + // 'concept' => "ISR", + // 'amount' => "4716.61" + // ], + // [ + // 'deductionTypeCode' => "004", + // 'code' => "D525", + // 'concept' => "Redondeo", + // 'amount' => "0.81" + // ], + // [ + // 'deductionTypeCode' => "001", + // 'code' => "D510", + // 'concept' => "Cuota Trabajador ISSSTE", + // 'amount' => "126.78" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA EXTRAORDINARIA (AGUINALDO) POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina extraordinaria (aguinaldo) por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'employerRegistration' => "B5510768108", + // 'originEmployerTin' => "URE180429TM6" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $escuelaKemperUrgateBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $escuelaKemperUrgateBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "XOJI740919U48", + // 'legalName' => "INGRID XODAR JIMENEZ", + // 'zipCode' => "76028", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'employeeData' => [ + // 'curp' => "XEXX010101HNEXXXA4", + // 'socialSecurityNumber' => "000000", + // 'laborRelationStartDate' => "2015-01-01T00:00:00", + // 'seniority' => "P439W", + // 'satContractTypeId' => "01", + // 'satWorkdayTypeId' => "01", + // 'satTaxRegimeTypeId' => "03", + // 'employeeNumber' => "120", + // 'department' => "Desarrollo", + // 'position' => "Ingeniero de Software", + // 'satJobRiskId' => "1", + // 'satPaymentPeriodicityId' => "99", + // 'satBankId' => "002", + // 'bankAccount' => "1111111111", + // 'integratedDailySalary' => "146.47", + // 'satPayrollStateId' => "JAL" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "E", + // 'paymentDate' => "2023-06-04T00:00:00", + // 'initialPaymentDate' => "2023-06-04T00:00:00", + // 'finalPaymentDate' => "2023-06-04T00:00:00", + // 'daysPaid' => 30, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "002", + // 'code' => "00500", + // 'concept' => "Gratificación Anual (Aguinaldo)", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "10000.00" + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA SEPARACIÓN INDEMNIZACIÓN POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina separación indemnización por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'employerRegistration' => "B5510768108", + // 'originEmployerTin' => "URE180429TM6" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $escuelaKemperUrgateBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $escuelaKemperUrgateBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "XOJI740919U48", + // 'legalName' => "INGRID XODAR JIMENEZ", + // 'zipCode' => "76028", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'employeeData' => [ + // 'curp' => "XEXX010101HNEXXXA4", + // 'socialSecurityNumber' => "000000", + // 'laborRelationStartDate' => "2015-01-01T00:00:00", + // 'seniority' => "P439W", + // 'satContractTypeId' => "01", + // 'satWorkdayTypeId' => "01", + // 'satTaxRegimeTypeId' => "03", + // 'employeeNumber' => "120", + // 'department' => "Desarrollo", + // 'position' => "Ingeniero de Software", + // 'satJobRiskId' => "1", + // 'satPaymentPeriodicityId' => "99", + // 'satBankId' => "002", + // 'bankAccount' => "1111111111", + // 'integratedDailySalary' => "146.47", + // 'satPayrollStateId' => "JAL" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "E", + // 'paymentDate' => "2023-06-04T00:00:00", + // 'initialPaymentDate' => "2023-05-05T00:00:00", + // 'finalPaymentDate' => "2023-06-04T00:00:00", + // 'daysPaid' => 30, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "023", + // 'code' => "00500", + // 'concept' => "Pagos por separación", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "10000.00" + // ], + // [ + // 'earningTypeCode' => "025", + // 'code' => "00900", + // 'concept' => "Indemnizaciones", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "500.00" + // ] + // ], + // 'otherPayments' => [], + // 'severance' => [ + // 'totalPaid' => "10500.00", + // 'yearsOfService' => 1, + // 'lastMonthlySalary' => "10000.00", + // 'accumulableIncome' => "10000.00", + // 'nonAccumulableIncome' => "0.00" + // ] + // ], + // 'deductions' => [] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA JUBILACIÓN POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina jubilación por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'employerRegistration' => "B5510768108", + // 'originEmployerTin' => "URE180429TM6" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $escuelaKemperUrgateBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $escuelaKemperUrgateBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "XOJI740919U48", + // 'legalName' => "INGRID XODAR JIMENEZ", + // 'zipCode' => "76028", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'employeeData' => [ + // 'curp' => "XEXX010101HNEXXXA4", + // 'socialSecurityNumber' => "000000", + // 'laborRelationStartDate' => "2015-01-01T00:00:00", + // 'seniority' => "P439W", + // 'satContractTypeId' => "01", + // 'satWorkdayTypeId' => "01", + // 'satTaxRegimeTypeId' => "03", + // 'employeeNumber' => "120", + // 'department' => "Desarrollo", + // 'position' => "Ingeniero de Software", + // 'satJobRiskId' => "1", + // 'satPaymentPeriodicityId' => "99", + // 'satBankId' => "002", + // 'bankAccount' => "1111111111", + // 'integratedDailySalary' => "146.47", + // 'satPayrollStateId' => "JAL" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "E", + // 'paymentDate' => "2023-05-05T00:00:00", + // 'initialPaymentDate' => "2023-06-04T00:00:00", + // 'finalPaymentDate' => "2023-06-04T00:00:00", + // 'daysPaid' => 30, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "039", + // 'code' => "00500", + // 'concept' => "Jubilaciones, pensiones o haberes de retiro", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "10000.00" + // ] + // ], + // 'otherPayments' => [], + // 'retirement' => [ + // 'totalOneTime' => "10000.00", + // 'accumulableIncome' => "10000.00", + // 'nonAccumulableIncome' => "0.00" + // ] + // ], + // 'deductions' => [] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA SIN DEDUCCIONES POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina sin deducciones por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'employerRegistration' => "B5510768108", + // 'originEmployerTin' => "URE180429TM6" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $escuelaKemperUrgateBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $escuelaKemperUrgateBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "XOJI740919U48", + // 'legalName' => "INGRID XODAR JIMENEZ", + // 'zipCode' => "76028", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'employeeData' => [ + // 'curp' => "XEXX010101HNEXXXA4", + // 'socialSecurityNumber' => "000000", + // 'laborRelationStartDate' => "2015-01-01T00:00:00", + // 'seniority' => "P437W", + // 'satContractTypeId' => "01", + // 'satWorkdayTypeId' => "01", + // 'satTaxRegimeTypeId' => "03", + // 'employeeNumber' => "120", + // 'department' => "Desarrollo", + // 'position' => "Ingeniero de Software", + // 'satJobRiskId' => "1", + // 'satPaymentPeriodicityId' => "04", + // 'satBankId' => "002", + // 'bankAccount' => "1111111111", + // 'baseSalaryForContributions' => "490.22", + // 'integratedDailySalary' => "146.47", + // 'satPayrollStateId' => "JAL" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-05-24T00:00:00", + // 'initialPaymentDate' => "2023-05-09T00:00:00", + // 'finalPaymentDate' => "2023-05-24T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "00500", + // 'concept' => "Sueldos, Salarios Rayas y Jornales", + // 'taxedAmount' => "2808.8", + // 'exemptAmount' => "2191.2" + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA VIÁTICOS POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina viáticos por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'employerRegistration' => "B5510768108", + // 'originEmployerTin' => "URE180429TM6" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $escuelaKemperUrgateBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $escuelaKemperUrgateBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "XOJI740919U48", + // 'legalName' => "INGRID XODAR JIMENEZ", + // 'zipCode' => "76028", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'employeeData' => [ + // 'curp' => "XEXX010101HNEXXXA4", + // 'socialSecurityNumber' => "000000", + // 'laborRelationStartDate' => "2015-01-01T00:00:00", + // 'seniority' => "P438W", + // 'satContractTypeId' => "01", + // 'satWorkdayTypeId' => "01", + // 'satTaxRegimeTypeId' => "03", + // 'employeeNumber' => "120", + // 'department' => "Desarrollo", + // 'position' => "Ingeniero de Software", + // 'satJobRiskId' => "1", + // 'satPaymentPeriodicityId' => "04", + // 'satBankId' => "002", + // 'bankAccount' => "1111111111", + // 'baseSalaryForContributions' => "490.22", + // 'integratedDailySalary' => "146.47", + // 'satPayrollStateId' => "JAL" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-09-26T00:00:00", + // 'initialPaymentDate' => "2023-09-11T00:00:00", + // 'finalPaymentDate' => "2023-09-26T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "050", + // 'code' => "050", + // 'concept' => "Viaticos", + // 'taxedAmount' => "0.00", + // 'exemptAmount' => "3000.00" + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "081", + // 'code' => "081", + // 'concept' => "Ajuste en viaticos entregados al trabajador", + // 'amount' => "3000.00" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA SUBSIDIO CAUSADO AL EMPLEO POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina subsidio causado al empleo por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'employerRegistration' => "B5510768108", + // 'originEmployerTin' => "URE180429TM6" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $escuelaKemperUrgateBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $escuelaKemperUrgateBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "XOJI740919U48", + // 'legalName' => "INGRID XODAR JIMENEZ", + // 'zipCode' => "76028", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'employeeData' => [ + // 'curp' => "XEXX010101HNEXXXA4", + // 'socialSecurityNumber' => "000000", + // 'laborRelationStartDate' => "2015-01-01T00:00:00", + // 'seniority' => "P437W", + // 'satContractTypeId' => "01", + // 'satWorkdayTypeId' => "01", + // 'satTaxRegimeTypeId' => "02", + // 'employeeNumber' => "120", + // 'department' => "Desarrollo", + // 'position' => "Ingeniero de Software", + // 'satJobRiskId' => "1", + // 'satPaymentPeriodicityId' => "04", + // 'satBankId' => "002", + // 'bankAccount' => "1111111111", + // 'baseSalaryForContributions' => "490.22", + // 'integratedDailySalary' => "146.47", + // 'satPayrollStateId' => "JAL" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-05-24T00:00:00", + // 'initialPaymentDate' => "2023-05-09T00:00:00", + // 'finalPaymentDate' => "2023-05-24T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "00500", + // 'concept' => "Sueldos, Salarios Rayas y Jornales", + // 'taxedAmount' => "2808.8", + // 'exemptAmount' => "2191.2" + // ] + // ], + // 'otherPayments' => [ + // [ + // 'otherPaymentTypeCode' => "007", + // 'code' => "0002", + // 'concept' => "ISR ajustado por subsidio", + // 'amount' => "145.80", + // 'subsidyCaused' => "0.0" + // ] + // ] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "107", + // 'code' => "D002", + // 'concept' => "Ajuste al Subsidio Causado", + // 'amount' => "160.35" + // ], + // [ + // 'deductionTypeCode' => "002", + // 'code' => "D002", + // 'concept' => "ISR", + // 'amount' => "145.80" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + + // ================================================================== + // NÓMINA BÁSICA POR VALORES + // ================================================================== + + // ------------------------------------------------------------------ + // Crear nómina básica por valores + // ------------------------------------------------------------------ + // $invoice = [ + // 'versionCode' => "4.0", + // 'series' => "F", + // 'date' => $currentDate, + // 'typeCode' => "N", + // 'paymentMethodCode' => "PUE", + // 'currencyCode' => "MXN", + // 'expeditionZipCode' => "20000", + // 'exportCode' => "01", + // 'issuer' => [ + // 'tin' => "EKU9003173C9", + // 'legalName' => "ESCUELA KEMPER URGATE", + // 'taxRegimeCode' => "601", + // 'employerData' => [ + // 'employerRegistration' => "B5510768108", + // 'originEmployerTin' => "URE180429TM6" + // ], + // 'taxCredentials' => [ + // [ + // 'base64File' => $escuelaKemperUrgateBase64Cer, + // 'fileType' => 0, + // 'password' => $password + // ], + // [ + // 'base64File' => $escuelaKemperUrgateBase64Key, + // 'fileType' => 1, + // 'password' => $password + // ] + // ] + // ], + // 'recipient' => [ + // 'tin' => "XOJI740919U48", + // 'legalName' => "INGRID XODAR JIMENEZ", + // 'zipCode' => "76028", + // 'taxRegimeCode' => "605", + // 'cfdiUseCode' => "CN01", + // 'employeeData' => [ + // 'curp' => "XEXX010101HNEXXXA4", + // 'socialSecurityNumber' => "000000", + // 'laborRelationStartDate' => "2015-01-01T00:00:00", + // 'seniority' => "P437W", + // 'satContractTypeId' => "01", + // 'satWorkdayTypeId' => "01", + // 'satTaxRegimeTypeId' => "03", + // 'employeeNumber' => "120", + // 'department' => "Desarrollo", + // 'position' => "Ingeniero de Software", + // 'satJobRiskId' => "1", + // 'satPaymentPeriodicityId' => "04", + // 'satBankId' => "002", + // 'bankAccount' => "1111111111", + // 'baseSalaryForContributions' => "490.22", + // 'integratedDailySalary' => "146.47", + // 'satPayrollStateId' => "JAL" + // ] + // ], + // 'complement' => [ + // 'payroll' => [ + // 'version' => "1.2", + // 'payrollTypeCode' => "O", + // 'paymentDate' => "2023-05-24T00:00:00", + // 'initialPaymentDate' => "2023-05-09T00:00:00", + // 'finalPaymentDate' => "2023-05-24T00:00:00", + // 'daysPaid' => 15, + // 'earnings' => [ + // 'earnings' => [ + // [ + // 'earningTypeCode' => "001", + // 'code' => "00500", + // 'concept' => "Sueldos, Salarios Rayas y Jornales", + // 'taxedAmount' => "2808.8", + // 'exemptAmount' => "2191.2" + // ] + // ], + // 'otherPayments' => [] + // ], + // 'deductions' => [ + // [ + // 'deductionTypeCode' => "001", + // 'code' => "00301", + // 'concept' => "Seguridad Social", + // 'amount' => "200" + // ], + // [ + // 'deductionTypeCode' => "002", + // 'code' => "00302", + // 'concept' => "ISR", + // 'amount' => "100" + // ] + // ] + // ] + // ] + // ]; + // $apiResponse = $client->getInvoiceService()->create($invoice); + // consoleLog($apiResponse); + + +} catch (\Exception $e) { + consoleError($e); +} + +function consoleLog(FiscalApiHttpResponseInterface $apiResponse): void +{ + echo "apiResponse:\n" . json_encode($apiResponse->getJson(), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . PHP_EOL; +} + +function consoleError(\Exception $e): void +{ + echo "Error: " . $e->getMessage() . PHP_EOL; +} + +/** + * Obtiene la fecha actual en formato ISO 8601 sin zona horaria. + */ +function getCurrentDate(): string +{ + return (new \DateTime())->format('Y-m-d\TH:i:s'); +} diff --git a/examples/EjemplosTimbres.php b/examples/EjemplosTimbres.php new file mode 100644 index 0000000..1d764cc --- /dev/null +++ b/examples/EjemplosTimbres.php @@ -0,0 +1,86 @@ +', + '', + false, // Imprimir raw request / response + false, // Desactivar verificación SSL +); + +// Crear cliente HTTP +$client = new FiscalApiClient($settings); + +try { + + // ------------------------------------------------------------------ + // Listar movimientos de timbres: pageNumber=1, pageSize=10 + // ------------------------------------------------------------------ + // $apiResponse = $client->getStampService()->list(1, 10); + // consoleLog($apiResponse); + + + // ------------------------------------------------------------------ + // Obtener movimiento de timbres por ID + // ------------------------------------------------------------------ + // $apiResponse = $client->getStampService()->get("e29720d5-fa29-4690-bdb3-9fc8344fcef8"); + // consoleLog($apiResponse); + + + // ------------------------------------------------------------------ + // Transferir timbres + // ------------------------------------------------------------------ + // $transParams = [ + // 'fromPersonId' => "0e82a655-5f0c-4e07-abab-8f322e4123ef", + // 'toPersonId' => "da71df0c-f328-45ee-9bd9-3096ed02c164", + // 'amount' => 1, + // 'comments' => "venta de timbres", + // ]; + // $apiResponse = $client->getStampService()->transferStamps($transParams); + // consoleLog($apiResponse); + + + // ------------------------------------------------------------------ + // Retirar timbres + // ------------------------------------------------------------------ + // $transParams = [ + // 'fromPersonId' => "da71df0c-f328-45ee-9bd9-3096ed02c164", + // 'toPersonId' => "0e82a655-5f0c-4e07-abab-8f322e4123ef", + // 'amount' => 1, + // 'comments' => "prestamo", + // ]; + // $apiResponse = $client->getStampService()->withdrawStamps($transParams); + // consoleLog($apiResponse); + + +} catch (\Exception $e) { + consoleError($e); +} + +function consoleLog(FiscalApiHttpResponseInterface $apiResponse) { + echo "apiResponse:\n" . json_encode($apiResponse->getJson(), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n\n"; +} + +function consoleError(\Exception $e) { + echo "Error en la ejecución: " . $e->getMessage() . "\n"; + echo "Traza: " . $e->getTraceAsString() . "\n"; +} diff --git a/examples.php b/examples/examples.php similarity index 99% rename from examples.php rename to examples/examples.php index b351852..1dc06cc 100644 --- a/examples.php +++ b/examples/examples.php @@ -883,9 +883,9 @@ // 'taxObjectCode' => "01" // ] // ], - // // Sección de pagos - específica para complementos de pago - // 'payments' => [ - // [ + // // Complemento de pago + // 'complement' => [ + // 'payment' => [ // 'paymentDate' => "2025-03-31T14:44:56", // Fecha del pago // 'paymentFormCode' => "28", // 28 - Tarjeta de débito // 'currencyCode' => "MXN", @@ -948,9 +948,9 @@ // // Nota: No se necesita la sección "items" cuando se usa el enfoque por referencias, // // ya que el sistema generará automáticamente el concepto requerido - // // Sección de pagos - específica para complementos de pago - // 'payments' => [ - // [ + // // Complemento de pago + // 'complement' => [ + // 'payment' => [ // 'paymentDate' => "2025-03-31T14:44:56", // Actualizado a una fecha más reciente // 'paymentFormCode' => "28", // 28 - Tarjeta de débito // 'currencyCode' => "MXN", @@ -1038,9 +1038,9 @@ // 'taxObjectCode' => "01" // ] // ], - // // Sección de pagos - específica para complementos de pago - // 'payments' => [ - // [ + // // Complemento de pago + // 'complement' => [ + // 'payment' => [ // 'paymentDate' => "2025-03-31T14:44:56", // Actualizado a una fecha más reciente // 'paymentFormCode' => "28", // 28 - Tarjeta de débito // 'currencyCode' => "USD", // El pago se realizó en dólares @@ -1141,9 +1141,9 @@ // 'taxObjectCode' => "01" // ] // ], - // // Sección de pagos - específica para complementos de pago - // 'payments' => [ - // [ + // // Complemento de pago + // 'complement' => [ + // 'payment' => [ // 'paymentDate' => "2025-03-31T14:44:56", // Actualizado a una fecha más reciente // 'paymentFormCode' => "28", // 28 - Tarjeta de débito // 'currencyCode' => "MXN", // El pago se realizó en pesos mexicanos @@ -1242,9 +1242,9 @@ // 'taxObjectCode' => "01" // ] // ], - // // Sección de pagos - específica para complementos de pago - // 'payments' => [ - // [ + // // Complemento de pago + // 'complement' => [ + // 'payment' => [ // 'paymentDate' => "2024-06-03T14:44:56", // Fecha del pago // 'paymentFormCode' => "28", // 28 - Tarjeta de débito // 'currencyCode' => "EUR", // El pago se realizó en euros From 7cf121b7a89ca298aba5f5e4d092c5380d1c79e4 Mon Sep 17 00:00:00 2001 From: Jose Antonio Medina Date: Mon, 2 Mar 2026 21:30:59 -0600 Subject: [PATCH 6/7] Updated page size for stamp interface service --- src/Services/TaxFileServiceInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Services/TaxFileServiceInterface.php b/src/Services/TaxFileServiceInterface.php index 45fb31f..c961b25 100644 --- a/src/Services/TaxFileServiceInterface.php +++ b/src/Services/TaxFileServiceInterface.php @@ -17,7 +17,7 @@ interface TaxFileServiceInterface extends FiscalApiServiceInterface * @param int $pageSize Tamaño de página * @return FiscalApiHttpResponseInterface */ - public function list(int $pageNumber = 1, int $pageSize = 20): FiscalApiHttpResponseInterface; + public function list(int $pageNumber = 1, int $pageSize = 10): FiscalApiHttpResponseInterface; /** * Obtiene un archivo fiscal por su ID From 6e5813202d874941fd0d10c41a2b59f49723482c Mon Sep 17 00:00:00 2001 From: Jose Antonio Medina Date: Mon, 2 Mar 2026 21:43:41 -0600 Subject: [PATCH 7/7] Fixed typo in readme.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c719cd..deb1d78 100644 --- a/README.md +++ b/README.md @@ -425,7 +425,7 @@ if ($apiResponse->succeeded) { - **Impuestos Locales** Agregar complemento de impuestos locales (traslados y retenciones locales) a facturas de ingreso. - **Empleadores y Empleados** - Gestión de datos de empleador (patrón) y empleado asociados a personas, necesarios para factuación de nómina. + Gestión de datos de empleador (patrón) y empleado asociados a personas, necesarios para facturación de nómina. - **Personas (Clientes/Emisores)** Alta y administración de personas, gestión de certificados (CSD). - **Productos y Servicios**