intifact 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- intifact-1.0.0/PKG-INFO +180 -0
- intifact-1.0.0/README.md +161 -0
- intifact-1.0.0/intifact.egg-info/PKG-INFO +180 -0
- intifact-1.0.0/intifact.egg-info/SOURCES.txt +200 -0
- intifact-1.0.0/intifact.egg-info/dependency_links.txt +1 -0
- intifact-1.0.0/intifact.egg-info/requires.txt +4 -0
- intifact-1.0.0/intifact.egg-info/top_level.txt +1 -0
- intifact-1.0.0/intifact_sdk/__init__.py +228 -0
- intifact-1.0.0/intifact_sdk/api/__init__.py +17 -0
- intifact-1.0.0/intifact_sdk/api/auth_api.py +2242 -0
- intifact-1.0.0/intifact_sdk/api/branches_api.py +1130 -0
- intifact-1.0.0/intifact_sdk/api/company_api.py +1581 -0
- intifact-1.0.0/intifact_sdk/api/despatch_api.py +1643 -0
- intifact-1.0.0/intifact_sdk/api/documents_api.py +1816 -0
- intifact-1.0.0/intifact_sdk/api/invoice_api.py +1360 -0
- intifact-1.0.0/intifact_sdk/api/note_api.py +1342 -0
- intifact-1.0.0/intifact_sdk/api/plans_api.py +1064 -0
- intifact-1.0.0/intifact_sdk/api/public_api.py +976 -0
- intifact-1.0.0/intifact_sdk/api/queues_api.py +280 -0
- intifact-1.0.0/intifact_sdk/api/summary_api.py +1411 -0
- intifact-1.0.0/intifact_sdk/api/system_api.py +1272 -0
- intifact-1.0.0/intifact_sdk/api/webhooks_api.py +2388 -0
- intifact-1.0.0/intifact_sdk/api_client.py +833 -0
- intifact-1.0.0/intifact_sdk/api_response.py +21 -0
- intifact-1.0.0/intifact_sdk/configuration.py +645 -0
- intifact-1.0.0/intifact_sdk/exceptions.py +218 -0
- intifact-1.0.0/intifact_sdk/models/__init__.py +94 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_auth_login_post_request.py +98 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_auth_signup_post_request.py +102 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_boleta_cancel_post_request.py +121 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_catalogs_get200_response.py +110 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_catalogs_get200_response_data_inner.py +122 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_catalogs_get200_response_data_inner_items_inner.py +113 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_cdr_consultar_post200_response.py +138 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_cdr_consultar_post_request.py +102 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_companies_claim_post_request.py +110 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_companies_id_branches_branch_id_put_request.py +103 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_companies_id_branches_post_request.py +112 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_companies_id_put_request.py +181 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_companies_post_request.py +181 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_companies_post_request_cuentas_bancarias_inner.py +103 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_multi_post202_response.py +114 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_multi_post202_response_data.py +114 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_multi_post202_response_data_guias_inner.py +123 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_multi_post_request.py +302 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_multi_post_request_destinos_inner.py +147 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_post_request.py +367 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_post_request_chofer_inner.py +106 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_post_request_contenedores_inner.py +91 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_post_request_detalle_inner.py +95 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_post_request_documentos_relacionados_inner.py +95 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_post_request_guia_llegada_geo.py +90 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_post_request_guia_partida_geo.py +100 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_post_request_indicadores.py +100 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_send_post_request_vehiculos_secundarios_inner.py +95 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_transportista_send_post_request.py +263 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_despatch_transportista_send_post_request_vehiculos_secundarios_inner.py +91 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_documents_get200_response.py +116 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_documents_get200_response_data_inner.py +219 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_documents_get200_response_data_inner_company.py +113 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_documents_get200_response_pagination.py +107 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_documents_id_recover_post200_response.py +122 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_documents_id_retry_post202_response.py +115 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_documents_next_correlativo_get200_response.py +107 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_documents_next_correlativo_get200_response_data.py +106 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_cancel_post_request.py +130 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_compute_post200_response.py +114 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_compute_post200_response_data.py +150 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_compute_post200_response_data_items_inner.py +167 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_compute_post_request.py +106 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_compute_post_request_items_inner.py +118 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_compute_post_request_items_inner_descuento.py +91 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_send_post202_response.py +114 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_send_post202_response_data.py +137 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_send_post400_response.py +124 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_send_post400_response_errors_inner.py +113 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_send_post_request.py +225 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_send_post_request_detalle_inner.py +126 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_send_post_request_detraccion.py +104 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_send_post_request_forma_pago_inner.py +107 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_send_post_request_guia_remision_inner.py +108 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_send_post_request_leyendas_inner.py +91 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_invoice_send_post_request_pagos_inner.py +91 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_note_compute_post_request.py +106 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_note_compute_post_request_items_inner.py +113 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_note_send_post202_response.py +114 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_note_send_post202_response_data.py +114 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_note_send_post_request.py +215 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_note_send_post_request_detalle_inner.py +121 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_plans_id_put_request.py +105 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_plans_post_request.py +114 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_queues_stats_get200_response.py +107 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_queues_stats_get200_response_data.py +109 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_summary_send_post202_response.py +114 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_summary_send_post202_response_data.py +127 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_summary_send_post_request.py +121 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_summary_send_post_request_items_inner.py +153 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_ticket_ticket_status_get200_response.py +121 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_ticket_ticket_status_get200_response_cdr_response.py +122 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_ticket_ticket_status_get202_response.py +121 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_ticket_ticket_status_get202_response_cdr_response.py +122 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_voided_send_post_request.py +121 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_voided_send_post_request_items_inner.py +114 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_webhooks_id_put_request.py +106 -0
- intifact-1.0.0/intifact_sdk/models/api_v1_webhooks_post_request.py +118 -0
- intifact-1.0.0/intifact_sdk/py.typed +0 -0
- intifact-1.0.0/intifact_sdk/rest.py +334 -0
- intifact-1.0.0/pyproject.toml +96 -0
- intifact-1.0.0/setup.cfg +7 -0
- intifact-1.0.0/setup.py +47 -0
- intifact-1.0.0/test/test_api_v1_auth_login_post_request.py +54 -0
- intifact-1.0.0/test/test_api_v1_auth_signup_post_request.py +57 -0
- intifact-1.0.0/test/test_api_v1_boleta_cancel_post_request.py +59 -0
- intifact-1.0.0/test/test_api_v1_catalogs_get200_response.py +72 -0
- intifact-1.0.0/test/test_api_v1_catalogs_get200_response_data_inner.py +64 -0
- intifact-1.0.0/test/test_api_v1_catalogs_get200_response_data_inner_items_inner.py +54 -0
- intifact-1.0.0/test/test_api_v1_cdr_consultar_post200_response.py +60 -0
- intifact-1.0.0/test/test_api_v1_cdr_consultar_post_request.py +58 -0
- intifact-1.0.0/test/test_api_v1_companies_claim_post_request.py +59 -0
- intifact-1.0.0/test/test_api_v1_companies_id_branches_branch_id_put_request.py +58 -0
- intifact-1.0.0/test/test_api_v1_companies_id_branches_post_request.py +60 -0
- intifact-1.0.0/test/test_api_v1_companies_id_put_request.py +87 -0
- intifact-1.0.0/test/test_api_v1_companies_post_request.py +89 -0
- intifact-1.0.0/test/test_api_v1_companies_post_request_cuentas_bancarias_inner.py +63 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_multi_post202_response.py +71 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_multi_post202_response_data.py +82 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_multi_post202_response_data_guias_inner.py +63 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_multi_post_request.py +198 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_multi_post_request_destinos_inner.py +88 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_post_request.py +184 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_post_request_chofer_inner.py +62 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_post_request_contenedores_inner.py +53 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_post_request_detalle_inner.py +58 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_post_request_documentos_relacionados_inner.py +56 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_post_request_guia_llegada_geo.py +54 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_post_request_guia_partida_geo.py +54 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_post_request_indicadores.py +57 -0
- intifact-1.0.0/test/test_api_v1_despatch_send_post_request_vehiculos_secundarios_inner.py +55 -0
- intifact-1.0.0/test/test_api_v1_despatch_transportista_send_post_request.py +150 -0
- intifact-1.0.0/test/test_api_v1_despatch_transportista_send_post_request_vehiculos_secundarios_inner.py +53 -0
- intifact-1.0.0/test/test_api_v1_documents_get200_response.py +106 -0
- intifact-1.0.0/test/test_api_v1_documents_get200_response_data_inner.py +86 -0
- intifact-1.0.0/test/test_api_v1_documents_get200_response_data_inner_company.py +54 -0
- intifact-1.0.0/test/test_api_v1_documents_get200_response_pagination.py +58 -0
- intifact-1.0.0/test/test_api_v1_documents_id_recover_post200_response.py +56 -0
- intifact-1.0.0/test/test_api_v1_documents_id_retry_post202_response.py +55 -0
- intifact-1.0.0/test/test_api_v1_documents_next_correlativo_get200_response.py +56 -0
- intifact-1.0.0/test/test_api_v1_documents_next_correlativo_get200_response_data.py +52 -0
- intifact-1.0.0/test/test_api_v1_invoice_cancel_post_request.py +61 -0
- intifact-1.0.0/test/test_api_v1_invoice_compute_post200_response.py +132 -0
- intifact-1.0.0/test/test_api_v1_invoice_compute_post200_response_data.py +126 -0
- intifact-1.0.0/test/test_api_v1_invoice_compute_post200_response_data_items_inner.py +86 -0
- intifact-1.0.0/test/test_api_v1_invoice_compute_post_request.py +87 -0
- intifact-1.0.0/test/test_api_v1_invoice_compute_post_request_items_inner.py +66 -0
- intifact-1.0.0/test/test_api_v1_invoice_compute_post_request_items_inner_descuento.py +52 -0
- intifact-1.0.0/test/test_api_v1_invoice_send_post202_response.py +60 -0
- intifact-1.0.0/test/test_api_v1_invoice_send_post202_response_data.py +59 -0
- intifact-1.0.0/test/test_api_v1_invoice_send_post400_response.py +60 -0
- intifact-1.0.0/test/test_api_v1_invoice_send_post400_response_errors_inner.py +54 -0
- intifact-1.0.0/test/test_api_v1_invoice_send_post_request.py +171 -0
- intifact-1.0.0/test/test_api_v1_invoice_send_post_request_detalle_inner.py +77 -0
- intifact-1.0.0/test/test_api_v1_invoice_send_post_request_detraccion.py +59 -0
- intifact-1.0.0/test/test_api_v1_invoice_send_post_request_forma_pago_inner.py +57 -0
- intifact-1.0.0/test/test_api_v1_invoice_send_post_request_guia_remision_inner.py +53 -0
- intifact-1.0.0/test/test_api_v1_invoice_send_post_request_leyendas_inner.py +54 -0
- intifact-1.0.0/test/test_api_v1_invoice_send_post_request_pagos_inner.py +54 -0
- intifact-1.0.0/test/test_api_v1_note_compute_post_request.py +87 -0
- intifact-1.0.0/test/test_api_v1_note_compute_post_request_items_inner.py +66 -0
- intifact-1.0.0/test/test_api_v1_note_send_post202_response.py +60 -0
- intifact-1.0.0/test/test_api_v1_note_send_post202_response_data.py +59 -0
- intifact-1.0.0/test/test_api_v1_note_send_post_request.py +147 -0
- intifact-1.0.0/test/test_api_v1_note_send_post_request_detalle_inner.py +77 -0
- intifact-1.0.0/test/test_api_v1_plans_id_put_request.py +59 -0
- intifact-1.0.0/test/test_api_v1_plans_post_request.py +62 -0
- intifact-1.0.0/test/test_api_v1_queues_stats_get200_response.py +76 -0
- intifact-1.0.0/test/test_api_v1_queues_stats_get200_response_data.py +80 -0
- intifact-1.0.0/test/test_api_v1_summary_send_post202_response.py +59 -0
- intifact-1.0.0/test/test_api_v1_summary_send_post202_response_data.py +54 -0
- intifact-1.0.0/test/test_api_v1_summary_send_post_request.py +94 -0
- intifact-1.0.0/test/test_api_v1_summary_send_post_request_items_inner.py +72 -0
- intifact-1.0.0/test/test_api_v1_ticket_ticket_status_get200_response.py +63 -0
- intifact-1.0.0/test/test_api_v1_ticket_ticket_status_get200_response_cdr_response.py +62 -0
- intifact-1.0.0/test/test_api_v1_ticket_ticket_status_get202_response.py +63 -0
- intifact-1.0.0/test/test_api_v1_ticket_ticket_status_get202_response_cdr_response.py +62 -0
- intifact-1.0.0/test/test_api_v1_voided_send_post_request.py +72 -0
- intifact-1.0.0/test/test_api_v1_voided_send_post_request_items_inner.py +58 -0
- intifact-1.0.0/test/test_api_v1_webhooks_id_put_request.py +56 -0
- intifact-1.0.0/test/test_api_v1_webhooks_post_request.py +62 -0
- intifact-1.0.0/test/test_auth_api.py +94 -0
- intifact-1.0.0/test/test_branches_api.py +59 -0
- intifact-1.0.0/test/test_company_api.py +73 -0
- intifact-1.0.0/test/test_despatch_api.py +73 -0
- intifact-1.0.0/test/test_documents_api.py +73 -0
- intifact-1.0.0/test/test_invoice_api.py +66 -0
- intifact-1.0.0/test/test_note_api.py +66 -0
- intifact-1.0.0/test/test_plans_api.py +59 -0
- intifact-1.0.0/test/test_public_api.py +52 -0
- intifact-1.0.0/test/test_queues_api.py +38 -0
- intifact-1.0.0/test/test_summary_api.py +66 -0
- intifact-1.0.0/test/test_system_api.py +66 -0
- intifact-1.0.0/test/test_webhooks_api.py +94 -0
intifact-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: intifact
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: SDK Python para la API de Facturacion Electronica SUNAT de Intifact (Peru)
|
|
5
|
+
Home-page:
|
|
6
|
+
Author: OpenAPI Generator community
|
|
7
|
+
Author-email: Roger <huallanca.roger@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Project-URL: Homepage, https://intifact.com
|
|
10
|
+
Project-URL: Repository, https://github.com/RogerAC123/api-facturacion-sdk-python
|
|
11
|
+
Keywords: sunat,facturacion,peru,intifact,factura-electronica,boleta
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
Requires-Dist: urllib3<3.0.0,>=2.7.0
|
|
15
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
16
|
+
Requires-Dist: pydantic>=2.11
|
|
17
|
+
Requires-Dist: typing-extensions>=4.7.1
|
|
18
|
+
Dynamic: author
|
|
19
|
+
|
|
20
|
+
# intifact-sdk (Python)
|
|
21
|
+
|
|
22
|
+
SDK Python para la **API de Facturación Electrónica SUNAT de Intifact** (Perú),
|
|
23
|
+
generado con [OpenAPI Generator](https://openapi-generator.tech) desde el spec
|
|
24
|
+
que la API expone en `/docs/json`. Facturas, boletas, notas de crédito/débito,
|
|
25
|
+
guías de remisión (remitente y transportista), resúmenes diarios y
|
|
26
|
+
comunicaciones de baja.
|
|
27
|
+
|
|
28
|
+
## Requisitos
|
|
29
|
+
|
|
30
|
+
Python 3.10+
|
|
31
|
+
|
|
32
|
+
## Instalación
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install intifact
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Autenticación
|
|
39
|
+
|
|
40
|
+
La API no está modelada con un `securityScheme` de OpenAPI (el chequeo de API
|
|
41
|
+
key vive en un plugin de Fastify), así que el header se agrega a mano — el
|
|
42
|
+
cliente lo manda en cada request a partir de ahí:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
import intifact_sdk
|
|
46
|
+
from intifact_sdk import ApiClient, Configuration
|
|
47
|
+
|
|
48
|
+
config = Configuration(host="https://api-facturacion.intifact.com")
|
|
49
|
+
client = ApiClient(config)
|
|
50
|
+
client.set_default_header("Authorization", f"Bearer {os.environ['FACTURACION_API_KEY']}")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Uso básico — enviar una factura
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import os
|
|
57
|
+
from intifact_sdk import ApiClient, Configuration, ApiException
|
|
58
|
+
from intifact_sdk.api.invoice_api import InvoiceApi
|
|
59
|
+
from intifact_sdk.models.api_v1_invoice_send_post_request import ApiV1InvoiceSendPostRequest
|
|
60
|
+
from intifact_sdk.models.api_v1_invoice_send_post_request_detalle_inner import (
|
|
61
|
+
ApiV1InvoiceSendPostRequestDetalleInner,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
config = Configuration(host="https://api-facturacion.intifact.com")
|
|
65
|
+
with ApiClient(config) as client:
|
|
66
|
+
client.set_default_header("Authorization", f"Bearer {os.environ['FACTURACION_API_KEY']}")
|
|
67
|
+
invoice_api = InvoiceApi(client)
|
|
68
|
+
|
|
69
|
+
item = ApiV1InvoiceSendPostRequestDetalleInner(
|
|
70
|
+
unidad="NIU",
|
|
71
|
+
cantidad=2,
|
|
72
|
+
cod_producto="PROD001",
|
|
73
|
+
descripcion="Laptop HP 15",
|
|
74
|
+
monto_valor_unitario=2500.00,
|
|
75
|
+
monto_base_igv=5000.00,
|
|
76
|
+
porcentaje_igv=18,
|
|
77
|
+
igv=900.00,
|
|
78
|
+
tip_afe_igv="10",
|
|
79
|
+
total_impuestos=900.00,
|
|
80
|
+
monto_precio_unitario=2950.00,
|
|
81
|
+
monto_valor_venta=5000.00,
|
|
82
|
+
# Código de Producto SUNAT (UNSPSC) — SUNAT lo exige desde 2027-01-01
|
|
83
|
+
# para determinados bienes (error 3496 si falta o es inválido).
|
|
84
|
+
cod_prod_sunat="43211508",
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
body = ApiV1InvoiceSendPostRequest(
|
|
88
|
+
empresa_ruc="20553510661",
|
|
89
|
+
tipo_doc="01",
|
|
90
|
+
serie="F001",
|
|
91
|
+
correlativo="100",
|
|
92
|
+
tipo_moneda="PEN",
|
|
93
|
+
fecha_emision="2026-01-15",
|
|
94
|
+
tipo_operacion="0101",
|
|
95
|
+
cliente_tipo_doc="6",
|
|
96
|
+
cliente_num_doc="20000000001",
|
|
97
|
+
cliente_razon_social="EMPRESA CLIENTE SAC",
|
|
98
|
+
detalle=[item],
|
|
99
|
+
monto_oper_gravadas=5000.00,
|
|
100
|
+
monto_oper_exoneradas=0,
|
|
101
|
+
monto_igv=900.00,
|
|
102
|
+
total_impuestos=900.00,
|
|
103
|
+
valor_venta=5000.00,
|
|
104
|
+
sub_total=5900.00,
|
|
105
|
+
monto_imp_venta=5900.00,
|
|
106
|
+
forma_pago=[{"tipo": "Contado", "monto": 5900.00, "fechaPago": "2026-01-15"}],
|
|
107
|
+
leyendas=[{"legendCode": "1000", "legendValue": "CINCO MIL NOVECIENTOS CON 00/100 SOLES"}],
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
try:
|
|
111
|
+
resp = invoice_api.api_v1_invoice_send_post(body)
|
|
112
|
+
# 202 — el documento queda ENCOLADO, SUNAT lo procesa en background
|
|
113
|
+
print("Encolado:", resp.data.id)
|
|
114
|
+
except ApiException as e:
|
|
115
|
+
# El body real del error (400/401/409/...) viene en e.body
|
|
116
|
+
print(f"Error {e.status}: {e.body}")
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Notas:
|
|
120
|
+
- Los campos usan `snake_case` en Python (`cod_producto`) aunque el JSON que
|
|
121
|
+
viaja por HTTP sigue siendo `camelCase` (`codProducto`) — Pydantic hace la
|
|
122
|
+
conversión con `alias` automáticamente.
|
|
123
|
+
- Pydantic valida los modelos **al construirlos**, antes de cualquier llamada
|
|
124
|
+
de red: si falta un campo requerido (ej. `forma_pago`, `leyendas`), obtienes
|
|
125
|
+
un `ValidationError` local en vez de esperar un 400 del servidor. Es una
|
|
126
|
+
ventaja real del SDK Python frente a mandar un dict suelto.
|
|
127
|
+
|
|
128
|
+
## Manejo de errores
|
|
129
|
+
|
|
130
|
+
Toda respuesta fuera de 2xx llega como `ApiException` (no como excepción
|
|
131
|
+
genérica de red): `e.status` trae el código HTTP y `e.body` el JSON crudo
|
|
132
|
+
`{ success: false, message, errors? }` que devuelve la API.
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
try:
|
|
136
|
+
invoice_api.api_v1_invoice_send_post(body)
|
|
137
|
+
except ApiException as e:
|
|
138
|
+
if e.status == 409:
|
|
139
|
+
# Comprobante ya en proceso — NO reintentar con otro correlativo,
|
|
140
|
+
# esperar el resultado. Ver /documents/{id} para el estado final.
|
|
141
|
+
pass
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## APIs disponibles
|
|
145
|
+
|
|
146
|
+
| Clase | Para qué |
|
|
147
|
+
|---|---|
|
|
148
|
+
| `InvoiceApi` | Facturas/boletas: enviar, PDF, XML, CDR |
|
|
149
|
+
| `NoteApi` | Notas de crédito/débito |
|
|
150
|
+
| `DespatchApi` | Guías de remisión (remitente y transportista) |
|
|
151
|
+
| `SummaryApi` | Resumen diario y comunicación de baja |
|
|
152
|
+
| `DocumentsApi` | Listar/consultar documentos, reintentar fallidos |
|
|
153
|
+
| `QueuesApi` | Estado de las colas BullMQ |
|
|
154
|
+
| `CompanyApi` / `BranchesApi` | Empresas y establecimientos (solo lectura) |
|
|
155
|
+
| `WebhooksApi` | Suscripciones y entregas de webhooks |
|
|
156
|
+
| `PlansApi` | Planes y consumo (quota) |
|
|
157
|
+
| `PublicApi` | Consulta pública de comprobantes (sin auth) |
|
|
158
|
+
| `AuthApi` | Autenticación |
|
|
159
|
+
| `SystemApi` | `/health`, catálogos SUNAT |
|
|
160
|
+
|
|
161
|
+
## Regenerar desde la API
|
|
162
|
+
|
|
163
|
+
El proyecto se generó con [OpenAPI Generator](https://openapi-generator.tech)
|
|
164
|
+
(`python`) contra `https://api-facturacion.intifact.com/docs/json`. Para
|
|
165
|
+
regenerar tras un cambio de la API:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
npx @openapitools/openapi-generator-cli generate \
|
|
169
|
+
-i https://api-facturacion.intifact.com/docs/json \
|
|
170
|
+
-g python --package-name intifact_sdk \
|
|
171
|
+
-o .
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Nota sobre los nombres de métodos
|
|
175
|
+
|
|
176
|
+
Las rutas de la API no declaran `operationId` explícito en su schema de
|
|
177
|
+
Fastify, así que el generador deriva nombres desde el método+path
|
|
178
|
+
(`api_v1_invoice_send_post` en vez de algo como `send_invoice`). Si la API le
|
|
179
|
+
agrega `operationId` a sus rutas, una regeneración futura produciría nombres
|
|
180
|
+
más limpios sin romper compatibilidad de comportamiento.
|
intifact-1.0.0/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# intifact-sdk (Python)
|
|
2
|
+
|
|
3
|
+
SDK Python para la **API de Facturación Electrónica SUNAT de Intifact** (Perú),
|
|
4
|
+
generado con [OpenAPI Generator](https://openapi-generator.tech) desde el spec
|
|
5
|
+
que la API expone en `/docs/json`. Facturas, boletas, notas de crédito/débito,
|
|
6
|
+
guías de remisión (remitente y transportista), resúmenes diarios y
|
|
7
|
+
comunicaciones de baja.
|
|
8
|
+
|
|
9
|
+
## Requisitos
|
|
10
|
+
|
|
11
|
+
Python 3.10+
|
|
12
|
+
|
|
13
|
+
## Instalación
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install intifact
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Autenticación
|
|
20
|
+
|
|
21
|
+
La API no está modelada con un `securityScheme` de OpenAPI (el chequeo de API
|
|
22
|
+
key vive en un plugin de Fastify), así que el header se agrega a mano — el
|
|
23
|
+
cliente lo manda en cada request a partir de ahí:
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
import intifact_sdk
|
|
27
|
+
from intifact_sdk import ApiClient, Configuration
|
|
28
|
+
|
|
29
|
+
config = Configuration(host="https://api-facturacion.intifact.com")
|
|
30
|
+
client = ApiClient(config)
|
|
31
|
+
client.set_default_header("Authorization", f"Bearer {os.environ['FACTURACION_API_KEY']}")
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Uso básico — enviar una factura
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
import os
|
|
38
|
+
from intifact_sdk import ApiClient, Configuration, ApiException
|
|
39
|
+
from intifact_sdk.api.invoice_api import InvoiceApi
|
|
40
|
+
from intifact_sdk.models.api_v1_invoice_send_post_request import ApiV1InvoiceSendPostRequest
|
|
41
|
+
from intifact_sdk.models.api_v1_invoice_send_post_request_detalle_inner import (
|
|
42
|
+
ApiV1InvoiceSendPostRequestDetalleInner,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
config = Configuration(host="https://api-facturacion.intifact.com")
|
|
46
|
+
with ApiClient(config) as client:
|
|
47
|
+
client.set_default_header("Authorization", f"Bearer {os.environ['FACTURACION_API_KEY']}")
|
|
48
|
+
invoice_api = InvoiceApi(client)
|
|
49
|
+
|
|
50
|
+
item = ApiV1InvoiceSendPostRequestDetalleInner(
|
|
51
|
+
unidad="NIU",
|
|
52
|
+
cantidad=2,
|
|
53
|
+
cod_producto="PROD001",
|
|
54
|
+
descripcion="Laptop HP 15",
|
|
55
|
+
monto_valor_unitario=2500.00,
|
|
56
|
+
monto_base_igv=5000.00,
|
|
57
|
+
porcentaje_igv=18,
|
|
58
|
+
igv=900.00,
|
|
59
|
+
tip_afe_igv="10",
|
|
60
|
+
total_impuestos=900.00,
|
|
61
|
+
monto_precio_unitario=2950.00,
|
|
62
|
+
monto_valor_venta=5000.00,
|
|
63
|
+
# Código de Producto SUNAT (UNSPSC) — SUNAT lo exige desde 2027-01-01
|
|
64
|
+
# para determinados bienes (error 3496 si falta o es inválido).
|
|
65
|
+
cod_prod_sunat="43211508",
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
body = ApiV1InvoiceSendPostRequest(
|
|
69
|
+
empresa_ruc="20553510661",
|
|
70
|
+
tipo_doc="01",
|
|
71
|
+
serie="F001",
|
|
72
|
+
correlativo="100",
|
|
73
|
+
tipo_moneda="PEN",
|
|
74
|
+
fecha_emision="2026-01-15",
|
|
75
|
+
tipo_operacion="0101",
|
|
76
|
+
cliente_tipo_doc="6",
|
|
77
|
+
cliente_num_doc="20000000001",
|
|
78
|
+
cliente_razon_social="EMPRESA CLIENTE SAC",
|
|
79
|
+
detalle=[item],
|
|
80
|
+
monto_oper_gravadas=5000.00,
|
|
81
|
+
monto_oper_exoneradas=0,
|
|
82
|
+
monto_igv=900.00,
|
|
83
|
+
total_impuestos=900.00,
|
|
84
|
+
valor_venta=5000.00,
|
|
85
|
+
sub_total=5900.00,
|
|
86
|
+
monto_imp_venta=5900.00,
|
|
87
|
+
forma_pago=[{"tipo": "Contado", "monto": 5900.00, "fechaPago": "2026-01-15"}],
|
|
88
|
+
leyendas=[{"legendCode": "1000", "legendValue": "CINCO MIL NOVECIENTOS CON 00/100 SOLES"}],
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
try:
|
|
92
|
+
resp = invoice_api.api_v1_invoice_send_post(body)
|
|
93
|
+
# 202 — el documento queda ENCOLADO, SUNAT lo procesa en background
|
|
94
|
+
print("Encolado:", resp.data.id)
|
|
95
|
+
except ApiException as e:
|
|
96
|
+
# El body real del error (400/401/409/...) viene en e.body
|
|
97
|
+
print(f"Error {e.status}: {e.body}")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Notas:
|
|
101
|
+
- Los campos usan `snake_case` en Python (`cod_producto`) aunque el JSON que
|
|
102
|
+
viaja por HTTP sigue siendo `camelCase` (`codProducto`) — Pydantic hace la
|
|
103
|
+
conversión con `alias` automáticamente.
|
|
104
|
+
- Pydantic valida los modelos **al construirlos**, antes de cualquier llamada
|
|
105
|
+
de red: si falta un campo requerido (ej. `forma_pago`, `leyendas`), obtienes
|
|
106
|
+
un `ValidationError` local en vez de esperar un 400 del servidor. Es una
|
|
107
|
+
ventaja real del SDK Python frente a mandar un dict suelto.
|
|
108
|
+
|
|
109
|
+
## Manejo de errores
|
|
110
|
+
|
|
111
|
+
Toda respuesta fuera de 2xx llega como `ApiException` (no como excepción
|
|
112
|
+
genérica de red): `e.status` trae el código HTTP y `e.body` el JSON crudo
|
|
113
|
+
`{ success: false, message, errors? }` que devuelve la API.
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
try:
|
|
117
|
+
invoice_api.api_v1_invoice_send_post(body)
|
|
118
|
+
except ApiException as e:
|
|
119
|
+
if e.status == 409:
|
|
120
|
+
# Comprobante ya en proceso — NO reintentar con otro correlativo,
|
|
121
|
+
# esperar el resultado. Ver /documents/{id} para el estado final.
|
|
122
|
+
pass
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## APIs disponibles
|
|
126
|
+
|
|
127
|
+
| Clase | Para qué |
|
|
128
|
+
|---|---|
|
|
129
|
+
| `InvoiceApi` | Facturas/boletas: enviar, PDF, XML, CDR |
|
|
130
|
+
| `NoteApi` | Notas de crédito/débito |
|
|
131
|
+
| `DespatchApi` | Guías de remisión (remitente y transportista) |
|
|
132
|
+
| `SummaryApi` | Resumen diario y comunicación de baja |
|
|
133
|
+
| `DocumentsApi` | Listar/consultar documentos, reintentar fallidos |
|
|
134
|
+
| `QueuesApi` | Estado de las colas BullMQ |
|
|
135
|
+
| `CompanyApi` / `BranchesApi` | Empresas y establecimientos (solo lectura) |
|
|
136
|
+
| `WebhooksApi` | Suscripciones y entregas de webhooks |
|
|
137
|
+
| `PlansApi` | Planes y consumo (quota) |
|
|
138
|
+
| `PublicApi` | Consulta pública de comprobantes (sin auth) |
|
|
139
|
+
| `AuthApi` | Autenticación |
|
|
140
|
+
| `SystemApi` | `/health`, catálogos SUNAT |
|
|
141
|
+
|
|
142
|
+
## Regenerar desde la API
|
|
143
|
+
|
|
144
|
+
El proyecto se generó con [OpenAPI Generator](https://openapi-generator.tech)
|
|
145
|
+
(`python`) contra `https://api-facturacion.intifact.com/docs/json`. Para
|
|
146
|
+
regenerar tras un cambio de la API:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
npx @openapitools/openapi-generator-cli generate \
|
|
150
|
+
-i https://api-facturacion.intifact.com/docs/json \
|
|
151
|
+
-g python --package-name intifact_sdk \
|
|
152
|
+
-o .
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Nota sobre los nombres de métodos
|
|
156
|
+
|
|
157
|
+
Las rutas de la API no declaran `operationId` explícito en su schema de
|
|
158
|
+
Fastify, así que el generador deriva nombres desde el método+path
|
|
159
|
+
(`api_v1_invoice_send_post` en vez de algo como `send_invoice`). Si la API le
|
|
160
|
+
agrega `operationId` a sus rutas, una regeneración futura produciría nombres
|
|
161
|
+
más limpios sin romper compatibilidad de comportamiento.
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: intifact
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: SDK Python para la API de Facturacion Electronica SUNAT de Intifact (Peru)
|
|
5
|
+
Home-page:
|
|
6
|
+
Author: OpenAPI Generator community
|
|
7
|
+
Author-email: Roger <huallanca.roger@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Project-URL: Homepage, https://intifact.com
|
|
10
|
+
Project-URL: Repository, https://github.com/RogerAC123/api-facturacion-sdk-python
|
|
11
|
+
Keywords: sunat,facturacion,peru,intifact,factura-electronica,boleta
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
Requires-Dist: urllib3<3.0.0,>=2.7.0
|
|
15
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
16
|
+
Requires-Dist: pydantic>=2.11
|
|
17
|
+
Requires-Dist: typing-extensions>=4.7.1
|
|
18
|
+
Dynamic: author
|
|
19
|
+
|
|
20
|
+
# intifact-sdk (Python)
|
|
21
|
+
|
|
22
|
+
SDK Python para la **API de Facturación Electrónica SUNAT de Intifact** (Perú),
|
|
23
|
+
generado con [OpenAPI Generator](https://openapi-generator.tech) desde el spec
|
|
24
|
+
que la API expone en `/docs/json`. Facturas, boletas, notas de crédito/débito,
|
|
25
|
+
guías de remisión (remitente y transportista), resúmenes diarios y
|
|
26
|
+
comunicaciones de baja.
|
|
27
|
+
|
|
28
|
+
## Requisitos
|
|
29
|
+
|
|
30
|
+
Python 3.10+
|
|
31
|
+
|
|
32
|
+
## Instalación
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install intifact
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Autenticación
|
|
39
|
+
|
|
40
|
+
La API no está modelada con un `securityScheme` de OpenAPI (el chequeo de API
|
|
41
|
+
key vive en un plugin de Fastify), así que el header se agrega a mano — el
|
|
42
|
+
cliente lo manda en cada request a partir de ahí:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
import intifact_sdk
|
|
46
|
+
from intifact_sdk import ApiClient, Configuration
|
|
47
|
+
|
|
48
|
+
config = Configuration(host="https://api-facturacion.intifact.com")
|
|
49
|
+
client = ApiClient(config)
|
|
50
|
+
client.set_default_header("Authorization", f"Bearer {os.environ['FACTURACION_API_KEY']}")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Uso básico — enviar una factura
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import os
|
|
57
|
+
from intifact_sdk import ApiClient, Configuration, ApiException
|
|
58
|
+
from intifact_sdk.api.invoice_api import InvoiceApi
|
|
59
|
+
from intifact_sdk.models.api_v1_invoice_send_post_request import ApiV1InvoiceSendPostRequest
|
|
60
|
+
from intifact_sdk.models.api_v1_invoice_send_post_request_detalle_inner import (
|
|
61
|
+
ApiV1InvoiceSendPostRequestDetalleInner,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
config = Configuration(host="https://api-facturacion.intifact.com")
|
|
65
|
+
with ApiClient(config) as client:
|
|
66
|
+
client.set_default_header("Authorization", f"Bearer {os.environ['FACTURACION_API_KEY']}")
|
|
67
|
+
invoice_api = InvoiceApi(client)
|
|
68
|
+
|
|
69
|
+
item = ApiV1InvoiceSendPostRequestDetalleInner(
|
|
70
|
+
unidad="NIU",
|
|
71
|
+
cantidad=2,
|
|
72
|
+
cod_producto="PROD001",
|
|
73
|
+
descripcion="Laptop HP 15",
|
|
74
|
+
monto_valor_unitario=2500.00,
|
|
75
|
+
monto_base_igv=5000.00,
|
|
76
|
+
porcentaje_igv=18,
|
|
77
|
+
igv=900.00,
|
|
78
|
+
tip_afe_igv="10",
|
|
79
|
+
total_impuestos=900.00,
|
|
80
|
+
monto_precio_unitario=2950.00,
|
|
81
|
+
monto_valor_venta=5000.00,
|
|
82
|
+
# Código de Producto SUNAT (UNSPSC) — SUNAT lo exige desde 2027-01-01
|
|
83
|
+
# para determinados bienes (error 3496 si falta o es inválido).
|
|
84
|
+
cod_prod_sunat="43211508",
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
body = ApiV1InvoiceSendPostRequest(
|
|
88
|
+
empresa_ruc="20553510661",
|
|
89
|
+
tipo_doc="01",
|
|
90
|
+
serie="F001",
|
|
91
|
+
correlativo="100",
|
|
92
|
+
tipo_moneda="PEN",
|
|
93
|
+
fecha_emision="2026-01-15",
|
|
94
|
+
tipo_operacion="0101",
|
|
95
|
+
cliente_tipo_doc="6",
|
|
96
|
+
cliente_num_doc="20000000001",
|
|
97
|
+
cliente_razon_social="EMPRESA CLIENTE SAC",
|
|
98
|
+
detalle=[item],
|
|
99
|
+
monto_oper_gravadas=5000.00,
|
|
100
|
+
monto_oper_exoneradas=0,
|
|
101
|
+
monto_igv=900.00,
|
|
102
|
+
total_impuestos=900.00,
|
|
103
|
+
valor_venta=5000.00,
|
|
104
|
+
sub_total=5900.00,
|
|
105
|
+
monto_imp_venta=5900.00,
|
|
106
|
+
forma_pago=[{"tipo": "Contado", "monto": 5900.00, "fechaPago": "2026-01-15"}],
|
|
107
|
+
leyendas=[{"legendCode": "1000", "legendValue": "CINCO MIL NOVECIENTOS CON 00/100 SOLES"}],
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
try:
|
|
111
|
+
resp = invoice_api.api_v1_invoice_send_post(body)
|
|
112
|
+
# 202 — el documento queda ENCOLADO, SUNAT lo procesa en background
|
|
113
|
+
print("Encolado:", resp.data.id)
|
|
114
|
+
except ApiException as e:
|
|
115
|
+
# El body real del error (400/401/409/...) viene en e.body
|
|
116
|
+
print(f"Error {e.status}: {e.body}")
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Notas:
|
|
120
|
+
- Los campos usan `snake_case` en Python (`cod_producto`) aunque el JSON que
|
|
121
|
+
viaja por HTTP sigue siendo `camelCase` (`codProducto`) — Pydantic hace la
|
|
122
|
+
conversión con `alias` automáticamente.
|
|
123
|
+
- Pydantic valida los modelos **al construirlos**, antes de cualquier llamada
|
|
124
|
+
de red: si falta un campo requerido (ej. `forma_pago`, `leyendas`), obtienes
|
|
125
|
+
un `ValidationError` local en vez de esperar un 400 del servidor. Es una
|
|
126
|
+
ventaja real del SDK Python frente a mandar un dict suelto.
|
|
127
|
+
|
|
128
|
+
## Manejo de errores
|
|
129
|
+
|
|
130
|
+
Toda respuesta fuera de 2xx llega como `ApiException` (no como excepción
|
|
131
|
+
genérica de red): `e.status` trae el código HTTP y `e.body` el JSON crudo
|
|
132
|
+
`{ success: false, message, errors? }` que devuelve la API.
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
try:
|
|
136
|
+
invoice_api.api_v1_invoice_send_post(body)
|
|
137
|
+
except ApiException as e:
|
|
138
|
+
if e.status == 409:
|
|
139
|
+
# Comprobante ya en proceso — NO reintentar con otro correlativo,
|
|
140
|
+
# esperar el resultado. Ver /documents/{id} para el estado final.
|
|
141
|
+
pass
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## APIs disponibles
|
|
145
|
+
|
|
146
|
+
| Clase | Para qué |
|
|
147
|
+
|---|---|
|
|
148
|
+
| `InvoiceApi` | Facturas/boletas: enviar, PDF, XML, CDR |
|
|
149
|
+
| `NoteApi` | Notas de crédito/débito |
|
|
150
|
+
| `DespatchApi` | Guías de remisión (remitente y transportista) |
|
|
151
|
+
| `SummaryApi` | Resumen diario y comunicación de baja |
|
|
152
|
+
| `DocumentsApi` | Listar/consultar documentos, reintentar fallidos |
|
|
153
|
+
| `QueuesApi` | Estado de las colas BullMQ |
|
|
154
|
+
| `CompanyApi` / `BranchesApi` | Empresas y establecimientos (solo lectura) |
|
|
155
|
+
| `WebhooksApi` | Suscripciones y entregas de webhooks |
|
|
156
|
+
| `PlansApi` | Planes y consumo (quota) |
|
|
157
|
+
| `PublicApi` | Consulta pública de comprobantes (sin auth) |
|
|
158
|
+
| `AuthApi` | Autenticación |
|
|
159
|
+
| `SystemApi` | `/health`, catálogos SUNAT |
|
|
160
|
+
|
|
161
|
+
## Regenerar desde la API
|
|
162
|
+
|
|
163
|
+
El proyecto se generó con [OpenAPI Generator](https://openapi-generator.tech)
|
|
164
|
+
(`python`) contra `https://api-facturacion.intifact.com/docs/json`. Para
|
|
165
|
+
regenerar tras un cambio de la API:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
npx @openapitools/openapi-generator-cli generate \
|
|
169
|
+
-i https://api-facturacion.intifact.com/docs/json \
|
|
170
|
+
-g python --package-name intifact_sdk \
|
|
171
|
+
-o .
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Nota sobre los nombres de métodos
|
|
175
|
+
|
|
176
|
+
Las rutas de la API no declaran `operationId` explícito en su schema de
|
|
177
|
+
Fastify, así que el generador deriva nombres desde el método+path
|
|
178
|
+
(`api_v1_invoice_send_post` en vez de algo como `send_invoice`). Si la API le
|
|
179
|
+
agrega `operationId` a sus rutas, una regeneración futura produciría nombres
|
|
180
|
+
más limpios sin romper compatibilidad de comportamiento.
|