Skip to content

Conversation

@mendozagit
Copy link
Contributor

--- Pull Request: Soporte para Facturas de Nómina (CFDI de Nómina) y Servicio de Timbres

Summary
Agrega soporte completo para facturas de nómina (CFDI de Nómina) con los 13 tipos de nómina del SAT, además de un nuevo servicio para gestión de timbres fiscales.

Cambios principales:

  • Soporte completo para los 13 tipos de CFDI de Nómina (ordinaria, asimilados, bonos, horas extra, incapacidades, etc.)
  • Nuevo StampService para gestionar transacciones de timbres
  • Nuevos servicios EmployeeService y EmployerService para datos de nómina
  • Más de 3,600 líneas de ejemplos documentados
  • Elimina soporte para python 3.7, compatible Pydantic v2 y Python 3.9+

Ejemplos de Nómina (13 casos de uso por valores y referencias)

  • Nómina Ordinaria
  • Asimilados a Salarios
  • Bonos y Fondo de Ahorro
  • Horas Extra
  • Incapacidades
  • SNCF (Gobierno Federal)
  • Extraordinaria
  • Separación e Indemnización
  • Jubilación, Pensión, Retiro
  • Sin Deducciones
  • Subsidio Causado
  • Viáticos
  • Nómina Básica

Servicio de Timbres (StampService)

  • get_list() - Listar transacciones con paginación
  • get_by_id() - Consultar transacción por ID
  • transfer_stamps() - Transferir timbres entre personas
  • withdraw_stamps() - Retirar timbres

Servicios de Empleado/Empleador

  • EmployeeService - CRUD para datos de empleado
  • EmployerService - CRUD para datos de empleador
  • Accesibles via client.people.employee y client.people.employer

JesusMendoza and others added 28 commits January 18, 2026 18:32
- Remove TypeVar bound constraint to allow ApiResponse[bool], ApiResponse[list[str]]
- Remove invalid http_status_code parameter from ApiResponse instantiations
- Convert deprecated class Config to model_config = ConfigDict()
- Standardize List/Dict type hints to Python 3.9+ built-in list/dict
- Fix mutable default arguments using default_factory=list
- Add missing model_config to PagedList and ValidationFailure
- Add return type annotation to InvoiceService.send() method
- Add Any type annotation to **kwargs in base_service.py methods
- Add default=None to ApiResponse Optional fields (message, details)
- Fix dict type annotation to dict[str, Any] in ValidationFailure
- Fix TaxFile.file_type to Optional[Literal[0, 1]]
- Replace List[...] with list[...] in download_request_service.py
Type annotations already prevent None from being passed, making
these runtime checks redundant and causing Pylance warnings about
conditions that always evaluate to False.
- Remove Optional from issuer/recipient fields (they use Field(...) which is required)
- Add Optional to base64_cancellation_acknowledgement (has default=None)
- Add model_config to TaxCredential, InvoiceIssuer, InvoiceRecipient,
  GlobalInformation, and RelatedInvoice for consistency
Replace Field(..., alias) with Field(default=..., alias) pattern
to help Pylance/Pyright properly infer field types.
- Add explicit default= to FiscalApiSettings optional fields
- Change int defaults to Decimal("1") for Decimal fields to satisfy Pylance
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update Python version requirement to >= 3.9 (CI/CD uses 3.9.13)
- Add development setup instructions
- Add Pydantic v2 compatibility guidelines
- Add type annotation standards

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add http_status_code field to ApiResponse in common_models.py
- Restore http_status_code parameter in all ApiResponse instantiations in base_service.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add EmployeeData and EmployerData models for CFDI nomina support
- Add EmployeeService and EmployerService as sub-resources of PeopleService
- Fix typo: rename tax_file_servive.py to tax_file_service.py
- Add py.typed marker for PEP 561 type checking support
- Add MANIFEST.in for proper sdist packaging
- Reorganize exports in __init__.py files for models and services
- Export BaseService for custom service implementations
- Fix ValidationFailure model to use snake_case with aliases
- Remove debug print statements from base_service.py
- Remove commented-out code from base_service.py
- Fix indentation in TaxFileService

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Simplify InvoiceService to use single /invoices endpoint
- Add complement models for localTaxes, payment, payroll, and lading
- Add new invoice sub-models (ItemTax, ItemOnBehalfOf, ItemCustomsInfo, etc.)
- Add InvoiceIssuerEmployerData and InvoiceRecipientEmployeeData models
- Update InvoiceIssuer, InvoiceRecipient, InvoiceItem, and Invoice models
- Invoice type now determined by type_code field (I, E, P, N, T)
- Add "Facturas de Nomina" section in examples.py with complete payroll invoice example
- Fix seniority field type from int to str (ISO 8601 duration format)
- Fix labor_relation_start_date field type from datetime to str
- Add ejemplos-nomina.py with complete payroll invoice example
- Add pyproject.toml with Pyright/Ruff configuration
- Configure linters to ignore Pydantic field name warnings
Add 13 SDK examples covering different payroll scenarios:
- Regular payroll (ordinaria)
- Assimilated salaries (asimilados)
- Bonuses, savings fund and deductions
- Overtime (horas extra)
- Disabilities (incapacidades)
- SNCF for public organizations
- Extraordinary payroll (aguinaldo)
- Severance and indemnification
- Retirement and pension
- Payroll without deductions
- Employment subsidy
- Travel expenses (viaticos)
- Basic payroll

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add facturas-de-complemento-pago.py with examples for payment complement invoices
  - Por valores: inline issuer/recipient data with tax credentials
  - Por referencias: using pre-created issuer/recipient IDs
- Uses correct structure: complement.payment (PaymentComplement) instead of deprecated payments field
- Rename ejemplos-nomina.py to facturas-de-nomina.py for consistency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…mina types

Adds 13 setup methods (_references_setup_data) that configure employee/employer
data, and 12 new invoice methods (_references) that create payroll invoices using
only person IDs instead of inline data. Also adds curp field to Person model.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comprehensive documentation for implementing CFDI Nomina support in any
FiscalAPI SDK, covering all 13 payroll types, models, services, and
both operation modes (by values and by references).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add UserLookupDto, StampTransaction, StampTransactionParams models
- Create StampService with get_list, get_by_id, transfer_stamps, withdraw_stamps methods
- Add stamps property to FiscalApiClient facade
- Add ejemplos-timbres.py with usage examples

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add payroll invoice support (13 CFDI types) to features section
- Add new "Gestión de Timbres" section documenting StampService
- Add direct links to example files (nomina, timbres, complemento pago)
- Remove local development credentials from example files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add StampService to services/__init__.py exports
- Update CLAUDE.md with complete service list, example files, and new sections
- Add StampService documentation to payroll-requirements.md
- Update implementation checklist with completed items
- Bump version to 4.0.360

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants