Basket deletion failedv1.0.0 · JSON Schema
Indicates that Basket could not delete the submitted basket during checkout cleanup.
1. Post-Checkout Basket Cleanup Failed
When IBasketRepository.DeleteBasketAsync returns false (for example, the Redis key expired or was already removed), Basket API publishes BasketDeletedFailedIntegrationEvent so Finance triggers saga compensation.
Payload details
id: UUIDv7 generated byIntegrationEvent(Guid.CreateVersion7()).creationDate: UTC ISO 8601 timestamp (DateTime.UtcNow).orderId: UUID of the placed order (also used as the Kafka partition key).basketId: UUID of the Redis basket that could not be deleted.email: Optional customer email (string | null) forwarded for recovery or notification workflows.totalMoney: Non-negative order total (decimal).
Example payload
{ "id": "01960a1b-4d5e-7f02-8a9b-0c1d2e3f4b02", "creationDate": "2026-11-25T16:15:02Z", "orderId": "01960a1b-3c4d-7e00-8a9b-0c1d2e3f4a99", "basketId": "01960a1b-2c3d-7e4f-8a9b-0c1d2e3f4a01", "email": "minh.nguyen@bookworm.dev", "totalMoney": 59.98}Using this example
Basket API publishes BasketDeletedFailedIntegrationEvent to bookworm.{env}.basket.delete-failed partitioned by OrderId, and Finance executes PublishDeleteBasketFailedActivity to compensate the order in Ordering API.
using BookWorm.Chassis.EventBus;using BookWorm.Contracts;using Wolverine.Attributes;
// Integration event contract (BookWorm.Contracts)[IntegrationMessageOwner(ServiceName = Services.Basket, TopicName = "delete-failed")][MessageIdentity("BookWorm.Contracts.BasketDeletedFailedIntegrationEvent")]public sealed record BasketDeletedFailedIntegrationEvent( Guid OrderId, Guid BasketId, string? Email, decimal TotalMoney) : IntegrationEvent;
// Publishing from Basket API's PlaceOrderCommandHandler via Wolverine[WolverineHandler]public async Task<IntegrationEvent> Handle( PlaceOrderCommand command, CancellationToken cancellationToken){ var deleted = await repository.DeleteBasketAsync(command.BasketId.ToString());
if (!deleted) { return new BasketDeletedFailedIntegrationEvent( command.OrderId, command.BasketId, command.Email, command.TotalMoney ); }
return new BasketDeletedCompleteIntegrationEvent( command.OrderId, command.BasketId, command.TotalMoney );}1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "title": "BasketDeletedFailedIntegrationEvent",
4 "type": "object",
5 "additionalProperties": false,
6 "required": ["id", "creationDate", "orderId", "basketId", "totalMoney"],
7 "properties": {
8 "id": {
9 "type": "string",
10 "format": "uuid",
11 "description": "Unique identifier assigned by the integration-event building block."
12 },
13 "creationDate": {
14 "type": "string",
15 "format": "date-time",
16 "description": "UTC timestamp when the integration event was created."
17 },
18 "orderId": {
19 "type": "string",
20 "format": "uuid",
21 "description": "Identifier of the order whose submitted basket could not be deleted."
22 },
23 "basketId": {
24 "type": "string",
25 "format": "uuid",
26 "description": "Identifier of the basket that could not be deleted."
27 },
28 "email": {
29 "type": ["string", "null"],
30 "format": "email",
31 "description": "Customer email used by downstream recovery or notification workflows."
32 },
33 "totalMoney": {
34 "type": "number",
35 "format": "double",
36 "description": "Total purchase amount associated with the order."
37 }
38 }
39}
40