fiscalapi 4.0.2__tar.gz → 4.0.12__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.
Files changed (22) hide show
  1. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/PKG-INFO +337 -336
  2. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/README.md +302 -302
  3. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi/__init__.py +88 -88
  4. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi/models/common_models.py +67 -67
  5. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi/models/fiscalapi_models.py +323 -323
  6. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi/services/base_service.py +217 -217
  7. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi/services/catalog_service.py +19 -19
  8. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi/services/fiscalapi_client.py +17 -17
  9. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi/services/invoice_service.py +65 -65
  10. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi/services/people_service.py +32 -32
  11. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi/services/product_service.py +31 -31
  12. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi/services/tax_file_servive.py +40 -40
  13. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi.egg-info/PKG-INFO +337 -336
  14. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi.egg-info/requires.txt +1 -0
  15. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/setup.cfg +4 -4
  16. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/setup.py +53 -52
  17. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/LICENSE.txt +0 -0
  18. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi/models/__init__.py +0 -0
  19. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi/services/__init__.py +0 -0
  20. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi.egg-info/SOURCES.txt +0 -0
  21. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi.egg-info/dependency_links.txt +0 -0
  22. {fiscalapi-4.0.2 → fiscalapi-4.0.12}/fiscalapi.egg-info/top_level.txt +0 -0
