Parallel REST surface for TVendo mobile order sync and bulk upload. Production mobile builds on v1 continue to use /v1/pre-sale/master-data/{companyId}/orders* (legacy TVendo adapter + Couch staging). New mobile builds use this v2 prefix with Goal orders / order_lines on goal-data-db.
Identity: Mobile must send a stable uid (UUID v4) per order header. v2 writes PostgreSQL first (orders.uid), then projects Couch goal-mobile-orders (_id = uid, GoalMobileOrdersRepository) for automations — CQRS, not Couch-first staging. Legacy v1 uses database mobile-orders only.
CQRS: See goal-backend/docs/presale/MOBILE_ORDERS_CQRS.md. Bulk handler: BulkSaveMobileOrdersAction.
/v1/pre-sale/v2/master-data/{companyId}/...
Parent route file: goal-backend/routes/v1/backend/pre-sale/v2/master-data-orders.php
Controllers:
App\Http\Controllers\V1\Backend\PreSale\V2\MasterDataOrderControllerApp\Http\Controllers\V1\Backend\PreSale\V2\MobileOrderControllerAuthorization: Bearer <passport_token>
x-app-stage: <stage>
x-app-uid: <application_uuid>
Content-Type: application/json
Accept: application/json
| Method | Path | Middleware | Description |
|---|---|---|---|
GET |
/v1/pre-sale/v2/master-data/{id}/orders?sellerId={sellerId} |
app-validator |
Day orders for seller (Goal model JSON) |
GET |
/v1/pre-sale/v2/master-data/{id}/orders/{uid}?sellerId={sellerId} |
app-validator |
Single order by mobile uid |
GET |
/v1/pre-sale/v2/master-data/{id}/orders/{uid}/cancel-order |
app-validator |
Cancel order |
POST |
/v1/pre-sale/v2/master-data/{id}/orders-bulk |
— | Offline bulk upload (PG SaveGoalOrderAction + Couch projection) |
POST |
/v1/pre-sale/v2/master-data/{id}/orders/{uid}/enqueue-order |
— | Queue order for ERP processing |
GET |
/v1/pre-sale/v2/master-data/{id}/nosaved-orders |
app-validator |
Orders pending backend registration |
Standard ActionResult:
{
"success": true,
"message": "Operación exitosa.",
"data": [],
"stage": "dev"
}
Each order includes canonical fields and legacy mobile aliases (ped_*, cli_codigo) via MobileGoalOrderResource for GoalOrder compatibility in Flutter.
{
"success": true,
"data": [
{
"id": 12045,
"ped_pk": 12045,
"uid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"company_id": 1,
"seller_id": 42,
"customer_code": "C20485918231",
"cli_codigo": "C20485918231",
"order_status": "registered",
"lines": []
}
]
}
Same contract as v1:
{
"modelList": [ { "uid": "...", "type": "PV", "sellerId": 42, "lines": [] } ],
"installationId": "...",
"deviceToken": "...",
"fullVersion": "1.0.2+22",
"deviceName": "...",
"companyId": 1,
"session_uuid": "..."
}
v2 persists registrable sale orders through SaveGoalOrderAction (PostgreSQL) including ApplyPromotionBudgetToOrderAction when promotionBudgetApplications is present.
| Topic | v1 | v2 |
|---|---|---|
| URL prefix | /v1/pre-sale/master-data/... |
/v1/pre-sale/v2/master-data/... |
| Load orders | TVendo adapter | LoadOrderV2Action → Goal Order model |
| Save sale order | SaveOrderAction (legacy) |
SaveGoalOrderAction |
| GET JSON | Adapter/Couch shape | MobileGoalOrderResource |
| Deprecation header | Deprecation: true on v1 order routes |
None |
v1 mobile order routes return:
Deprecation: true
Link: </api/pre-sale-v2-orders>; rel="successor-version"
Remove v1 routes after mobile adoption completes (see mobile release notes).