CANCELLED and setting isActive to false. This action is logged in the activity system for audit purposes.
Authentication
Requires authentication. Available to roles:VENDEDOR, VENTANA, ADMIN.
Path Parameters
UUID of the ticket to cancel.
Request Body
No request body required.Response Fields
UUID of the cancelled ticket.
Unique ticket number (e.g., “T260303-00042A-15”).
Total amount of the ticket.
Updated status:
CANCELLED.Updated active flag:
false.UUID of the lottery.
UUID of the sorteo.
UUID of the ventana.
UUID of the vendedor.
Customer name.
ISO 8601 timestamp of ticket creation.
ISO 8601 timestamp of last update (will reflect cancellation time).
ISO 8601 timestamp when the ticket was cancelled (soft delete).
UUID of the user who cancelled the ticket.
Reason for cancellation (typically “Cancelled by user”).
Behavior
Soft Delete
The cancel operation performs a soft delete:- Sets
statustoCANCELLED - Sets
isActivetofalse - Sets
deletedAtto current timestamp - Sets
deletedByto the requesting user’s ID - Sets
deletedReasonto “Cancelled by user”
Activity Logging
A new activity log entry is created with:- Action:
TICKET_CANCEL - Target Type:
TICKET - Target ID: Ticket UUID
- Details: Includes ticket number, total amount, and reason
- Description: Human-readable cancellation summary
Validation
The ticket must:- Exist in the database
- Not already be cancelled
- Not be in
EVALUATEDorPAIDstatus (winners cannot be cancelled)
Example Request
Example Response
Error Responses
404 Not Found
409 Conflict - Already Cancelled
409 Conflict - Cannot Cancel Winner
RBAC Considerations
VENDEDOR
- Can cancel their own tickets
- Cannot cancel tickets from other vendedores
- Can only cancel tickets that are still
ACTIVE
VENTANA
- Can cancel tickets from any vendedor in their ventana
- Can only cancel tickets that are still
ACTIVE
ADMIN
- Can cancel any ticket in the system
- Can only cancel tickets that are still
ACTIVE
Restore Functionality
Cancelled tickets can be restored using thePOST /api/v1/tickets/:id/restore endpoint, which:
- Sets
statusback toACTIVE - Sets
isActivetotrue - Clears
deletedAt,deletedBy, anddeletedReason
Impact on Reports
Cancelled tickets:- Are excluded from sales reports by default (via
deletedAt IS NULLfilter) - Are excluded from commission calculations
- Are excluded from payout calculations
- Can be included in reports by explicitly filtering for
status=CANCELLED
Activity Log Example
When a ticket is cancelled, an activity log entry is created:Notes
- Cancellation is a soft delete operation - the ticket remains in the database
- All jugadas associated with the ticket remain intact but inherit the cancelled status
- Cancelled tickets do not affect lottery number limits or restrictions
- Commission calculations exclude cancelled tickets
- The operation is atomic and logged for audit purposes
- Cancelled tickets cannot be cancelled again (idempotent operation)
- Winners (tickets with
isWinner=true) cannot be cancelled for financial integrity