Skip to content

v4.0.386 complemento-comercio-exterior added#6

Merged
mendozagit merged 1 commit into
mainfrom
feat/comercio-exterior
May 21, 2026
Merged

v4.0.386 complemento-comercio-exterior added#6
mendozagit merged 1 commit into
mainfrom
feat/comercio-exterior

Conversation

@mendozagit
Copy link
Copy Markdown
Contributor

@mendozagit mendozagit commented May 21, 2026

v4.0.386 complemento-comercio-exterior added

Summary by CodeRabbit

  • New Features
    • Extended invoice functionality to support Comercio Exterior (foreign trade) operations across multiple scenarios including items with different currencies, transportation carriers, and merchant classifications
    • Added digital manifest signing capability for official document authentication and certification workflows
    • Included multiple example scripts demonstrating practical implementations of both invoice creation and manifest signing operations with various real-world configurations

Review Change Stack

@mendozagit mendozagit merged commit 569959a into main May 21, 2026
1 check was pending
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 42350c44-99ef-4428-9c5b-4e746c2b447c

📥 Commits

Reviewing files that changed from the base of the PR and between 18a6a1e and f6b2b09.

📒 Files selected for processing (12)
  • examples/ejemplos-factura-comercio-exterior-referencias.py
  • examples/ejemplos-factura-comercio-exterior-valores.py
  • examples/ejemplos-firma-manifiestos.py
  • fiscalapi/__init__.py
  • fiscalapi/models/__init__.py
  • fiscalapi/models/comercio_exterior_models.py
  • fiscalapi/models/fiscalapi_models.py
  • fiscalapi/models/manifest_models.py
  • fiscalapi/services/__init__.py
  • fiscalapi/services/fiscalapi_client.py
  • fiscalapi/services/manifest_service.py
  • setup.py

📝 Walkthrough

Walkthrough

This PR adds comprehensive support for Mexico's Comercio Exterior (international trade) CFDI complements and manifest signing. It includes ten new Pydantic models for trade data structures, extends existing invoice DTOs, implements a manifest signing service, updates SDK exports, and provides detailed examples across two invoice construction modes with nine scenarios each.

Changes

Comercio Exterior CFDI Complement and Manifest Signing Support

Layer / File(s) Summary
Comercio Exterior data models
fiscalapi/models/comercio_exterior_models.py
Ten Pydantic models define the CFDI Comercio Exterior complement: address classes for exporter/importer/destinatario, person entities with tax IDs and residency, merchandise items with specific descriptions, and the main ComercioExteriorComplement with exchange rates and transaction metadata. All models use CFDI field aliases and Decimal serialization for monetary fields.
Manifest signing models
fiscalapi/models/manifest_models.py
SignManifestRequest captures FIEL certificate (base64), private key (base64), and password for cartaManifiesto signing; SignManifestResponse returns the signed PDF file, name, and extension with optional fields for flexible response handling.
Invoice DTO extensions for commerce exterior
fiscalapi/models/fiscalapi_models.py
Person model gains country_id and foreign_tin fields for foreign residency; InvoiceRecipient gains country_id for foreign recipient country code; InvoiceComplement gains comercio_exterior field to attach the new complement.
Manifest service and client wiring
fiscalapi/services/manifest_service.py, fiscalapi/services/fiscalapi_client.py
ManifestService extends BaseService with a sign() method posting to the manifests endpoint; FiscalApiClient.__init__ instantiates and wires ManifestService as self.manifests.
SDK package exports
fiscalapi/__init__.py, fiscalapi/models/__init__.py, fiscalapi/services/__init__.py
Top-level SDK imports now expose all ten ComercioExterior* models, SignManifestRequest/Response, and ManifestService, making them available from fiscalapi.* namespace.
Commerce Exterior Por Referencias examples
examples/ejemplos-factura-comercio-exterior-referencias.py
Nine scenarios (1182 lines) demonstrating reference-based invoice construction: ingreso/traslado variants, kit items, foreign/domestic recipients, currency conversions, and non-equivalent units. Each scenario includes person upsert and invoice creation patterns using referenced issuer/recipient IDs.
Commerce Exterior Por Valores examples
examples/ejemplos-factura-comercio-exterior-valores.py
Nine scenarios (1133 lines) for value-based invoices with inline person data: same variants as Por Referencias, demonstrating direct value specification and transport (CartaPorte) integration patterns.
Manifest signing example
examples/ejemplos-firma-manifiestos.py
Demonstrates signing a cartaManifiesto: configures FiscalAPI settings, defines FIEL certificate/key/password constants, constructs and submits SignManifestRequest, and handles the response with error handling.
Version bump
setup.py
Package version incremented from 4.0.384 to 4.0.386.

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

  • FiscalAPI/fiscalapi-python#5: Modifies InvoiceComplement model in fiscalapi_models.py to update complement field aliases—related to the same DTO extension patterns.

Poem

🐰 Commerce flows across the border now,
With Comercio Exterior, we know how,
Manifests signed in a rabbit's way,
More complements ready for trade today! 📜

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/comercio-exterior

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant