Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/MultiSas/llms.txt

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

A charge closes the billing loop for a restaurant order (pedido). When a charge is created, the API looks up the referenced company, product, and pedido, snapshots the product data, records the payment method and paid status, and automatically derives price_charge from the product’s current price. Two endpoints are available: create a charge and list all charges for a company with pagination.
All charge endpoints require two authentication middlewares. TokenAny validates the bearer token and attaches the user to the request. TokenAuthorize('Admin', 'Super Admin') restricts access to users whose role is either Admin or Super Admin. Include the token in every request as token-access: Bearer $TOKEN.

Create a Charge


POST /api/charge/:company_id/:product_id/:pedido_id Creates a new charge record that links a company, a product, and an existing order. The price_charge is automatically set to the product’s price_product at the time of the request.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the owning company.
product_id
string
required
The MongoDB ObjectId of the product being charged.
pedido_id
string
required
The MongoDB ObjectId of the order (pedido) this charge is associated with.

Body Parameters

payment_method
string
required
Payment method for this charge. Must be one of: "Efectivo", "Transferencia", "Tarjeta", or "".
paid
boolean
required
true if the charge has been paid, false if it is still pending.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success, false on failure.
save_charge
object
The newly created charge document.

Example

curl -X POST https://api.example.com/api/charge/64a1f2c3e4b0a1b2c3d4e5f6/64c3f4e5a6b7c8d9e0f1a2b3/64e5f6a7b8c9d0e1f2a3b4c5 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN" \
  -d '{
    "payment_method": "Efectivo",
    "paid": true
  }'
{
  "msj": "Cobro realizado correctamente",
  "status": true,
  "save_charge": {
    "_id": "64g7h8i9j0k1l2m3n4o5p6q7",
    "price_charge": "28000",
    "payment_method": "Efectivo",
    "paid": true,
    "product": {
      "_id": "64c3f4e5a6b7c8d9e0f1a2b3",
      "name_product": "Bandeja Paisa",
      "description_product": "Plato típico colombiano",
      "price_product": "28000",
      "extras": [
        { "_id": "64c3f4e5a6b7c8d9e0f1a2b4", "name_extra": "Aguacate", "price_extra": "2000" }
      ]
    },
    "company": {
      "_id": "64a1f2c3e4b0a1b2c3d4e5f6",
      "name_company": "Restaurante El Sabor",
      "name_founder": "Juan Pérez",
      "nit_company": "900123456-7"
    },
    "createdAt": "2024-01-15T19:00:00.000Z",
    "updatedAt": "2024-01-15T19:00:00.000Z"
  }
}

List Charges


GET /api/charge/:company_id Returns a paginated list of all charges for the specified company, sorted by most recently created.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the company whose charges to retrieve.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success.
data
array
Array of charge documents for the company.
pagination
object
Pagination metadata.

Example

curl -X GET https://api.example.com/api/charge/64a1f2c3e4b0a1b2c3d4e5f6 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN"
{
  "msj": "Cargando cobros realizados",
  "status": true,
  "data": [
    {
      "_id": "64g7h8i9j0k1l2m3n4o5p6q7",
      "price_charge": "28000",
      "payment_method": "Efectivo",
      "paid": true,
      "product": {
        "_id": "64c3f4e5a6b7c8d9e0f1a2b3",
        "name_product": "Bandeja Paisa",
        "description_product": "Plato típico colombiano",
        "price_product": "28000",
        "extras": []
      },
      "company": {
        "_id": "64a1f2c3e4b0a1b2c3d4e5f6",
        "name_company": "Restaurante El Sabor",
        "name_founder": "Juan Pérez",
        "nit_company": "900123456-7"
      },
      "createdAt": "2024-01-15T19:00:00.000Z",
      "updatedAt": "2024-01-15T19:00:00.000Z"
    }
  ],
  "pagination": {
    "pag": "1",
    "perpage": 10,
    "pags": 1
  }
}

Build docs developers (and LLMs) love