fiscalapi 4.0.468__tar.gz → 4.0.474__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 (52) hide show
  1. {fiscalapi-4.0.468/fiscalapi.egg-info → fiscalapi-4.0.474}/PKG-INFO +9 -8
  2. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/README.md +3 -1
  3. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/models/webhook_models.py +1 -0
  4. {fiscalapi-4.0.468 → fiscalapi-4.0.474/fiscalapi.egg-info}/PKG-INFO +9 -8
  5. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi.egg-info/SOURCES.txt +1 -0
  6. fiscalapi-4.0.474/fiscalapi.egg-info/requires.txt +4 -0
  7. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/setup.py +6 -7
  8. fiscalapi-4.0.474/tests/test_cancel_invoice_rejection.py +32 -0
  9. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/tests/test_webhook_back_interop.py +23 -3
  10. fiscalapi-4.0.468/fiscalapi.egg-info/requires.txt +0 -4
  11. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/LICENSE.txt +0 -0
  12. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/MANIFEST.in +0 -0
  13. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/__init__.py +0 -0
  14. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/models/__init__.py +0 -0
  15. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/models/carta_porte_models.py +0 -0
  16. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/models/comercio_exterior_models.py +0 -0
  17. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/models/common_models.py +0 -0
  18. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/models/fiscalapi_models.py +0 -0
  19. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/models/manifest_models.py +0 -0
  20. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/models/sat_validation_models.py +0 -0
  21. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/models/ticket_models.py +0 -0
  22. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/py.typed +0 -0
  23. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/__init__.py +0 -0
  24. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/api_key_service.py +0 -0
  25. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/base_service.py +0 -0
  26. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/catalog_service.py +0 -0
  27. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/download_catalog_service.py +0 -0
  28. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/download_request_service.py +0 -0
  29. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/download_rule_service.py +0 -0
  30. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/employee_service.py +0 -0
  31. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/employer_service.py +0 -0
  32. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/fiscalapi_client.py +0 -0
  33. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/invoice_service.py +0 -0
  34. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/manifest_service.py +0 -0
  35. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/people_service.py +0 -0
  36. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/product_service.py +0 -0
  37. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/sat_validation_service.py +0 -0
  38. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/stamp_service.py +0 -0
  39. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/tax_file_service.py +0 -0
  40. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/services/ticket_service.py +0 -0
  41. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi/webhooks.py +0 -0
  42. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi.egg-info/dependency_links.txt +0 -0
  43. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/fiscalapi.egg-info/top_level.txt +0 -0
  44. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/pyproject.toml +0 -0
  45. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/setup.cfg +0 -0
  46. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/tests/test_cycle_contract.py +0 -0
  47. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/tests/test_error_trace_identifier.py +0 -0
  48. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/tests/test_idempotency_key.py +0 -0
  49. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/tests/test_invoice_item_ticket_id.py +0 -0
  50. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/tests/test_response_tolerance.py +0 -0
  51. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/tests/test_ticket_service.py +0 -0
  52. {fiscalapi-4.0.468 → fiscalapi-4.0.474}/tests/test_webhook_verify.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fiscalapi
3
- Version: 4.0.468
3
+ Version: 4.0.474
4
4
  Summary: Genera facturas CFDI válidas ante el SAT consumiendo el API de https://www.fiscalapi.com
5
5
  Home-page: https://www.fiscalapi.com
6
6
  Author: Fiscalapi
@@ -10,18 +10,17 @@ Keywords: factura,cfdi,facturacion,mexico,sat,fiscalapi
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
13
- Classifier: Programming Language :: Python :: 3.9
14
13
  Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
17
16
  Classifier: Topic :: Office/Business :: Financial
18
- Requires-Python: >=3.9
17
+ Requires-Python: >=3.10
19
18
  Description-Content-Type: text/markdown
20
19
  License-File: LICENSE.txt
21
- Requires-Dist: pydantic>=2.0.0
22
- Requires-Dist: requests>=2.0.0
23
- Requires-Dist: urllib3>=1.0.0
24
- Requires-Dist: certifi>=2023.0.0
20
+ Requires-Dist: pydantic>=2.4.0
21
+ Requires-Dist: requests>=2.33.0
22
+ Requires-Dist: urllib3>=2.8.0
23
+ Requires-Dist: certifi>=2026.10.18
25
24
  Dynamic: author