@@ -1,336 +1,337 @@
1
- Metadata-Version: 2.2
2
- Name: fiscalapi
3
- Version: 4.0.2
4
- Summary: Genera facturas CFDI válidas ante el SAT consumiendo el API de https://www.fiscalapi.com
5
- Home-page: https://www.fiscalapi.com
6
- Author: Fiscalapi
7
- Author-email: contacto@fiscalapi.com
8
- License: MPL-2.0
9
- Keywords: factura,cfdi,facturacion,mexico,sat,fiscalapi
10
- Classifier: Development Status :: 5 - Production/Stable
11
- Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
13
- Classifier: Programming Language :: Python :: 3.7
14
- Classifier: Topic :: Office/Business :: Financial
15
- Requires-Python: >=3.7
16
- Description-Content-Type: text/markdown
17
- License-File: LICENSE.txt
18
- Requires-Dist: pydantic>=2.0.0
19
- Requires-Dist: requests>=2.0.0
20
- Requires-Dist: urllib3>=1.0.0
21
- Requires-Dist: certifi>=2023.0.0
22
- Dynamic: author
23
- Dynamic: author-email
24
- Dynamic: classifier
25
- Dynamic: description
26
- Dynamic: description-content-type
27
- Dynamic: home-page
28
- Dynamic: keywords
29
- Dynamic: license
30
- Dynamic: requires-dist
31
- Dynamic: requires-python
32
- Dynamic: summary
33
-
34
- # FiscalAPI SDK para Python
35
-
36
- [![PyPI version](https://badge.fury.io/py/fiscalapi.svg)](https://badge.fury.io/py/fiscalapi)
37
- [![License: MPL-2.0](https://img.shields.io/badge/License-MPL_2.0-blue.svg)](https://github.com/FiscalAPI/fiscalapi-python/blob/main/LICENSE.txt)
38
-
39
- **SDK oficial de FiscalAPI para Python**, la API de facturación CFDI y otros servicios fiscales en México. Simplifica la integración con los servicios de facturación electrónica, eliminando las complejidades del SAT y facilitando la generación de facturas, notas de crédito, complementos de pago, nómina, carta porte, y más. ¡Facturar sin dolor ahora es posible!
40
-
41
- ## 🚀 Características
42
-
43
- - Soporte completo para **CFDI 4.0**
44
- - Compatible con Python 3.7+
45
- - Dos modos de operación: **Por valores** o **Por referencias**
46
- - Manejo simplificado de errores
47
- - Búsqueda en catálogos del SAT
48
- - Documentación completa y ejemplos prácticos
49
-
50
- ## 📦 Instalación
51
-
52
- **pip**:
53
- ```bash
54
- pip install fiscalapi
55
- ```
56
-
57
- **poetry**:
58
- ```bash
59
- poetry add fiscalapi
60
- ```
61
-
62
- ## ⚙️ Configuración
63
-
64
- ### Configuración Básica
65
-
66
- 1. **Crea un objeto de configuración** con [tus credenciales](https://docs.fiscalapi.com/credentials-info):
67
- ```python
68
- from fiscalapi.models.common_models import FiscalApiSettings
69
-
70
- settings = FiscalApiSettings(
71
- api_url="https://test.fiscalapi.com", # https://live.fiscalapi.com (producción)
72
- api_key="<API_KEY>",
73
- tenant="<TENANT_KEY>"
74
- )
75
- ```
76
-
77
- 2. **Crea la instancia del cliente**:
78
- ```python
79
- from fiscalapi.services.fiscalapi_client import FiscalApiClient
80
-
81
- client = FiscalApiClient(settings=settings)
82
- ```
83
-
84
- ## 🔄 Modos de Operación
85
-
86
- FiscalAPI admite dos [modos de operación](https://docs.fiscalapi.com/modes-of-operation):
87
-
88
- - **Por Referencias**: Envía solo IDs de objetos previamente creados en el dashboard de FiscalAPI.
89
- Ideal para integraciones ligeras.
90
-
91
- - **Por Valores**: Envía todos los campos requeridos en cada petición, con mayor control sobre los datos.
92
- No se requiere configuración previa en el dashboard.
93
-
94
- ## 📝 Ejemplos de Uso
95
-
96
- ### 1. Crear una Persona (Emisor o Receptor)
97
-
98
- ```python
99
- from fiscalapi.models.fiscalapi_models import Person
100
-
101
- person = Person(
102
- legal_name="Empresa Python SA de CV",
103
- email="mail7@gmail.com",
104
- password="TestPassword1234!"
105
- )
106
-
107
- api_response = client.people.create(person)
108
- ```
109
-
110
- ### 2. Subir Certificados CSD
111
-
112
- ```python
113
- from fiscalapi.models.fiscalapi_models import TaxFile
114
-
115
- # Subir certificado (CER)
116
- certificado_csd = TaxFile(
117
- person_id="3f3478b4-60fd-459e-8bfc-f8239fc96257",
118
- tin="FUNK671228PH6",
119
- base64_file="MIIFgDCCA2igAwIBAgIUMzAwMDEwMDAwMDA1MDAwMDM0NDYwDQYJKo...",
120
- file_type=0, # 0 para certificado, 1 para llave privada
121
- password="12345678a"
122
- )
123
-
124
- # Subir llave privada (KEY)
125
- clave_privada_csd = TaxFile(
126
- person_id="3f3478b4-60fd-459e-8bfc-f8239fc96257",
127
- tin="FUNK671228PH6",
128
- base64_file="MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIAg...",
129
- file_type=1,
130
- password="12345678a"
131
- )
132
-
133
- api_response_cer = client.tax_files.create(certificado_csd)
134
- api_response_key = client.tax_files.create(clave_privada_csd)
135
- ```
136
-
137
- ### 3. Crear un Producto o Servicio
138
-
139
- ```python
140
- from fiscalapi.models.fiscalapi_models import Product
141
-
142
- product = Product(
143
- description="Producto python sin impuestos",
144
- unit_price=Decimal("100.00")
145
- )
146
-
147
- api_response = client.products.create(product)
148
- ```
149
-
150
- ### 4. Actualizar Impuestos de un Producto
151
-
152
- ```python
153
- from fiscalapi.models.fiscalapi_models import Product, ProductTax
154
-
155
- product = Product(
156
- id="f4bf4df3-5a91-4a30-b137-52cb517d13c4",
157
- description="Producto python sin impuestos",
158
- unit_price=Decimal("100.00"),
159
- product_taxes=[
160
- ProductTax(
161
- rate=Decimal("0.160000"),
162
- taxId="002",
163
- taxFlagId="T",
164
- taxTypeId="Tasa"
165
- ),
166
- ProductTax(
167
- rate=Decimal("0.106667"),
168
- taxId="002",
169
- taxFlagId="R",
170
- taxTypeId="Tasa"
171
- ),
172
- ProductTax(
173
- rate=Decimal("0.100000"),
174
- taxId="001",
175
- taxFlagId="R",
176
- taxTypeId="Tasa"
177
- )
178
- ]
179
- )
180
-
181
- api_response = client.products.update(product)
182
- ```
183
-
184
- ### 5. Crear una Factura de Ingreso (Por Referencias)
185
-
186
- ```python
187
- from datetime import datetime
188
- from decimal import Decimal
189
- from fiscalapi.models.fiscalapi_models import Invoice, InvoiceIssuer, InvoiceItem, InvoiceRecipient
190
-
191
- invoice = Invoice(
192
- version_code="4.0",
193
- series="F",
194
- date=datetime.now().strftime("%Y-%m-%dT%H:%M:%S"),
195
- payment_form_code="01",
196
- payment_conditions="Contado",
197
- currency_code="MXN",
198
- type_code="I",
199
- expedition_zip_code="42501",
200
- payment_method_code="PUE",
201
- exchange_rate=1,
202
- export_code="01",
203
- issuer=InvoiceIssuer(
204
- id="3f3478b4-60fd-459e-8bfc-f8239fc96257"
205
- ),
206
- recipient=InvoiceRecipient(
207
- id="96b46762-d246-4a67-a562-510a25dbafa9"
208
- ),
209
- items=[
210
- InvoiceItem(
211
- id="114a4be5-fb65-40b2-a762-ff0c55c6ebfa",
212
- quantity=Decimal("1.5"),
213
- discount=Decimal("255.85")
214
- )
215
- ]
216
- )
217
-
218
- api_response = client.invoices.create(invoice)
219
- ```
220
-
221
- ### 6. Crear la Misma Factura de Ingreso (Por Valores)
222
-
223
- ```python
224
- from fiscalapi.models.fiscalapi_models import Invoice, InvoiceIssuer, InvoiceItem, InvoiceRecipient, ItemTax, TaxCredential
225
-
226
- invoice = Invoice(
227
- version_code="4.0",
228
- series="F",
229
- date=datetime.now().strftime("%Y-%m-%dT%H:%M:%S"),
230
- payment_form_code="01",
231
- currency_code="MXN",
232
- type_code="I",
233
- expedition_zip_code="42501",
234
- payment_method_code="PUE",
235
- exchange_rate=1,
236
- export_code="01",
237
- issuer=InvoiceIssuer(
238
- tin="FUNK671228PH6",
239
- legal_name="KARLA FUENTE NOLASCO",
240
- tax_regime_code="621",
241
- tax_credentials=[
242
- TaxCredential(
243
- base64_file="MIIFgDCCA2igAwIBAgIUMzAwMDEwMDAwMDA1MDAwMDM0NDYwDQYJKo...",
244
- file_type=0,
245
- password="12345678a"
246
- ),
247
- TaxCredential(
248
- base64_file="MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIAg...",
249
- file_type=1,
250
- password="12345678a"
251
- )
252
- ]
253
- ),
254
- recipient=InvoiceRecipient(
255
- tin="EKU9003173C9",
256
- legal_name="ESCUELA KEMPER URGATE",
257
- zip_code="42501",
258
- tax_regime_code="601",
259
- cfdi_use_code="G01",
260
- email="mail@domain.com"
261
- ),
262
- items=[
263
- InvoiceItem(
264
- item_code="84111506",
265
- quantity=Decimal("9.5"),
266
- unit_of_measurement_code="E48",
267
- description="Invoicing software as a service",
268
- unit_price=Decimal("3587.75"),
269
- tax_object_code="02",
270
- item_sku="7506022301697",
271
- discount=Decimal("255.85"),
272
- item_taxes=[
273
- ItemTax(
274
- tax_code="002",
275
- tax_type_code="Tasa",
276
- tax_rate=Decimal("0.160000"),
277
- tax_flag_code="T"
278
- )
279
- ]
280
- )
281
- ]
282
- )
283
-
284
- api_response = client.invoices.create(invoice)
285
- ```
286
-
287
- ### 7. Búsqueda en Catálogos del SAT
288
-
289
- ```python
290
- # Buscar registros que contengan 'inter' en el catalogo 'SatUnitMeasurements' (página 1, tamaño página 10)
291
- api_response = client.catalogs.search_catalog("SatUnitMeasurements", "inter", 1, 10)
292
-
293
- if api_response.succeeded:
294
- for item in api_response.data.items:
295
- print(f"Unidad: {item.description}")
296
- else:
297
- print(api_response.message)
298
- ```
299
-
300
- ## 📋 Operaciones Principales
301
-
302
- - **Facturas (CFDI)**
303
- Crear facturas de ingreso, notas de crédito, complementos de pago, cancelaciones, generación de PDF/XML.
304
- - **Personas (Clientes/Emisores)**
305
- Alta y administración de personas, gestión de certificados (CSD).
306
- - **Productos y Servicios**
307
- Administración de catálogos de productos, búsqueda en catálogos SAT.
308
-
309
- ## 🤝 Contribuir
310
-
311
- 1. Haz un fork del repositorio.
312
- 2. Crea una rama para tu feature: `git checkout -b feature/AmazingFeature`
313
- 3. Realiza commits de tus cambios: `git commit -m 'Add some AmazingFeature'`
314
- 4. Sube tu rama: `git push origin feature/AmazingFeature`
315
- 5. Abre un Pull Request en GitHub.
316
-
317
- ## 🐛 Reportar Problemas
318
-
319
- 1. Asegúrate de usar la última versión del SDK.
320
- 2. Verifica si el problema ya fue reportado.
321
- 3. Proporciona un ejemplo mínimo reproducible.
322
- 4. Incluye los mensajes de error completos.
323
-
324
- ## 📄 Licencia
325
-
326
- Este proyecto está licenciado bajo la Licencia **MPL**. Consulta el archivo [LICENSE](LICENSE.txt) para más detalles.
327
-
328
- ## 🔗 Enlaces Útiles
329
-
330
- - [Documentación Oficial](https://docs.fiscalapi.com)
331
- - [Portal de FiscalAPI](https://fiscalapi.com)
332
- - [Ejemplos en Python](https://github.com/FiscalAPI/fiscalapi-samples-python)
333
-
334
- ---
335
-
336
- Desarrollado con ❤️ por [Fiscalapi](https://www.fiscalapi.com)
1
+ Metadata-Version: 2.2
2
+ Name: fiscalapi
3
+ Version: 4.0.12
4
+ Summary: Genera facturas CFDI válidas ante el SAT consumiendo el API de https://www.fiscalapi.com
5
+ Home-page: https://www.fiscalapi.com
6
+ Author: Fiscalapi
7
+ Author-email: contacto@fiscalapi.com
8
+ License: MPL-2.0
9
+ Keywords: factura,cfdi,facturacion,mexico,sat,fiscalapi
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
13
+ Classifier: Programming Language :: Python :: 3.7
14
+ Classifier: Topic :: Office/Business :: Financial
15
+ Requires-Python: >=3.7
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE.txt
18
+ Requires-Dist: pydantic>=2.0.0
19
+ Requires-Dist: requests>=2.0.0
20
+ Requires-Dist: urllib3>=1.0.0
21
+ Requires-Dist: certifi>=2023.0.0
22
+ Requires-Dist: email_validator>=2.2.0
23
+ Dynamic: author
24
+ Dynamic: author-email
25
+ Dynamic: classifier
26
+ Dynamic: description
27
+ Dynamic: description-content-type
28
+ Dynamic: home-page
29
+ Dynamic: keywords
30
+ Dynamic: license
31
+ Dynamic: requires-dist
32
+ Dynamic: requires-python
33
+ Dynamic: summary
34
+
35
+ # FiscalAPI SDK para Python
36
+
37
+ [![PyPI version](https://badge.fury.io/py/fiscalapi.svg)](https://badge.fury.io/py/fiscalapi)
38
+ [![License: MPL-2.0](https://img.shields.io/badge/License-MPL_2.0-blue.svg)](https://github.com/FiscalAPI/fiscalapi-python/blob/main/LICENSE.txt)
39
+
40
+ **SDK oficial de FiscalAPI para Python**, la API de facturación CFDI y otros servicios fiscales en México. Simplifica la integración con los servicios de facturación electrónica, eliminando las complejidades del SAT y facilitando la generación de facturas, notas de crédito, complementos de pago, nómina, carta porte, y más. ¡Facturar sin dolor ahora es posible!
41
+
42
+ ## 🚀 Características
43
+
44
+ - Soporte completo para **CFDI 4.0**
45
+ - Compatible con Python 3.7+
46
+ - Dos modos de operación: **Por valores** o **Por referencias**
47
+ - Manejo simplificado de errores
48
+ - Búsqueda en catálogos del SAT
49
+ - Documentación completa y ejemplos prácticos
50
+
51
+ ## 📦 Instalación
52
+
53
+ **pip**:
54
+ ```bash
55
+ pip install fiscalapi
56
+ ```
57
+
58
+ **poetry**:
59
+ ```bash
60
+ poetry add fiscalapi
61
+ ```
62
+
63
+ ## ⚙️ Configuración
64
+
65
+ ### Configuración Básica
66
+
67
+ 1. **Crea un objeto de configuración** con [tus credenciales](https://docs.fiscalapi.com/credentials-info):
68
+ ```python
69
+ from fiscalapi.models.common_models import FiscalApiSettings
70
+
71
+ settings = FiscalApiSettings(
72
+ api_url="https://test.fiscalapi.com", # https://live.fiscalapi.com (producción)
73
+ api_key="<API_KEY>",
74
+ tenant="<TENANT_KEY>"
75
+ )
76
+ ```
77
+
78
+ 2. **Crea la instancia del cliente**:
79
+ ```python
80
+ from fiscalapi.services.fiscalapi_client import FiscalApiClient
81
+
82
+ client = FiscalApiClient(settings=settings)
83
+ ```
84
+
85
+ ## 🔄 Modos de Operación
86
+
87
+ FiscalAPI admite dos [modos de operación](https://docs.fiscalapi.com/modes-of-operation):
88
+
89
+ - **Por Referencias**: Envía solo IDs de objetos previamente creados en el dashboard de FiscalAPI.
90
+ Ideal para integraciones ligeras.
91
+
92
+ - **Por Valores**: Envía todos los campos requeridos en cada petición, con mayor control sobre los datos.
93
+ No se requiere configuración previa en el dashboard.
94
+
95
+ ## 📝 Ejemplos de Uso
96
+
97
+ ### 1. Crear una Persona (Emisor o Receptor)
98
+
99
+ ```python
100
+ from fiscalapi.models.fiscalapi_models import Person
101
+
102
+ person = Person(
103
+ legal_name="Empresa Python SA de CV",
104
+ email="mail7@gmail.com",
105
+ password="TestPassword1234!"
106
+ )
107
+
108
+ api_response = client.people.create(person)
109
+ ```
110
+
111
+ ### 2. Subir Certificados CSD
112
+
113
+ ```python
114
+ from fiscalapi.models.fiscalapi_models import TaxFile
115
+
116
+ # Subir certificado (CER)
117
+ certificado_csd = TaxFile(
118
+ person_id="3f3478b4-60fd-459e-8bfc-f8239fc96257",
119
+ tin="FUNK671228PH6",
120
+ base64_file="MIIFgDCCA2igAwIBAgIUMzAwMDEwMDAwMDA1MDAwMDM0NDYwDQYJKo...",
121
+ file_type=0, # 0 para certificado, 1 para llave privada
122
+ password="12345678a"
123
+ )
124
+
125
+ # Subir llave privada (KEY)
126
+ clave_privada_csd = TaxFile(
127
+ person_id="3f3478b4-60fd-459e-8bfc-f8239fc96257",
128
+ tin="FUNK671228PH6",
129
+ base64_file="MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIAg...",
130
+ file_type=1,
131
+ password="12345678a"
132
+ )
133
+
134
+ api_response_cer = client.tax_files.create(certificado_csd)
135
+ api_response_key = client.tax_files.create(clave_privada_csd)
136
+ ```
137
+
138
+ ### 3. Crear un Producto o Servicio
139
+
140
+ ```python
141
+ from fiscalapi.models.fiscalapi_models import Product
142
+
143
+ product = Product(
144
+ description="Producto python sin impuestos",
145
+ unit_price=Decimal("100.00")
146
+ )
147
+
148
+ api_response = client.products.create(product)
149
+ ```
150
+
151
+ ### 4. Actualizar Impuestos de un Producto
152
+
153
+ ```python
154
+ from fiscalapi.models.fiscalapi_models import Product, ProductTax
155
+
156
+ product = Product(
157
+ id="f4bf4df3-5a91-4a30-b137-52cb517d13c4",
158
+ description="Producto python sin impuestos",
159
+ unit_price=Decimal("100.00"),
160
+ product_taxes=[
161
+ ProductTax(
162
+ rate=Decimal("0.160000"),
163
+ taxId="002",
164
+ taxFlagId="T",
165
+ taxTypeId="Tasa"
166
+ ),
167
+ ProductTax(
168
+ rate=Decimal("0.106667"),
169
+ taxId="002",
170
+ taxFlagId="R",
171
+ taxTypeId="Tasa"
172
+ ),
173
+ ProductTax(
174
+ rate=Decimal("0.100000"),
175
+ taxId="001",
176
+ taxFlagId="R",
177
+ taxTypeId="Tasa"
178
+ )
179
+ ]
180
+ )
181
+
182
+ api_response = client.products.update(product)
183
+ ```
184
+
185
+ ### 5. Crear una Factura de Ingreso (Por Referencias)
186
+
187
+ ```python
188
+ from datetime import datetime
189
+ from decimal import Decimal
190
+ from fiscalapi.models.fiscalapi_models import Invoice, InvoiceIssuer, InvoiceItem, InvoiceRecipient
191
+
192
+ invoice = Invoice(
193
+ version_code="4.0",
194
+ series="F",
195
+ date=datetime.now().strftime("%Y-%m-%dT%H:%M:%S"),
196
+ payment_form_code="01",
197
+ payment_conditions="Contado",
198
+ currency_code="MXN",
199
+ type_code="I",
200
+ expedition_zip_code="42501",
201
+ payment_method_code="PUE",
202
+ exchange_rate=1,
203
+ export_code="01",
204
+ issuer=InvoiceIssuer(
205
+ id="3f3478b4-60fd-459e-8bfc-f8239fc96257"
206
+ ),
207
+ recipient=InvoiceRecipient(
208
+ id="96b46762-d246-4a67-a562-510a25dbafa9"
209
+ ),
210
+ items=[
211
+ InvoiceItem(
212
+ id="114a4be5-fb65-40b2-a762-ff0c55c6ebfa",
213
+ quantity=Decimal("1.5"),
214
+ discount=Decimal("255.85")
215
+ )
216
+ ]
217
+ )
218
+
219
+ api_response = client.invoices.create(invoice)
220
+ ```
221
+
222
+ ### 6. Crear la Misma Factura de Ingreso (Por Valores)
223
+
224
+ ```python
225
+ from fiscalapi.models.fiscalapi_models import Invoice, InvoiceIssuer, InvoiceItem, InvoiceRecipient, ItemTax, TaxCredential
226
+
227
+ invoice = Invoice(
228
+ version_code="4.0",
229
+ series="F",
230
+ date=datetime.now().strftime("%Y-%m-%dT%H:%M:%S"),
231
+ payment_form_code="01",
232
+ currency_code="MXN",
233
+ type_code="I",
234
+ expedition_zip_code="42501",
235
+ payment_method_code="PUE",
236
+ exchange_rate=1,
237
+ export_code="01",
238
+ issuer=InvoiceIssuer(
239
+ tin="FUNK671228PH6",
240
+ legal_name="KARLA FUENTE NOLASCO",
241
+ tax_regime_code="621",
242
+ tax_credentials=[
243
+ TaxCredential(
244
+ base64_file="MIIFgDCCA2igAwIBAgIUMzAwMDEwMDAwMDA1MDAwMDM0NDYwDQYJKo...",
245
+ file_type=0,
246
+ password="12345678a"
247
+ ),
248
+ TaxCredential(
249
+ base64_file="MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIAg...",
250
+ file_type=1,
251
+ password="12345678a"
252
+ )
253
+ ]
254
+ ),
255
+ recipient=InvoiceRecipient(
256
+ tin="EKU9003173C9",
257
+ legal_name="ESCUELA KEMPER URGATE",
258
+ zip_code="42501",
259
+ tax_regime_code="601",
260
+ cfdi_use_code="G01",
261
+ email="mail@domain.com"
262
+ ),
263
+ items=[
264
+ InvoiceItem(
265
+ item_code="84111506",
266
+ quantity=Decimal("9.5"),
267
+ unit_of_measurement_code="E48",
268
+ description="Invoicing software as a service",
269
+ unit_price=Decimal("3587.75"),
270
+ tax_object_code="02",
271
+ item_sku="7506022301697",
272
+ discount=Decimal("255.85"),
273
+ item_taxes=[
274
+ ItemTax(
275
+ tax_code="002",
276
+ tax_type_code="Tasa",
277
+ tax_rate=Decimal("0.160000"),
278
+ tax_flag_code="T"
279
+ )
280
+ ]
281
+ )
282
+ ]
283
+ )
284
+
285
+ api_response = client.invoices.create(invoice)
286
+ ```
287
+
288
+ ### 7. Búsqueda en Catálogos del SAT
289
+
290
+ ```python
291
+ # Buscar registros que contengan 'inter' en el catalogo 'SatUnitMeasurements' (página 1, tamaño página 10)
292
+ api_response = client.catalogs.search_catalog("SatUnitMeasurements", "inter", 1, 10)
293
+
294
+ if api_response.succeeded:
295
+ for item in api_response.data.items:
296
+ print(f"Unidad: {item.description}")
297
+ else:
298
+ print(api_response.message)
299
+ ```
300
+
301
+ ## 📋 Operaciones Principales
302
+
303
+ - **Facturas (CFDI)**
304
+ Crear facturas de ingreso, notas de crédito, complementos de pago, cancelaciones, generación de PDF/XML.
305
+ - **Personas (Clientes/Emisores)**
306
+ Alta y administración de personas, gestión de certificados (CSD).
307
+ - **Productos y Servicios**
308
+ Administración de catálogos de productos, búsqueda en catálogos SAT.
309
+
310
+ ## 🤝 Contribuir
311
+
312
+ 1. Haz un fork del repositorio.
313
+ 2. Crea una rama para tu feature: `git checkout -b feature/AmazingFeature`
314
+ 3. Realiza commits de tus cambios: `git commit -m 'Add some AmazingFeature'`
315
+ 4. Sube tu rama: `git push origin feature/AmazingFeature`
316
+ 5. Abre un Pull Request en GitHub.
317
+
318
+ ## 🐛 Reportar Problemas
319
+
320
+ 1. Asegúrate de usar la última versión del SDK.
321
+ 2. Verifica si el problema ya fue reportado.
322
+ 3. Proporciona un ejemplo mínimo reproducible.
323
+ 4. Incluye los mensajes de error completos.
324
+
325
+ ## 📄 Licencia
326
+
327
+ Este proyecto está licenciado bajo la Licencia **MPL**. Consulta el archivo [LICENSE](LICENSE.txt) para más detalles.
328
+
329
+ ## 🔗 Enlaces Útiles
330
+
331
+ - [Documentación Oficial](https://docs.fiscalapi.com)
332
+ - [Portal de FiscalAPI](https://fiscalapi.com)
333
+ - [Ejemplos en Python](https://github.com/FiscalAPI/fiscalapi-samples-python)
334
+
335
+ ---
336
+
337
+ Desarrollado con ❤️ por [Fiscalapi](https://www.fiscalapi.com)