This is the primary billing endpoint for dine-in restaurant orders. It accepts a structured POS order payload, validates that the declared invoice totals are arithmetically consistent, maps the incoming DTO to domain entities, logs the attempt to the audit repository, and submits the electronic invoice to the DIAN SOAP service via theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/farojas85/fast-rest-api/llms.txt
Use this file to discover all available pages before exploring further.
IDianSoapPort adapter. On success, the DIAN response is normalised and returned as a PedidoLocalResponse containing the track_id (ZipKey) and optional cufe for downstream traceability.
Endpoint Details
| Property | Value |
|---|---|
| Method | POST |
| Path | /api/v1/pedidos/consumo-local/ |
| Router prefix | /api/v1/pedidos/consumo-local (declared in pedido_local_controller.py) |
| Tags | Facturación Local |
| Success status | 201 Created |
Request Body
The endpoint accepts a JSON body that conforms toPedidoLocalCreateRequest (defined in src/infrastructure/controllers/schemas/pedido_local_schema.py).
Top-level fields
The order identifier assigned by the POS system. Used as the
id_pedido key on the domain entity and as the primary correlation reference in audit logs.Customer identification details. If omitted, the invoice is issued to Consumidor Final using the DIAN-approved anonymous taxpayer values.
Ordered list of products or services included in the invoice. Must contain at least one item (
min_length=1).Sum of all item prices before taxes. Must satisfy
subtotal + impuestos_totales + propina_voluntaria == total_factura.Voluntary tip amount. Reported on the DIAN invoice but excluded from the taxable base — it is not subject to INC or IVA.
Total tax amount across all items. Must equal the sum of every
impuestos[].monto value across all items.Final invoice total. Must exactly equal
subtotal + impuestos_totales + propina_voluntaria. The use case enforces this invariant and raises a ValueError on mismatch.Payment methods used to settle the invoice. Multiple entries are supported (e.g., partial cash + card).
Business Validation
TheFacturarPedidoLocalUseCase.execute() method enforces the following rule before any SOAP call is made:
propina_voluntaria) is forwarded to the DIAN as an informational amount but is never added to the taxable base for INC or IVA purposes.
Response
On201 Created, the endpoint returns a PedidoLocalResponse object.
DIAN’s
ZipKey identifier returned by SendTestSetAsync. Use this value to query DIAN’s status portal for the submitted document. Defaults to "UNKNOWN" if the SOAP response does not include a ZipKey.Código Único de Factura Electrónica — the unique fingerprint of the issued invoice. Optional; populated only when the DIAN response includes it. In the current habilitación mock it returns
"VALID_CUFE_MOCK".Processing status string from the DIAN response (e.g.,
"Procesado Correctamente", "SUCCESS").Human-readable confirmation message (e.g.,
"Factura enviada correctamente a la DIAN").Example Request
The following example is derived from the canonical test fixture intests/application/use_cases/test_facturar_pedido_local.py:
20000.00 (subtotal) + 1600.00 (INC) + 3000.00 (tip) = 24600.00 ✓
Example Response (201 Created)
Error Responses
| HTTP Status | Cause | Body |
|---|---|---|
422 Unprocessable Entity | Pydantic validation failed — missing required field, wrong type, or cantidad ≤ 0 | Standard FastAPI validation error body |
500 Internal Server Error | DIAN submission failed — SOAP timeout, WSDL error, or authentication failure | {"message": "Error enviando a la DIAN", "details": {...}} |
500 body:
Tax Notes
INC vs. IVA in Colombian restaurant invoicing:
- INC (Impuesto Nacional al Consumo) — typically 8 % for food and beverages served and consumed on the restaurant premises. This is the most common tax type for dine-in orders.
- IVA (Impuesto al Valor Agregado) — typically 19 % for non-food items, alcohol in certain categories, or ancillary services. Some establishments apply a combination of both taxes depending on their tax registration.
- Voluntary tip (
propina_voluntaria) — appears as a distinct line on the DIAN invoice but is not subject to INC or IVA. It is reported for transparency but does not increase the taxable base.
ImpuestoRequest.nombre field on each item controls which tax type is applied per line, giving the POS full flexibility to mix INC and IVA items within the same invoice.