26
25
  Dynamic: author-email
27
26
  Dynamic: classifier
@@ -113,6 +112,8 @@ Dynamic: summary
113
112
 
114
113
  ## 📦 Instalación
115
114
 
115
+ Requiere **Python 3.10 o superior**.
116
+
116
117
  **pip**:
117
118
  ```bash
118
119
  pip install fiscalapi
@@ -644,7 +645,7 @@ def process_events():
644
645
  threading.Thread(target=process_events, daemon=True).start()
645
646
  ```
646
647
 
647
- - `WebhookEvent` es el mismo sobre para todo evento: `id`, `type` (texto; compárelo con las constantes de `WebhookEventTypes`), `created_at` (`datetime` en UTC), `person_id` (`None` si el recurso no tiene persona) y `data` con `related_object` (`id`, `type`, `url`), `status` y `previous_status`.
648
+ - `WebhookEvent` es el mismo sobre para todo evento: `id`, `type` (texto; compárelo con las constantes de `WebhookEventTypes`), `created_at` (`datetime` en UTC), `person_id` (`None` si el recurso no tiene persona) y `data` con `related_object` (`id`, `type`, `url`), `status`, `previous_status` y `reason` (`None` salvo en `invoice.cancellation_rejected`, donde dice por qué no procedió la cancelación).
648
649
  - `related_object.url` es la ruta relativa del GET v4 del recurso (`/api/v4/invoices/{id}`); para leerlo, use el servicio de su tipo con `related_object.id`.
649
650
  - El botón "Enviar prueba" del webhook (`POST /api/v4/webhooks/{id}/test`) envía `WebhookEventTypes.WEBHOOK_TEST` (`webhook.test`), cuyo `related_object` es el webhook mismo (`type` `webhook`, `url` `/api/v4/webhooks/{id}`), sin persona ni estados; no se suscribe.
650
651
  - Durante una rotación del secreto, FiscalAPI firma con el nuevo y con el anterior por 24 h: pase ambos, `webhooks.verify(request.headers, body, [secreto_nuevo, secreto_anterior])`.
@@ -76,6 +76,8 @@
76
76
 
77
77
  ## 📦 Instalación
78
78
 
79
+ Requiere **Python 3.10 o superior**.
80
+
79
81
  **pip**:
80
82
  ```bash
81
83
  pip install fiscalapi
@@ -607,7 +609,7 @@ def process_events():
607
609
  threading.Thread(target=process_events, daemon=True).start()
608
610
  ```
609
611
 
610
- - `WebhookEvent` es el mismo sobre para todo evento: `id`, `type` (texto; compárelo con las constantes de `WebhookEventTypes`), `created_at` (`datetime` en UTC), `person_id` (`None` si el recurso no tiene persona) y `data` con `related_object` (`id`, `type`, `url`), `status` y `previous_status`.
612
+ - `WebhookEvent` es el mismo sobre para todo evento: `id`, `type` (texto; compárelo con las constantes de `WebhookEventTypes`), `created_at` (`datetime` en UTC), `person_id` (`None` si el recurso no tiene persona) y `data` con `related_object` (`id`, `type`, `url`), `status`, `previous_status` y `reason` (`None` salvo en `invoice.cancellation_rejected`, donde dice por qué no procedió la cancelación).
611
613
  - `related_object.url` es la ruta relativa del GET v4 del recurso (`/api/v4/invoices/{id}`); para leerlo, use el servicio de su tipo con `related_object.id`.
612
614
  - El botón "Enviar prueba" del webhook (`POST /api/v4/webhooks/{id}/test`) envía `WebhookEventTypes.WEBHOOK_TEST` (`webhook.test`), cuyo `related_object` es el webhook mismo (`type` `webhook`, `url` `/api/v4/webhooks/{id}`), sin persona ni estados; no se suscribe.
613
615
  - Durante una rotación del secreto, FiscalAPI firma con el nuevo y con el anterior por 24 h: pase ambos, `webhooks.verify(request.headers, body, [secreto_nuevo, secreto_anterior])`.
@@ -65,6 +65,7 @@ class WebhookEventData(BaseModel):
65
65
  related_object: Optional[WebhookRelatedObject] = Field(default=None, alias="relatedObject", description="El recurso que cambió de estado.")
