The Pre-Sale & Mobile Orders Module (/v1/pre-sale) powers the field Sales Force Automation (SFA) ecosystem for mobile representatives, handheld terminals (Flutter goal_me, TVendo, and ruggedized Android devices), and sales supervisors. It features offline-first master data hydration, high-throughput bulk order ingestion, visit execution tracking, and presale order lifecycle management.
Field sales representatives operate in areas with intermittent connectivity. The backend provides high-performance cached payloads for initial daily route loading and batched endpoints for order synchronization:
/v1/pre-sale/v2/master-data/{id}/orders* endpoints for new mobile builds (Goal orders persistence). v1 master-data order routes remain for legacy production mobile./v1/pre-sale
routes/v1/backend/pre-sale/pre-sale.php included in routes/v1/backend/backend.php.App\Http\Controllers\V1\Backend\PreSale\PreSaleControllerApp\Http\Controllers\V1\Backend\PreSale\PreSaleOrderControllerApp\Http\Controllers\V1\Backend\PreSale\Orders\OrdersControllerAuthorization: Bearer <access_token>
x-app-stage: <stage>
x-app-uid: <application_uuid>
Content-Type: application/json
Accept: application/json
app-validator: Enforces mobile device registration, active application status, and client token validity.company-validator: Validates and binds companyId context across all operational tables.ActionResult)All endpoints return JSON responses conforming to App\Values\Core\ActionResult:
{
"success": true,
"message": "Operación exitosa.",
"data": { ... }
}
/v1/pre-sale/master-data)Endpoints under /v1/pre-sale/master-data/{id}/* use the primary route parameter {id}, representing the tenant companyId.
| Method | Endpoint | Description |
|---|---|---|
GET |
/v1/pre-sale/master-data/{id}/customers |
Download customers assigned to the authenticated seller (?sellerId={id}) |
GET |
/v1/pre-sale/master-data/{id}/products |
Download sellable product catalog with price tier options |
GET |
/v1/pre-sale/master-data/{id}/products-with-prices |
Pre-calculated products matrix with active pricing tiers |
GET |
/v1/pre-sale/master-data/{id}/payment-terms |
Payment terms catalog and commercial credit day maturities |
GET |
/v1/pre-sale/master-data/{id}/shipping-options |
Delivery and shipping carrier choices |
GET |
/v1/pre-sale/master-data/{id}/orders |
(Legacy) Retrieve seller's orders — use v2 orders API for new mobile |
GET |
/v1/pre-sale/master-data/{id}/orders/{uid} |
(Legacy) Query single order by client UUID |
GET |
/v1/pre-sale/master-data/{id}/orders/{uid}/cancel-order |
(Legacy) Cancel a mobile order prior to ERP dispatch |
POST |
/v1/pre-sale/master-data/{id}/orders/{uid}/enqueue-order |
(Legacy) Queue a mobile order for automated ERP background sync |
GET |
/v1/pre-sale/master-data/{id}/daily-quota |
Query daily sales target and percentage achievement |
GET |
/v1/pre-sale/master-data/{id}/seller-commission |
Compute current seller commissions and incentives |
POST |
/v1/pre-sale/master-data/{id}/orders-bulk |
(Legacy) Mass upload batch of offline orders — see v2 |
POST |
/v1/pre-sale/master-data/{id}/nosales-bulk |
Mass upload batch of no-sale / non-order visits |
POST |
/v1/pre-sale/master-data/{id}/products/{productId}/barcode |
Register newly scanned barcode for a product SKU |
GET |
/v1/pre-sale/master-data/{id}/nosaved-orders |
(Legacy) Query orders that encountered sync conflicts or validation failures |
GET |
/v1/pre-sale/master-data/{id}/no-orders |
Query recorded no-sale visits for today |
GET |
/v1/pre-sale/master-data/{id}/price-lists |
Authorized sales price lists for the seller |
POST |
/v1/pre-sale/master-data/{id}/price-list-lines |
Query specific price list line prices |
GET |
/v1/pre-sale/master-data/{id}/visit-schedules |
Weekly visit plan (Monday through Saturday routes) |
GET |
/v1/pre-sale/master-data/{id}/sales-zones |
Commercial zones assigned to the seller |
GET |
/v1/pre-sale/master-data/{id}/sales-routes |
Routes associated with the seller's portfolios |
GET |
/v1/pre-sale/master-data/{id}/sales-teams |
Sales teams the seller is attached to |
GET |
/v1/pre-sale/master-data/{id}/customer-channels |
Customer distribution channels (Tradicional, Horeca, etc.) |
GET |
/v1/pre-sale/master-data/{id}/product-clasifications |
Navigation categories and taxonomies for mobile UI |
GET |
/v1/pre-sale/master-data/{id}/tvendo-config |
Configuration flags (taxes, receipt series, print templates) |
GET |
/v1/pre-sale/master-data/{id}/sellers |
List sellers eligible for mobile presale route operations |
GET /v1/pre-sale/master-data/1/customers?sellerId=42
200 OK{
"success": true,
"message": "Operación exitosa.",
"data": [
{
"id": 1045,
"card_code": "C20485918231",
"card_name": "DISTRIBUIDORA SAN JUAN S.A.C.",
"tax_id": "20485918231",
"address": "Av. Las Palmeras 1245",
"ubigeo": "150132",
"latitude": -12.0854,
"longitude": -77.0345,
"payment_term_id": 2,
"price_list_id": 1,
"sales_team_id": 3,
"territory_id": 14,
"credit_limit": 50000.00,
"credit_balance": 14200.50
}
]
}
/orders-bulk)Accepts a batch of orders recorded while the mobile device was offline.
Each order object must include client-generated uid (UUID v4). That value is stored as the CouchDB document _id in mobile-orders (and echoed in bulk row responses). Rows without a valid uid return per-item 422 — the server does not mint a replacement id.
POST /v1/pre-sale/master-data/1/orders-bulk
Content-Type: application/json
[
{
"uid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"customer_id": 1045,
"customer_code": "C20485918231",
"seller_id": 42,
"sales_team_id": 3,
"warehouse_code": "01",
"payment_term_id": 2,
"order_date": "2026-10-13",
"delivery_date": "2026-10-14",
"notes": "Entrega por la mañana",
"latitude": -12.0854,
"longitude": -77.0345,
"lines": [
{
"product_id": 1050,
"product_code": "CERV-CRIS-330",
"quantity": 10,
"unit_price": 48.50,
"discount_percent": 0.00,
"tax_code": "IGV"
}
]
}
]
200 OK{
"success": true,
"message": "Órdenes sincronizadas correctamente.",
"data": {
"total_received": 1,
"processed_count": 1,
"failed_count": 0,
"synced_uids": [
"9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"
]
}
}
/nosales-bulk)Records physical client visits where no order was transacted (e.g., store closed, owner absent, surplus stock).
POST /v1/pre-sale/master-data/1/nosales-bulk
Content-Type: application/json
[
{
"uid": "4a7b9c1d-1122-3344-5566-778899aabbcc",
"customer_id": 1045,
"seller_id": 42,
"visit_date": "2026-10-13 10:45:00",
"reason_code": "CLOSED_STORE",
"reason_description": "Local cerrado por remodelación",
"latitude": -12.08541,
"longitude": -77.03452,
"photo_url": null
}
]
200 OK{
"success": true,
"message": "No-ventas registradas con éxito.",
"data": {
"imported_count": 1
}
}
/v1/pre-sale/orders)Provides centralized management for orders collected via field presale routes.
App\Http\Controllers\V1\Backend\PreSale\Orders\OrdersControllerroutes/v1/backend/pre-sale/orders/orders.phpcompany-validator| Method | Endpoint | Description |
|---|---|---|
GET |
/v1/pre-sale/orders |
List orders for a specific operational date (?date=YYYY-MM-DD) |
GET |
/v1/pre-sale/orders/unauthorized |
List pending orders that require commercial or credit authorization |
GET |
/v1/pre-sale/orders/{id} |
Retrieve comprehensive order detail |
GET |
/v1/pre-sale/orders/{id}/promotions |
Retrieve detail of applied promotions, bonifications, and discounts |
GET |
/v1/pre-sale/orders/{id}/enqueue |
Manually push presale order into asynchronous ERP synchronization queue |
POST |
/v1/pre-sale/orders/{id}/customer-instructions |
Update special delivery instructions or delivery gate observations |
GET /v1/pre-sale/orders?companyId=1&date=2026-10-13
200 OK{
"success": true,
"message": "Operación exitosa.",
"data": [
{
"id": 84920,
"company_id": 1,
"order_number": "PRE-2026-084920",
"customer_code": "C20485918231",
"customer_name": "DISTRIBUIDORA SAN JUAN S.A.C.",
"seller_name": "CARLOS MENDOZA",
"date": "2026-10-13",
"delivery_date": "2026-10-14",
"total_amount": 1455.00,
"status": "PENDING_AUTHORIZATION",
"requires_auth": true,
"auth_reasons": ["OVERDUE_DEBT", "DISCOUNT_THRESHOLD"]
}
]
}
POST /v1/pre-sale/orders/{id}/customer-instructions
{
"company_id": 1,
"instructions": "Dejar pedido en almacén posterior. Llamar a Don Jorge al celular 998877665 15 minutos antes de llegar."
}
200 OK{
"success": true,
"message": "Instrucciones actualizadas correctamente."
}