From 811a841857b5df9cce6146cbdfcfc861818b075c Mon Sep 17 00:00:00 2001 From: mendozagit Date: Sat, 7 Nov 2026 18:45:25 -0600 Subject: [PATCH 1/3] =?UTF-8?q?Eventos:=20reason=20en=20los=20sobres=20de?= =?UTF-8?q?=20fixtures=20y=20ejemplos=20de=20la=20documentaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/listen.md | 2 +- docs/trigger.md | 4 ++-- docs/webhooks-y-eventos.md | 3 ++- tests/FiscalApi.Cli.Tests/Commands/EventsCommandTests.cs | 4 ++-- tests/FiscalApi.Cli.Tests/Listen/FakeListenerApi.cs | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/listen.md b/docs/listen.md index 5d5cda5..554b569 100644 --- a/docs/listen.md +++ b/docs/listen.md @@ -153,7 +153,7 @@ Con `--json`, stdout lleva un objeto JSON por entrega, uno por línea (JSON Line `Ready. Your signing secret is` siguen en stderr como texto. ```json -{"time":"2026-10-12T09:47:46.1234567-06:00","deliveryId":"a7b8c9d0-e1f2-4a3b-8c4d-5e6f7a8b9c0d","eventId":"3f9c1d2e-7b4a-4e8f-9a1b-2c3d4e5f6a7b","type":"invoice.canceled","statusCode":200,"latencyMs":12,"event":{"id":"3f9c1d2e-7b4a-4e8f-9a1b-2c3d4e5f6a7b","type":"invoice.canceled","createdAt":"2026-10-12T15:47:46Z","personId":null,"data":{"relatedObject":{"id":"c4d3e2f1-a0b9-4c8d-9e7f-6a5b4c3d2e1f","type":"invoice","url":"/api/v4/invoices/c4d3e2f1-a0b9-4c8d-9e7f-6a5b4c3d2e1f"},"status":"X","previousStatus":"C"}}} +{"time":"2026-10-12T09:47:46.1234567-06:00","deliveryId":"a7b8c9d0-e1f2-4a3b-8c4d-5e6f7a8b9c0d","eventId":"3f9c1d2e-7b4a-4e8f-9a1b-2c3d4e5f6a7b","type":"invoice.canceled","statusCode":200,"latencyMs":12,"event":{"id":"3f9c1d2e-7b4a-4e8f-9a1b-2c3d4e5f6a7b","type":"invoice.canceled","createdAt":"2026-10-12T15:47:46Z","personId":null,"data":{"relatedObject":{"id":"c4d3e2f1-a0b9-4c8d-9e7f-6a5b4c3d2e1f","type":"invoice","url":"/api/v4/invoices/c4d3e2f1-a0b9-4c8d-9e7f-6a5b4c3d2e1f"},"status":"X","previousStatus":"C","reason":null}}} ``` | Campo | Contenido | diff --git a/docs/trigger.md b/docs/trigger.md index 34f2d9d..fb49ead 100644 --- a/docs/trigger.md +++ b/docs/trigger.md @@ -73,8 +73,8 @@ $ fiscalapi trigger invoice.canceled --json ## Cómo se entrega -- El evento tiene la forma y la firma de uno real: el recurso, `status` y `previousStatus` de su tipo (por ejemplo, - `invoice.canceled` pasa de `C` a `X`). Tu servidor lo verifica con el mismo código. +- El evento tiene la forma y la firma de uno real: el recurso, `status`, `previousStatus` y `reason` de su tipo (por + ejemplo, `invoice.canceled` pasa de `C` a `X` y su `reason` es `null`). Tu servidor lo verifica con el mismo código. - Llega solo al destino indicado, aunque no esté suscrito a ese tipo ni a esa persona. Tus demás webhooks no lo reciben. - Es un solo intento: si tu servidor falla, no se reintenta. Repítelo con `trigger` o con diff --git a/docs/webhooks-y-eventos.md b/docs/webhooks-y-eventos.md index 99c32ef..f65df0f 100644 --- a/docs/webhooks-y-eventos.md +++ b/docs/webhooks-y-eventos.md @@ -243,7 +243,8 @@ $ fiscalapi events retrieve 0d6f5c1e-8a2b-4c3d-9e8f-7a6b5c4d3e2f "url": "/api/v4/invoices/c4d3e2f1-a0b9-4c8d-9e7f-6a5b4c3d2e1f" }, "status": "X", - "previousStatus": "C" + "previousStatus": "C", + "reason": null } } ``` diff --git a/tests/FiscalApi.Cli.Tests/Commands/EventsCommandTests.cs b/tests/FiscalApi.Cli.Tests/Commands/EventsCommandTests.cs index 1fecd3d..158bad8 100644 --- a/tests/FiscalApi.Cli.Tests/Commands/EventsCommandTests.cs +++ b/tests/FiscalApi.Cli.Tests/Commands/EventsCommandTests.cs @@ -10,10 +10,10 @@ public sealed class EventsCommandTests private const string EventId = "0d6f5c1e-8a2b-4c3d-9e8f-7a6b5c4d3e2f"; private const string Envelope = - $$$"""{"id":"{{{EventId}}}","type":"invoice.canceled","createdAt":"2026-10-12T15:47:46Z","personId":"persona-1","data":{"relatedObject":{"id":"factura-1","type":"invoice","url":"/api/v4/invoices/factura-1"},"status":"X","previousStatus":"C"}}"""; + $$$"""{"id":"{{{EventId}}}","type":"invoice.canceled","createdAt":"2026-10-12T15:47:46Z","personId":"persona-1","data":{"relatedObject":{"id":"factura-1","type":"invoice","url":"/api/v4/invoices/factura-1"},"status":"X","previousStatus":"C","reason":null}}"""; private const string OtherEnvelope = - """{"id":"evt-2","type":"webhook.test","createdAt":"2026-10-12T15:40:00Z","personId":null,"data":{"relatedObject":{"id":"we-1","type":"webhook","url":"/api/v4/webhooks/we-1"},"status":null,"previousStatus":null}}"""; + """{"id":"evt-2","type":"webhook.test","createdAt":"2026-10-12T15:40:00Z","personId":null,"data":{"relatedObject":{"id":"we-1","type":"webhook","url":"/api/v4/webhooks/we-1"},"status":null,"previousStatus":null,"reason":null}}"""; private const string Page = $$"""{"items":[{{Envelope}},{{OtherEnvelope}}],"pageNumber":1,"totalPages":1,"totalCount":2,"hasPreviousPage":false,"hasNextPage":false}"""; diff --git a/tests/FiscalApi.Cli.Tests/Listen/FakeListenerApi.cs b/tests/FiscalApi.Cli.Tests/Listen/FakeListenerApi.cs index 7c57419..78da60b 100644 --- a/tests/FiscalApi.Cli.Tests/Listen/FakeListenerApi.cs +++ b/tests/FiscalApi.Cli.Tests/Listen/FakeListenerApi.cs @@ -267,7 +267,7 @@ internal sealed record FakeDelivery( public string EnvelopeBody => Body ?? $$$""" {"id":"{{{EventId}}}","type":"{{{Type}}}","createdAt":"2026-10-12T18:47:53Z","personId":null, - "data":{"relatedObject":{"id":"inv_1","type":"invoice","url":"/api/v4/invoices/inv_1"},"status":"X","previousStatus":"V"}} + "data":{"relatedObject":{"id":"inv_1","type":"invoice","url":"/api/v4/invoices/inv_1"},"status":"X","previousStatus":"V","reason":null}} """; public IReadOnlyDictionary Headers From b3fb23e42e4359625e93af79bd467e2c2e6fc1eb Mon Sep 17 00:00:00 2001 From: mendozagit Date: Sat, 7 Nov 2026 18:58:35 -0600 Subject: [PATCH 2/3] =?UTF-8?q?Versi=C3=B3n=204.0.474=20(unificada=20con?= =?UTF-8?q?=20el=20back)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/instalacion.md | 6 +++--- docs/salida-y-codigos.md | 2 +- src/FiscalApi.Cli/FiscalApi.Cli.csproj | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/instalacion.md b/docs/instalacion.md index 5d8cd36..f72f64c 100644 --- a/docs/instalacion.md +++ b/docs/instalacion.md @@ -17,7 +17,7 @@ y un archivo `SHA256SUMS` con el SHA-256 de cada empaque. El binario de Linux no corre en distribuciones con musl, como Alpine. Los comandos de abajo descargan la última versión publicada. Para una versión fija, cambia `releases/latest/download` -por `releases/download/v`, por ejemplo `releases/download/v4.0.469`. +por `releases/download/v`, por ejemplo `releases/download/v4.0.474`. ## Linux @@ -134,7 +134,7 @@ conservan, porque viven en el almacén de credenciales del sistema y no junto al ```text $ fiscalapi --version -4.0.469 +4.0.474 ``` ### Aviso de versión nueva @@ -144,7 +144,7 @@ enviar tus credenciales. Si hay uno más nuevo, al terminar el comando escribe e ```text -fiscalapi 4.0.470 is available (you have 4.0.469). +fiscalapi 4.0.475 is available (you have 4.0.474). Download it from https://github.com/FiscalAPI/fiscalapi-cli/releases/tag/v ``` diff --git a/docs/salida-y-codigos.md b/docs/salida-y-codigos.md index 39b5d2f..9c5341c 100644 --- a/docs/salida-y-codigos.md +++ b/docs/salida-y-codigos.md @@ -60,7 +60,7 @@ resultado va después, en stdout: ```text $ fiscalapi events list --page-size 1 --verbose > GET https://test.fiscalapi.com/api/v4/events?pageSize=1 -> User-Agent: fiscalapi-cli/4.0.469 +> User-Agent: fiscalapi-cli/4.0.474 < 200 OK (154 ms) < Content-Type: application/json; charset=utf-8 ``` diff --git a/src/FiscalApi.Cli/FiscalApi.Cli.csproj b/src/FiscalApi.Cli/FiscalApi.Cli.csproj index 5c11f7e..d5c42c1 100644 --- a/src/FiscalApi.Cli/FiscalApi.Cli.csproj +++ b/src/FiscalApi.Cli/FiscalApi.Cli.csproj @@ -5,7 +5,7 @@ fiscalapi FiscalApi.Cli true - 4.0.469 + 4.0.474 FiscalAPI CLI FiscalAPI true From 7ac264d659498bbf23ef0cd66915a95d78fed4fa Mon Sep 17 00:00:00 2001 From: mendozagit Date: Sat, 7 Nov 2026 22:58:13 -0600 Subject: [PATCH 3/3] docs: el trigger de invoice.cancellation_rejected trae un reason de ejemplo --- docs/trigger.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/trigger.md b/docs/trigger.md index fb49ead..2e30aa8 100644 --- a/docs/trigger.md +++ b/docs/trigger.md @@ -74,7 +74,8 @@ $ fiscalapi trigger invoice.canceled --json ## Cómo se entrega - El evento tiene la forma y la firma de uno real: el recurso, `status`, `previousStatus` y `reason` de su tipo (por - ejemplo, `invoice.canceled` pasa de `C` a `X` y su `reason` es `null`). Tu servidor lo verifica con el mismo código. + ejemplo, `invoice.canceled` pasa de `C` a `X` con `reason` en `null`, e `invoice.cancellation_rejected` trae + `reason: "rejectedByRecipient"`). Tu servidor lo verifica con el mismo código. - Llega solo al destino indicado, aunque no esté suscrito a ese tipo ni a esa persona. Tus demás webhooks no lo reciben. - Es un solo intento: si tu servidor falla, no se reintenta. Repítelo con `trigger` o con