66
66
  status: Optional[str] = Field(default=None, alias="status", description="Estado al que llegó el recurso, con los códigos públicos de la API v4 (factura V, C, X; solicitud de descarga 1, 2, 3, -1; regla de descarga 1..4, -1); None si el tipo de evento no lo lleva.")
67
67
  previous_status: Optional[str] = Field(default=None, alias="previousStatus", description="Estado del que salió el recurso, con los mismos códigos que status; None si no aplica.")
68
+ reason: Optional[str] = Field(default=None, alias="reason", description="Motivo de la transición. Todo evento lo trae; es None salvo en invoice.cancellation_rejected, donde dice por qué no procedió la cancelación (rejectedByRecipient, expired, notRequested o notCancelable). Es texto libre: pueden aparecer valores nuevos.")
68
69
 
69
70
  model_config = ConfigDict(populate_by_name=True)
70
71
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fiscalapi
3
- Version: 4.0.468
3
+ Version: 4.0.474
4
4
  Summary: Genera facturas CFDI válidas ante el SAT consumiendo el API de https://www.fiscalapi.com
5
5
  Home-page: https://www.fiscalapi.com
6
6
  Author: Fiscalapi
@@ -10,18 +10,17 @@ Keywords: factura,cfdi,facturacion,mexico,sat,fiscalapi
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
13
- Classifier: Programming Language :: Python :: 3.9
14
13
  Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
17
16
  Classifier: Topic :: Office/Business :: Financial
18
- Requires-Python: >=3.9
17
+ Requires-Python: >=3.10
19
18
  Description-Content-Type: text/markdown
20
19
  License-File: LICENSE.txt
21
- Requires-Dist: pydantic>=2.0.0
22
- Requires-Dist: requests>=2.0.0
23
- Requires-Dist: urllib3>=1.0.0
24
- Requires-Dist: certifi>=2023.0.0
20
+ Requires-Dist: pydantic>=2.4.0
21
+ Requires-Dist: requests>=2.33.0
22
+ Requires-Dist: urllib3>=2.8.0
23
+ Requires-Dist: certifi>=2026.10.18
25
24
  Dynamic: author
26
25
  Dynamic: author-email
27
26
  Dynamic: classifier
@@ -113,6 +112,8 @@ Dynamic: summary
113
112
 
114
113
  ## 📦 Instalación
115
114
 
115
+ Requiere **Python 3.10 o superior**.
116
+
116
117
  **pip**:
117
118
  ```bash
118
119
  pip install fiscalapi
@@ -644,7 +645,7 @@ def process_events():
644
645
  threading.Thread(target=process_events, daemon=True).start()
645
646
  ```
646
647
 
647
- - `WebhookEvent` es el mismo sobre para todo evento: `id`, `type` (texto; compárelo con las constantes de `WebhookEventTypes`), `created_at` (`datetime` en UTC), `person_id` (`None` si el recurso no tiene persona) y `data` con `related_object` (`id`, `type`, `url`), `status` y `previous_status`.
648
+ - `WebhookEvent` es el mismo sobre para todo evento: `id`, `type` (texto; compárelo con las constantes de `WebhookEventTypes`), `created_at` (`datetime` en UTC), `person_id` (`None` si el recurso no tiene persona) y `data` con `related_object` (`id`, `type`, `url`), `status`, `previous_status` y `reason` (`None` salvo en `invoice.cancellation_rejected`, donde dice por qué no procedió la cancelación).
648
649
  - `related_object.url` es la ruta relativa del GET v4 del recurso (`/api/v4/invoices/{id}`); para leerlo, use el servicio de su tipo con `related_object.id`.
649
650
  - El botón "Enviar prueba" del webhook (`POST /api/v4/webhooks/{id}/test`) envía `WebhookEventTypes.WEBHOOK_TEST` (`webhook.test`), cuyo `related_object` es el webhook mismo (`type` `webhook`, `url` `/api/v4/webhooks/{id}`), sin persona ni estados; no se suscribe.
650
651
  - Durante una rotación del secreto, FiscalAPI firma con el nuevo y con el anterior por 24 h: pase ambos, `webhooks.verify(request.headers, body, [secreto_nuevo, secreto_anterior])`.
@@ -38,6 +38,7 @@ fiscalapi/services/sat_validation_service.py
38
38
  fiscalapi/services/stamp_service.py
39
39
  fiscalapi/services/tax_file_service.py
40
40
  fiscalapi/services/ticket_service.py
