Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/DragonesMagicos/ferromax_v0.8/llms.txt

Use this file to discover all available pages before exploring further.

The /ventas endpoints handle all sales transactions — both in-store POS sales and online Tienda orders. The sale origin (POS vs WEB) is set automatically based on the caller’s role: a CLIENTE token produces a WEB origin, while ADMIN or EMPLEADO tokens produce a POS origin. The cajeroId is always extracted from the JWT; callers never supply it directly.

POST /api/ventas

Registers a new sale and decrements stock for each item in the transaction. Auth: ADMIN, EMPLEADO, or CLIENTE

Request Body (VentaRequest)

medioPago
string
required
Payment method. Must be one of the MedioPagoEnum values listed below.
items
array
required
List of line items. Must contain at least one entry.
clienteId
Long
Optional ID of the customer. Required for WEB sales when linking to a customer account; omit for anonymous POS transactions.

Response 201 Created

Returns a VentaDetalleResponse.
id
Long
Internal sale identifier.
fecha
OffsetDateTime
Timestamp of the transaction in ISO-8601 format with timezone offset (Argentina/Buenos Aires, UTC-3).
subtotal
BigDecimal
Sum of all line item subtotals before discounts.
descuento
BigDecimal
Total discount applied to the sale.
total
BigDecimal
Final amount charged after discounts.
estado
string
Current sale state. One of COMPLETADA, ANULADA, PENDIENTE.
medioPago
string
Payment method used.
nombreCajero
string
Full name of the employee or admin who processed the sale.
origen
string
Sale channel: POS (in-store) or WEB (online Tienda).
comprobanteId
Long
ID of the associated fiscal receipt record. May be null if receipt generation is pending.
items
array
Line items included in the sale.
curl -X POST http://localhost:8081/api/ventas \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "medioPago": "EFECTIVO",
    "items": [
      { "productoId": 12, "cantidad": 2 },
      { "productoId": 47, "cantidad": 1 }
    ]
  }'

GET /api/ventas

Lists all sales within a date range. Defaults to the last 30 days when no parameters are supplied. Dates are interpreted in the America/Argentina/Buenos_Aires timezone. Auth: ADMIN

Query Parameters

desde
date
Start date in ISO-8601 format (YYYY-MM-DD). Inclusive. Defaults to 30 days before today.
hasta
date
End date in ISO-8601 format (YYYY-MM-DD). Inclusive. Defaults to today.

Response 200 OK

Returns an array of VentaResponse.
id
Long
Internal sale identifier.
fecha
OffsetDateTime
Transaction timestamp (ISO-8601 with timezone offset).
total
BigDecimal
Final charged amount.
estado
string
Sale state: COMPLETADA, ANULADA, or PENDIENTE.
medioPago
string
Payment method used.
nombreCajero
string
Name of the employee who processed the sale.
cantidadItems
Integer
Total number of line items in the sale.
origen
string
Sale channel: POS or WEB.
curl 'http://localhost:8081/api/ventas?desde=2025-01-01&hasta=2025-01-31' \
  -H 'Authorization: Bearer <token>'

GET /api/ventas/mis-compras

Returns the authenticated customer’s complete online order history. Only sales with origen = WEB linked to the caller’s user ID are returned. Auth: CLIENTE

Response 200 OK

Returns an array of VentaResponse filtered to the caller’s userId. See GET /api/ventas for field descriptions.

GET /api/ventas/mis-ventas-hoy

Returns all sales processed by the authenticated employee during the current calendar day (Argentina timezone). Auth: EMPLEADO

Response 200 OK

Returns an array of VentaResponse filtered to today’s sales for the calling employee.

GET /api/ventas/{id}

Returns summary information for a single sale. Auth: ADMIN or EMPLEADO

Path Parameters

id
Long
required
Internal sale identifier.

Response 200 OK

Returns a VentaResponse.

GET /api/ventas/{id}/detalle

Returns the full details of a single sale, including the complete line-item list with product names, quantities, and per-unit prices. Auth: ADMIN or EMPLEADO

Path Parameters

id
Long
required
Internal sale identifier.

Response 200 OK

Returns a VentaDetalleResponse. See POST /api/ventas for full field descriptions.

PUT /api/ventas/{id}/anular

Voids a sale by changing its estado to ANULADA. The sale record is retained for audit purposes. Auth: ADMIN

Path Parameters

id
Long
required
Internal sale identifier.

Response 200 OK

Returns the updated VentaResponse with estado: "ANULADA".
Voiding a sale does not automatically reverse the stock change. If stock needs to be restored, perform a manual stock adjustment via POST /api/ajustes-stock after voiding.

Reference: Enumerations

MedioPagoEnum — Payment Methods

ValueDescription
EFECTIVOCash payment
DEBITODebit card
CREDITOCredit card
MERCADOPAGOMercadoPago digital wallet

EstadoVentaEnum — Sale States

ValueDescription
PENDIENTESale created but not yet fully processed (e.g. awaiting payment confirmation)
COMPLETADASale successfully finalised and stock decremented
ANULADASale voided by an admin; stock is not automatically restored

OrigenVentaEnum — Sale Channel

ValueDescription
POSIn-store sale processed by an ADMIN or EMPLEADO
WEBOnline order placed by a CLIENTE through the Tienda storefront

Build docs developers (and LLMs) love