41
+ tests/test_cancel_invoice_rejection.py
41
42
  tests/test_cycle_contract.py
42
43
  tests/test_error_trace_identifier.py
43
44
  tests/test_idempotency_key.py
@@ -0,0 +1,4 @@
1
+ pydantic>=2.4.0
2
+ requests>=2.33.0
3
+ urllib3>=2.8.0
4
+ certifi>=2026.10.18
@@ -2,7 +2,7 @@
2
2
  import os
3
3
  from setuptools import setup, find_packages
4
4
 
5
- VERSION = "4.0.468"
5
+ VERSION = "4.0.474"
6
6
 
7
7
  DESCRIPTION = "Genera facturas CFDI válidas ante el SAT consumiendo el API de https://www.fiscalapi.com"
8
8
 
@@ -36,20 +36,19 @@ setup(
36
36
  include_package_data=True,
37
37
  keywords=["factura", "cfdi", "facturacion", "mexico", "sat", "fiscalapi"],
38
38
 
39
- python_requires=">=3.9",
39
+ python_requires=">=3.10",
40
40
 
41
41
  install_requires=[
42
- "pydantic>=2.0.0",
43
- "requests>=2.0.0",
44
- "urllib3>=1.0.0",
45
- "certifi>=2023.0.0",
42
+ "pydantic>=2.4.0",
43
+ "requests>=2.33.0",
44
+ "urllib3>=2.8.0",
45
+ "certifi>=2026.10.18",
46
46
  ],
47
47
 
48
48
  classifiers=[
49
49
  "Development Status :: 5 - Production/Stable",
50
50
  "Intended Audience :: Developers",
51
51
  "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
52
- "Programming Language :: Python :: 3.9",
53
52
  "Programming Language :: Python :: 3.10",
54
53
  "Programming Language :: Python :: 3.11",
55
54
  "Programming Language :: Python :: 3.12",
@@ -0,0 +1,32 @@
1
+ """Cancelar factura con rechazo del SAT: 422, ``succeeded`` en False y el acuse en ``error_data``."""
2
+ from fiscalapi import CancelInvoiceRequest, CancelInvoiceResponse
3
+
4
+ INVOICE_ID = "21c39425-9d0a-449b-a7ba-49335b85b062"
5
+ INVOICE_UUID = "de841944-bd4f-4bb8-adfe-2a2282787c62"
6
+
7
+ SAT_REJECTION = {
8
+ "data": {
9
+ "base64CancellationAcknowledgement": "PD94bWwgdmVyc2lvbj0iMS4wIj8+...",
10
+ "invoiceUuids": {INVOICE_UUID: "203"},
11
+ },
12
+ "succeeded": False,
13
+ "message": "Sorry, it's not me, it's you.",
14
+ "details": "SAT 203: el folio fiscal no corresponde al emisor de la solicitud de cancelación.",
15
+ "httpStatusCode": 422,
16
+ }
17
+
18
+
19
+ def test_a_sat_rejection_is_422_with_the_sat_details_and_the_acknowledgement_in_error_data(client, fake_api):
20
+ fake_api.respond_with(SAT_REJECTION, status_code=422)
21
+
22
+ response = client.invoices.cancel(CancelInvoiceRequest(id=INVOICE_ID, cancellation_reason_code="02"))
23
+
24
+ assert response.succeeded is False
25
+ assert response.http_status_code == 422
26
+ assert response.message == "Sorry, it's not me, it's you."
27
+ assert response.details == "SAT 203: el folio fiscal no corresponde al emisor de la solicitud de cancelación."
28
+ assert response.data is None
29
+ rejection = CancelInvoiceResponse.model_validate(response.error_data)
30
+ assert rejection.base64_cancellation_acknowledgement == "PD94bWwgdmVyc2lvbj0iMS4wIj8+..."
31
+ assert rejection.invoice_uuids == {INVOICE_UUID: "203"}
32
+ assert fake_api.requests[0]["method"] == "DELETE"
@@ -20,20 +20,27 @@ TIMESTAMP = 1791830873 # 2026-10-12T18:47:53Z, el createdAt de los sobres
20
20
  CANCELED_INVOICE_BODY = (
21
21
  '{"id":"0f6b2c1e-7d3a-4e8b-9c51-2a4d6e8f0b13","type":"invoice.canceled","createdAt":"2026-10-12T18:47:53Z",'
22
22
  '"personId":"4b1c2d3e-0000-4000-8000-000000000002","data":{"relatedObject":{"id":"9f8e7d6c-0000-4000-8000-0000000000a1",'
23
- '"type":"invoice","url":"/api/v4/invoices/9f8e7d6c-0000-4000-8000-0000000000a1"},"status":"X","previousStatus":"C"}}'
23
+ '"type":"invoice","url":"/api/v4/invoices/9f8e7d6c-0000-4000-8000-0000000000a1"},"status":"X","previousStatus":"C","reason":null}}'
24
+ )
25
+
26
+ REJECTED_CANCELLATION_BODY = (
27
+ '{"id":"0f6b2c1e-7d3a-4e8b-9c51-2a4d6e8f0b13","type":"invoice.cancellation_rejected","createdAt":"2026-10-12T18:47:53Z",'
28
+ '"personId":"4b1c2d3e-0000-4000-8000-000000000002","data":{"relatedObject":{"id":"9f8e7d6c-0000-4000-8000-0000000000a1",'
29
+ '"type":"invoice","url":"/api/v4/invoices/9f8e7d6c-0000-4000-8000-0000000000a1"},"status":"V","previousStatus":"C",'
30
+ '"reason":"rejectedByRecipient"}}'
24
31
  )
25
32
 
26
33
  COMPLETED_DOWNLOAD_REQUEST_BODY = (
27
34
  '{"id":"0f6b2c1e-7d3a-4e8b-9c51-2a4d6e8f0b13","type":"download_request.completed","createdAt":"2026-10-12T18:47:53Z",'
28
35
  '"personId":null,"data":{"relatedObject":{"id":"3c2b1a09-0000-4000-8000-0000000000b7","type":"download_request",'
29
- '"url":"/api/v4/download-requests/3c2b1a09-0000-4000-8000-0000000000b7"},"status":null,"previousStatus":null}}'
36
+ '"url":"/api/v4/download-requests/3c2b1a09-0000-4000-8000-0000000000b7"},"status":null,"previousStatus":null,"reason":null}}'
30
37
  )
31
38
 
32
39
  # El sobre de "Enviar prueba" del back (POST /api/v4/webhooks/{id}/test): el recurso es el webhook mismo.
33
40
  WEBHOOK_TEST_BODY = (
34
41
  '{"id":"0f6b2c1e-7d3a-4e8b-9c51-2a4d6e8f0b13","type":"webhook.test","createdAt":"2026-10-12T18:47:53Z",'
35
42
  '"personId":null,"data":{"relatedObject":{"id":"6a5b4c3d-0000-4000-8000-0000000000c9","type":"webhook",'
36
- '"url":"/api/v4/webhooks/6a5b4c3d-0000-4000-8000-0000000000c9"},"status":null,"previousStatus":null}}'
43
+ '"url":"/api/v4/webhooks/6a5b4c3d-0000-4000-8000-0000000000c9"},"status":null,"previousStatus":null,"reason":null}}'
37
44
  )
38
45
 
39
46
 
@@ -60,6 +67,19 @@ def test_a_back_delivery_signed_during_a_rotation_verifies_with_either_secret_an
60
67
  assert event.data.related_object.url == "/api/v4/invoices/" + INVOICE_ID
61
68
  assert event.data.status == "X"
62
69
  assert event.data.previous_status == "C"
70
+ assert event.data.reason is None
71
+
72
+
73
+ def test_a_rejected_cancellation_carries_the_reason():
74
+ secret = generate_secret()
75
+ delivery_headers = headers(EVENT_ID, TIMESTAMP, REJECTED_CANCELLATION_BODY, secret)
76
+
77
+ event = verify_delivered(delivery_headers, REJECTED_CANCELLATION_BODY, secret)
78
+
79
+ assert event.type == WebhookEventTypes.INVOICE_CANCELLATION_REJECTED
80
+ assert event.data.status == "V"
81
+ assert event.data.previous_status == "C"
82
+ assert event.data.reason == "rejectedByRecipient"
63
83
 
64
84
 
65
85
  def test_a_back_delivery_without_person_or_statuses_reads_them_as_none():
@@ -1,4 +0,0 @@
1
- pydantic>=2.0.0
2
- requests>=2.0.0
3
- urllib3>=1.0.0
4
- certifi>=2023.0.0
File without changes
File without changes
File without changes
File without changes