{
  "info": {
    "name": "NyakisiiCabs API",
    "_postman_id": "b6f3c0d2-5a1e-4c9b-9a57-5aba0a7c0001",
    "description": "NyakisiiCabs 7-seater booking API (Nairobi CBD ⇄ Kisii Town), base path `/api/v1`.\n\n**Run it:** start the API (`npm run dev` in `backend/`), import this collection and `sabaa-local.postman_environment.json`, select **NyakisiiCabs local**, then run the collection in order (Collection Runner) or click through. Each request saves what the next ones need.\n\n**Demo accounts** (OTP comes back as `devCode`): admin 0700 000 001 · dispatcher 0700 000 003 · finance 0700 000 004 · support 0700 000 005 · drivers 0700 000 002 and 0700 000 201–213. Any other 07xx/01xx number is a passenger.\n\n**Good to know**\n- Access tokens last 15 min; OTP requests are limited to 3 per phone / 20 per IP per 10 min (restart the API to reset).\n- Sensitive staff actions need a `reason` (5+ characters); it goes into the audit log with who, when, before and after.\n- Folders 08–10 change data (depart/arrive the booked trip, cancel and delay departures, refund). `npm run db:setup` resets everything.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "01 Auth",
      "description": "OTP sign-in. Run first: fills `passengerToken`, `adminToken`, `dispatcherToken` and `financeToken`. (The driver signs in later, in folder 08, as whichever driver the planner put on the booked trip.)\n\nAccess tokens last 15 minutes. On `401 Session expired`, run that role's Request + Verify OTP again.",
      "auth": {
        "type": "noauth"
      },
      "item": [
        {
          "name": "Request OTP – invalid email → 400",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/otp/request",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "otp",
                "request"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"not-an-email\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('400 Bad Request', () => pm.response.to.have.status(400));"
                ]
              }
            }
          ]
        },
        {
          "name": "Request OTP (passenger)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/otp/request",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "otp",
                "request"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{passengerEmail}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Sends a 6-digit code. With OTP_DEV_ECHO=true the code comes back as `devCode` and is saved to `passengerOtp`.\n\nRate limit: 3 per phone and 20 per IP every 10 minutes (resets when the API restarts)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('devCode returned (OTP_DEV_ECHO=true)', () => pm.expect(j.devCode).to.match(/^\\d{6}$/));",
                  "pm.collectionVariables.set('passengerOtp', j.devCode);"
                ]
              }
            }
          ]
        },
        {
          "name": "Verify OTP – wrong code → 401",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/otp/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "otp",
                "verify"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{passengerEmail}}\",\n  \"code\": \"000000\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Each wrong code counts against the OTP (5 attempts max)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('401 Unauthorized', () => pm.response.to.have.status(401));"
                ]
              }
            }
          ]
        },
        {
          "name": "Verify OTP (passenger)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/otp/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "otp",
                "verify"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{passengerEmail}}\",\n  \"code\": \"{{passengerOtp}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Exchanges the code for a 15-minute access token and a 30-day refresh token, saved to `passengerToken` / `passengerRefreshToken`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('role is PASSENGER', () => pm.expect(j.user.role).to.eql('PASSENGER'));",
                  "pm.collectionVariables.set('passengerToken', j.accessToken);",
                  "pm.collectionVariables.set('passengerRefreshToken', j.refreshToken);"
                ]
              }
            }
          ]
        },
        {
          "name": "Get my profile",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/me",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "me"
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{passengerToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('signed in by email', () => pm.expect(pm.response.json().email).to.eql(pm.collectionVariables.get('passengerEmail')));"
                ]
              }
            }
          ]
        },
        {
          "name": "Update my profile",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/me",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "me"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"fullName\": \"Jane Moraa\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{passengerToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('name saved', () => pm.expect(pm.response.json().fullName).to.eql('Jane Moraa'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Refresh token",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/refresh",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "refresh"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"refreshToken\": \"{{passengerRefreshToken}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Rotating refresh: the old refresh token is revoked and a new pair is returned (saved automatically)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.collectionVariables.set('passengerToken', j.accessToken);",
                  "pm.collectionVariables.set('passengerRefreshToken', j.refreshToken);"
                ]
              }
            }
          ]
        },
        {
          "name": "Request OTP (admin)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/otp/request",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "otp",
                "request"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{adminEmail}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Sends a 6-digit code. With OTP_DEV_ECHO=true the code comes back as `devCode` and is saved to `adminOtp`.\n\nRate limit: 3 per phone and 20 per IP every 10 minutes (resets when the API restarts)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('devCode returned (OTP_DEV_ECHO=true)', () => pm.expect(j.devCode).to.match(/^\\d{6}$/));",
                  "pm.collectionVariables.set('adminOtp', j.devCode);"
                ]
              }
            }
          ]
        },
        {
          "name": "Verify OTP (admin)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/otp/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "otp",
                "verify"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{adminEmail}}\",\n  \"code\": \"{{adminOtp}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Exchanges the code for a 15-minute access token and a 30-day refresh token, saved to `adminToken` / `adminRefreshToken`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('role is ADMIN', () => pm.expect(j.user.role).to.eql('ADMIN'));",
                  "pm.collectionVariables.set('adminToken', j.accessToken);",
                  "pm.collectionVariables.set('adminRefreshToken', j.refreshToken);"
                ]
              }
            }
          ]
        },
        {
          "name": "Request OTP (dispatcher)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/otp/request",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "otp",
                "request"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{dispatcherEmail}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Sends a 6-digit code. With OTP_DEV_ECHO=true the code comes back as `devCode` and is saved to `dispatcherOtp`.\n\nRate limit: 3 per phone and 20 per IP every 10 minutes (resets when the API restarts)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('devCode returned (OTP_DEV_ECHO=true)', () => pm.expect(j.devCode).to.match(/^\\d{6}$/));",
                  "pm.collectionVariables.set('dispatcherOtp', j.devCode);"
                ]
              }
            }
          ]
        },
        {
          "name": "Verify OTP (dispatcher)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/otp/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "otp",
                "verify"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{dispatcherEmail}}\",\n  \"code\": \"{{dispatcherOtp}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Exchanges the code for a 15-minute access token and a 30-day refresh token, saved to `dispatcherToken` / `dispatcherRefreshToken`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('role is DISPATCHER', () => pm.expect(j.user.role).to.eql('DISPATCHER'));",
                  "pm.collectionVariables.set('dispatcherToken', j.accessToken);",
                  "pm.collectionVariables.set('dispatcherRefreshToken', j.refreshToken);"
                ]
              }
            }
          ]
        },
        {
          "name": "Request OTP (finance)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/otp/request",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "otp",
                "request"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{financeEmail}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Sends a 6-digit code. With OTP_DEV_ECHO=true the code comes back as `devCode` and is saved to `financeOtp`.\n\nRate limit: 3 per phone and 20 per IP every 10 minutes (resets when the API restarts)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('devCode returned (OTP_DEV_ECHO=true)', () => pm.expect(j.devCode).to.match(/^\\d{6}$/));",
                  "pm.collectionVariables.set('financeOtp', j.devCode);"
                ]
              }
            }
          ]
        },
        {
          "name": "Verify OTP (finance)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/otp/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "otp",
                "verify"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{financeEmail}}\",\n  \"code\": \"{{financeOtp}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Exchanges the code for a 15-minute access token and a 30-day refresh token, saved to `financeToken` / `financeRefreshToken`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('role is FINANCE', () => pm.expect(j.user.role).to.eql('FINANCE'));",
                  "pm.collectionVariables.set('financeToken', j.accessToken);",
                  "pm.collectionVariables.set('financeRefreshToken', j.refreshToken);"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "02 Public (no auth)",
      "description": "Trip search and seat map. **Search trips** picks the departures used later; **Seat map** picks free seats.\n\nThe car plate is hidden from passengers until 2 hours before departure.",
      "auth": {
        "type": "noauth"
      },
      "item": [
        {
          "name": "Health check",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/health",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "health"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('ok', () => pm.expect(pm.response.json().ok).to.be.true);"
                ]
              }
            }
          ]
        },
        {
          "name": "List stages",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/stages",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "stages"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('NBO and KSI exist', () => pm.expect(pm.response.json().map(s => s.code)).to.include.members(['NBO', 'KSI']));"
                ]
              }
            }
          ]
        },
        {
          "name": "Search trips",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/trips?from={{from}}&to={{to}}&date={{searchDate}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "trips"
              ],
              "query": [
                {
                  "key": "from",
                  "value": "{{from}}"
                },
                {
                  "key": "to",
                  "value": "{{to}}"
                },
                {
                  "key": "date",
                  "value": "{{searchDate}}"
                }
              ]
            },
            "description": "`date` is `YYYY-MM-DD` (EAT). Set `travelDate` to choose a date; blank = today, or tomorrow after 18:30 EAT.\n\nSaves the first two departures with sales open and 4+ free seats as `tripId` and `tripId2`."
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const fixed = pm.variables.get('travelDate');",
                  "let date = fixed;",
                  "if (!date) {",
                  "  const eat = new Date(Date.now() + 3 * 3600e3);",
                  "  if (eat.getUTCHours() * 60 + eat.getUTCMinutes() > 18 * 60 + 30) eat.setUTCDate(eat.getUTCDate() + 1);",
                  "  date = eat.toISOString().slice(0, 10);",
                  "}",
                  "pm.collectionVariables.set('searchDate', date);"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const { date, trips } = pm.response.json();",
                  "const open = trips.filter(t => t.salesOpen && t.seatsLeft >= 4);",
                  "pm.test('two bookable departures with 4+ free seats', () =>",
                  "  pm.expect(open.length, 'Not enough bookable trips on ' + date + ' - set the travelDate variable').to.be.at.least(2));",
                  "pm.test('plate only shown within ~2 h of departure (after the lock)', () => pm.expect(trips.filter(t => t.vehiclePlate).every(t => new Date(t.departureAt) - Date.now() <= 2.5 * 3600e3)).to.be.true);",
                  "if (open[0]) pm.collectionVariables.set('tripId', open[0].id);",
                  "if (open[1]) pm.collectionVariables.set('tripId2', open[1].id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Trip details",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/trips/{{tripId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "trips",
                "{{tripId}}"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('same trip', () => pm.expect(pm.response.json().id).to.eql(Number(pm.collectionVariables.get('tripId'))));"
                ]
              }
            }
          ]
        },
        {
          "name": "Seat map",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/trips/{{tripId}}/seats",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "trips",
                "{{tripId}}",
                "seats"
              ]
            },
            "description": "Seat statuses: AVAILABLE, HELD, BOOKED (blocked seats show as BOOKED). Saves four free seats as `seatA`–`seatD`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const free = pm.response.json().seats.filter(s => s.status === 'AVAILABLE').map(s => s.seatNo);",
                  "pm.test('4+ free seats', () => pm.expect(free.length).to.be.at.least(4));",
                  "['seatA', 'seatB', 'seatC', 'seatD'].forEach((k, i) => pm.collectionVariables.set(k, free[i]));"
                ]
              }
            }
          ]
        },
        {
          "name": "Trip not found → 404",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/trips/99999999",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "trips",
                "99999999"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('404 Not Found', () => pm.response.to.have.status(404));"
                ]
              }
            }
          ]
        },
        {
          "name": "Search without from/to → 400",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/trips",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "trips"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('400 Bad Request', () => pm.response.to.have.status(400));",
                  "pm.test('ValidationError', () => pm.expect(pm.response.json().title).to.eql('ValidationError'));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "03 Passenger – bookings & M-Pesa",
      "description": "Hold seats → passenger details → pay (mock M-Pesa) → tickets. Uses `passengerToken`.\n\nMock M-Pesa: payment succeeds ~6s after **Pay**; a pay phone ending in **000** simulates \"cancelled by user\" (1032). Max 2 unpaid holds per user; a hold lasts 5 minutes.",
      "auth": {
        "type": "bearer",
        "bearer": [
          {
            "key": "token",
            "value": "{{passengerToken}}",
            "type": "string"
          }
        ]
      },
      "item": [
        {
          "name": "Create booking (hold seats)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{idemKey}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"tripId\": {{tripId}},\n  \"seats\": [{{seatA}}, {{seatB}}],\n  \"passengers\": [\n    { \"seatNo\": {{seatA}}, \"fullName\": \"Jane Moraa\", \"phone\": \"{{passengerPhone}}\" },\n    { \"seatNo\": {{seatB}}, \"fullName\": \"Brian Ongeri\", \"phone\": \"{{secondPassengerPhone}}\" }\n  ],\n  \"email\": \"jane.moraa@example.com\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Atomically holds the seats for 5 minutes (PENDING_PAYMENT). `passengers` is optional; without it every seat is in the booker's name. The `Idempotency-Key` header makes retries safe."
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.collectionVariables.set('idemKey', pm.variables.replaceIn('{{$guid}}'));"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created', () => pm.response.to.have.status(201));",
                  "const j = pm.response.json();",
                  "pm.test('PENDING_PAYMENT', () => pm.expect(j.status).to.eql('PENDING_PAYMENT'));",
                  "pm.collectionVariables.set('bookingId', j.id);",
                  "pm.collectionVariables.set('bookingRef', j.reference);",
                  "pm.collectionVariables.set('bookingTotal', j.totalKes);"
                ]
              }
            }
          ]
        },
        {
          "name": "Create booking again – same Idempotency-Key",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{idemKey}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"tripId\": {{tripId}},\n  \"seats\": [{{seatA}}, {{seatB}}]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created', () => pm.response.to.have.status(201));",
                  "pm.test('returns the same booking', () => pm.expect(pm.response.json().id).to.eql(Number(pm.collectionVariables.get('bookingId'))));"
                ]
              }
            }
          ]
        },
        {
          "name": "Get booking",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{bookingId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{bookingId}}"
              ]
            },
            "description": "`trip.vehiclePlate` and `trip.driverPhone` stay null until the car is locked 2 h before departure (`trip.carRevealAt`)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('reference', () => pm.expect(j.reference).to.eql(pm.collectionVariables.get('bookingRef')));",
                  "pm.test('plate hidden until lock', () => pm.expect(j.trip.carRevealAt === null || j.trip.vehiclePlate === null).to.be.true);"
                ]
              }
            }
          ]
        },
        {
          "name": "Update passenger details",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{bookingId}}/passengers",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{bookingId}}",
                "passengers"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"passengers\": [\n    { \"seatNo\": {{seatA}}, \"fullName\": \"Jane K. Moraa\", \"phone\": \"{{passengerPhone}}\" },\n    { \"seatNo\": {{seatB}}, \"fullName\": \"Brian Ongeri\", \"phone\": \"{{secondPassengerPhone}}\" }\n  ],\n  \"email\": \"jane.moraa@example.com\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('name updated', () => pm.expect(pm.response.json().passengers.map(p => p.fullName)).to.include('Jane K. Moraa'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Pay with M-Pesa (STK push)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{bookingId}}/pay",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{bookingId}}",
                "pay"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"phone\": \"{{passengerPhone}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Returns 202; the result arrives via the M-Pesa callback. Poll **Get booking** until PAID."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('202 Accepted', () => pm.response.to.have.status(202));",
                  "pm.collectionVariables.set('checkoutRequestId', pm.response.json().checkoutRequestId);"
                ]
              }
            }
          ]
        },
        {
          "name": "Wait for payment → PAID + tickets",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{bookingId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{bookingId}}"
              ]
            },
            "description": "Waits 7s first (mock M-Pesa ~6s). Saves the tickets."
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Mock M-Pesa answers ~6s after \"Pay\". Give it 7s.",
                  "setTimeout(() => {}, 7000);"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const j = pm.response.json();",
                  "const done = j.status === 'PAID';",
                  "const n = Number(pm.collectionVariables.get('payRetries') || 0);",
                  "if (!done && n < 4) {",
                  "  // Still waiting for M-Pesa: the Collection Runner re-sends this request; when clicking manually, send it again.",
                  "  pm.collectionVariables.set('payRetries', n + 1);",
                  "  pm.test('payment still pending - retrying', () => {});",
                  "  if (pm.execution && pm.execution.setNextRequest) pm.execution.setNextRequest(pm.info.requestName);",
                  "  else postman.setNextRequest(pm.info.requestName);",
                  "} else {",
                  "  pm.collectionVariables.set('payRetries', 0);",
                  "  pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "  pm.test('booking is PAID', () => pm.expect(done, JSON.stringify(j.payment)).to.be.true);",
                  "  pm.test('one ticket per seat', () => pm.expect(j.passengers.every(p => p.ticket && p.ticket.code)).to.be.true);",
                  "  if (j.status === 'PAID') {",
                  "    pm.collectionVariables.set('ticketCode', j.passengers[0].ticket.code);",
                  "    pm.collectionVariables.set('qrPayload', j.passengers[0].ticket.qrPayload);",
                  "    pm.collectionVariables.set('ticketCode2', j.passengers[1].ticket.code);",
                  "  }",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "Book a seat that is already taken → 409",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"tripId\": {{tripId}},\n  \"seats\": [{{seatA}}]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('409 Conflict', () => pm.response.to.have.status(409));",
                  "pm.test('SeatUnavailable', () => pm.expect(pm.response.json().title).to.eql('SeatUnavailable'));"
                ]
              }
            }
          ]
        },
        {
          "name": "My bookings",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/me/bookings",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "me",
                "bookings"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('includes the paid booking', () => pm.expect(pm.response.json().map(b => b.id)).to.include(Number(pm.collectionVariables.get('bookingId'))));"
                ]
              }
            }
          ]
        },
        {
          "name": "Resend ticket SMS",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/tickets/{{ticketCode}}/resend",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "tickets",
                "{{ticketCode}}",
                "resend"
              ]
            },
            "description": "Rate limit: 3 per ticket every 10 minutes."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Web ticket page (HTML)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/t/{{ticketCode}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "t",
                "{{ticketCode}}"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Public page linked from the SMS. Shows the plate only after the 2-hour lock."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('shows the ticket code', () => pm.expect(pm.response.text()).to.include(pm.collectionVariables.get('ticketCode')));"
                ]
              }
            }
          ]
        },
        {
          "name": "Hold a seat (no passenger details)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"tripId\": {{tripId}},\n  \"seats\": [{{seatC}}]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created', () => pm.response.to.have.status(201));",
                  "pm.collectionVariables.set('failBookingId', pm.response.json().id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Pay – user cancels on phone (number ending 000)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{failBookingId}}/pay",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{failBookingId}}",
                "pay"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"phone\": \"{{failPayPhone}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('202 Accepted', () => pm.response.to.have.status(202));"
                ]
              }
            }
          ]
        },
        {
          "name": "Wait for payment → FAILED (1032)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{failBookingId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{failBookingId}}"
              ]
            }
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Mock M-Pesa answers ~6s after \"Pay\". Give it 7s.",
                  "setTimeout(() => {}, 7000);"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const j = pm.response.json();",
                  "const done = !!j.payment && j.payment.status === 'FAILED';",
                  "const n = Number(pm.collectionVariables.get('payRetries') || 0);",
                  "if (!done && n < 4) {",
                  "  // Still waiting for M-Pesa: the Collection Runner re-sends this request; when clicking manually, send it again.",
                  "  pm.collectionVariables.set('payRetries', n + 1);",
                  "  pm.test('payment still pending - retrying', () => {});",
                  "  if (pm.execution && pm.execution.setNextRequest) pm.execution.setNextRequest(pm.info.requestName);",
                  "  else postman.setNextRequest(pm.info.requestName);",
                  "} else {",
                  "  pm.collectionVariables.set('payRetries', 0);",
                  "  pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "  pm.test('payment FAILED', () => pm.expect(done, JSON.stringify(j.payment)).to.be.true);",
                  "  pm.test('result code 1032 (cancelled by user)', () => pm.expect(j.payment && j.payment.resultCode).to.eql(1032));",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "Cancel unpaid booking",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{failBookingId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{failBookingId}}"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('204 No Content', () => pm.response.to.have.status(204));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "04 Admin – staff accounts & roles",
      "description": "ADMIN does everything. Staff roles: DISPATCHER (queue, dispatch, trips, check-in scans), FINANCE (payments, refund approval), SUPPORT (bookings, resend, refund requests). Owners never get accounts.\n\nRoles are re-checked against the database on every request, so a demotion or deactivation applies immediately. Sensitive actions require a `reason`.",
      "auth": {
        "type": "bearer",
        "bearer": [
          {
            "key": "token",
            "value": "{{adminToken}}",
            "type": "string"
          }
        ]
      },
      "item": [
        {
          "name": "Who am I",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/me",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "me"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('ADMIN', () => pm.expect(pm.response.json().role).to.eql('ADMIN'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Passenger calling an admin route → 403",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/queues",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "queues"
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{passengerToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('403 Forbidden', () => pm.response.to.have.status(403));"
                ]
              }
            }
          ]
        },
        {
          "name": "Dispatcher can't manage staff → 403",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/users",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "users"
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{dispatcherToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('403 Forbidden', () => pm.response.to.have.status(403));"
                ]
              }
            }
          ]
        },
        {
          "name": "List staff",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/users",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "users"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const me = pm.response.json().find(u => u.role === 'ADMIN');",
                  "pm.test('admin listed', () => pm.expect(me).to.exist);",
                  "pm.collectionVariables.set('adminUserId', me.id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Create staff account (support)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/users",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "users"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{testStaffEmail}}\",\n  \"phone\": \"{{testStaffPhone}}\",\n  \"fullName\": \"Test Support Agent\",\n  \"role\": \"SUPPORT\",\n  \"reason\": \"New support agent for the weekend shift\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created', () => pm.response.to.have.status(201));",
                  "pm.collectionVariables.set('testStaffId', pm.response.json().id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Change staff role without a reason → 400",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/users/{{testStaffId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "users",
                "{{testStaffId}}"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"role\": \"DISPATCHER\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('400 Bad Request', () => pm.response.to.have.status(400));"
                ]
              }
            }
          ]
        },
        {
          "name": "Deactivate staff account",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/users/{{testStaffId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "users",
                "{{testStaffId}}"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"isActive\": false,\n  \"reason\": \"Test: left the company\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Also signs them out everywhere (refresh tokens revoked)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('inactive', () => pm.expect(pm.response.json().isActive).to.be.false);"
                ]
              }
            }
          ]
        },
        {
          "name": "Admin can't demote themselves → 409",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/users/{{adminUserId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "users",
                "{{adminUserId}}"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"role\": \"SUPPORT\",\n  \"reason\": \"Testing the self-change guard\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('409 Conflict', () => pm.response.to.have.status(409));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "05 Admin – owners, vehicles, drivers, compliance",
      "description": "Registration is ADMIN-only. Cars without valid insurance, inspection and PSV licence (or whose driver's licence/PSV badge lapsed) are skipped automatically in the queue — they keep their place.",
      "auth": {
        "type": "bearer",
        "bearer": [
          {
            "key": "token",
            "value": "{{adminToken}}",
            "type": "string"
          }
        ]
      },
      "item": [
        {
          "name": "List owners",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/owners",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "owners"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Register owner (record only, no login)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/owners",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "owners"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"fullName\": \"Test Owner\",\n  \"phone\": \"0711000399\",\n  \"nationalId\": \"29000001\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created', () => pm.response.to.have.status(201));",
                  "pm.collectionVariables.set('ownerId', pm.response.json().id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Update owner",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/owners/{{ownerId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "owners",
                "{{ownerId}}"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"fullName\": \"Test Owner (Kisii)\",\n  \"reason\": \"Owner asked for their town on the record\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "List vehicles",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/vehicles",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "vehicles"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const vs = pm.response.json();",
                  "const expired = vs.find(v => v.insuranceExpiresOn && v.insuranceExpiresOn < new Date(Date.now() + 3 * 3600e3).toISOString().slice(0, 10));",
                  "pm.test('seeded car with expired insurance exists', () => pm.expect(expired).to.exist);",
                  "if (expired) pm.collectionVariables.set('expiredVehicleId', expired.id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Register driver (with licence + PSV badge)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/drivers",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "drivers"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{testDriverEmail}}\",\n  \"fullName\": \"Test Driver\",\n  \"phone\": \"{{testDriverPhone}}\",\n  \"nationalId\": \"30000001\",\n  \"licenseNo\": \"DL-TEST-01\",\n  \"licenseExpiresOn\": \"2027-12-31\",\n  \"psvBadgeNo\": \"PSV-TEST-01\",\n  \"psvBadgeExpiresOn\": \"2027-12-31\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Upserts by phone and makes that number a DRIVER who can sign in to driver mode."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created', () => pm.response.to.have.status(201));",
                  "pm.collectionVariables.set('testDriverId', pm.response.json().id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Register vehicle (owner, driver, documents)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/vehicles",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "vehicles"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"plateNumber\": \"{{newPlate}}\",\n  \"vehicleTypeId\": 1,\n  \"ownerId\": {{ownerId}},\n  \"insurancePolicyNo\": \"POL-TEST-1\",\n  \"insuranceExpiresOn\": \"2027-06-30\",\n  \"inspectionExpiresOn\": \"2027-06-30\",\n  \"psvLicenceNo\": \"TLB-TEST-1\",\n  \"psvLicenceExpiresOn\": \"2027-06-30\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Dates are `YYYY-MM-DD` and valid through that day. A driver can drive only one car (`driverId` is unique)."
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const L = 'ABCDEFGHJKMNPQRSTUVWXYZ';",
                  "const r = () => L[Math.floor(Math.random() * L.length)];",
                  "pm.collectionVariables.set('newPlate', 'KT' + r() + ' ' + (100 + Math.floor(Math.random() * 900)) + r());"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created', () => pm.response.to.have.status(201));",
                  "pm.collectionVariables.set('newVehicleId', pm.response.json().id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Link the driver to the vehicle",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/vehicles/{{newVehicleId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "vehicles",
                "{{newVehicleId}}"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"driverId\": {{testDriverId}},\n  \"reason\": \"Driver hired for this car\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('linked', () => pm.expect(pm.response.json().driverId).to.eql(Number(pm.collectionVariables.get('testDriverId'))));"
                ]
              }
            }
          ]
        },
        {
          "name": "Owner marks the car off for a day",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/vehicles/{{newVehicleId}}/availability",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "vehicles",
                "{{newVehicleId}}",
                "availability"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"date\": \"{{offDay}}\",\n  \"available\": false,\n  \"reason\": \"Owner called: car in for service\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.collectionVariables.set('offDay', new Date(Date.now() + 3 * 3600e3 + 3 * 86400e3).toISOString().slice(0, 10));"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Vehicle availability history",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/vehicles/{{newVehicleId}}/availability",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "vehicles",
                "{{newVehicleId}}",
                "availability"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('off day recorded', () => pm.expect(pm.response.json()[0].available).to.be.false);"
                ]
              }
            }
          ]
        },
        {
          "name": "Compliance report (expired / expiring in 30 days)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/fleet/compliance?days=30",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "fleet",
                "compliance"
              ],
              "query": [
                {
                  "key": "days",
                  "value": "30"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('the expired insurance is listed', () => pm.expect(pm.response.json().items.some(i => i.status === 'EXPIRED')).to.be.true);"
                ]
              }
            }
          ]
        },
        {
          "name": "List drivers (with strikes in the last 30 days)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/drivers",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "drivers"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Driver strike history",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/drivers/{{testDriverId}}/strikes",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "drivers",
                "{{testDriverId}}",
                "strikes"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "06 Admin – fares, schedules, festive dates, settings",
      "description": "Price setting is ADMIN-only and always needs a reason. Sold and held seats never change price; with `applyToExistingTrips` the open seats of trips on/after `effectiveFrom` are re-priced. Every change is in **Fare history**.",
      "auth": {
        "type": "bearer",
        "bearer": [
          {
            "key": "token",
            "value": "{{adminToken}}",
            "type": "string"
          }
        ]
      },
      "item": [
        {
          "name": "List routes",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/routes",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "routes"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const r = pm.response.json().find(x => x.origin.code === pm.variables.get('from') && x.destination.code === pm.variables.get('to'));",
                  "pm.test('route exists', () => pm.expect(r).to.exist);",
                  "pm.collectionVariables.set('routeId', r.id);",
                  "pm.collectionVariables.set('routeBaseFare', r.baseFareKes);",
                  "pm.collectionVariables.set('routeFrontFare', r.frontSeatFareKes ?? 'null');"
                ]
              }
            }
          ]
        },
        {
          "name": "Change route fares",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/routes/{{routeId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "routes",
                "{{routeId}}"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"baseFareKes\": {{routeBaseFare}},\n  \"frontSeatFareKes\": {{routeFrontFare}},\n  \"applyToExistingTrips\": false,\n  \"reason\": \"Test run: re-confirming current fares\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Sends back the current values so test runs don't change your prices. Change the numbers (and set `applyToExistingTrips: true`, optional `effectiveFrom`) to really re-price."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('seatsRepriced reported', () => pm.expect(pm.response.json().seatsRepriced).to.be.a('number'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Change fares without a reason → 400",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/routes/{{routeId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "routes",
                "{{routeId}}"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"baseFareKes\": 1\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('400 Bad Request', () => pm.response.to.have.status(400));"
                ]
              }
            }
          ]
        },
        {
          "name": "Dispatcher can't change fares → 403",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/routes/{{routeId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "routes",
                "{{routeId}}"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"baseFareKes\": {{routeBaseFare}},\n  \"reason\": \"Trying without permission\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{dispatcherToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('403 Forbidden', () => pm.response.to.have.status(403));"
                ]
              }
            }
          ]
        },
        {
          "name": "Fare history",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/fares/history?routeId={{routeId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "fares",
                "history"
              ],
              "query": [
                {
                  "key": "routeId",
                  "value": "{{routeId}}"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "List schedules",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/schedules",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "schedules"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('12 seeded slots or more', () => pm.expect(pm.response.json().length).to.be.at.least(12));"
                ]
              }
            }
          ]
        },
        {
          "name": "Create schedule (inactive test slot)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/schedules",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "schedules"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"routeId\": {{routeId}},\n  \"departureTimeLocal\": \"{{newScheduleTime}}\",\n  \"daysOfWeek\": \"12345\",\n  \"defaultVehicleTypeId\": 1,\n  \"isActive\": false,\n  \"reason\": \"Test slot (inactive)\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const pad = n => String(n).padStart(2, '0');",
                  "pm.collectionVariables.set('newScheduleTime', pad(Math.floor(Math.random() * 5)) + ':' + pad(Math.floor(Math.random() * 60)));"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created', () => pm.response.to.have.status(201));",
                  "pm.collectionVariables.set('scheduleId', pm.response.json().id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Change a schedule's fare",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/schedules/{{scheduleId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "schedules",
                "{{scheduleId}}"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"fareOverrideKes\": 1500,\n  \"applyToExistingTrips\": false,\n  \"reason\": \"Night-style fare for the test slot\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('fare override saved', () => pm.expect(pm.response.json().schedule.fareOverrideKes).to.eql(1500));"
                ]
              }
            }
          ]
        },
        {
          "name": "Generate trips (next 14 days)",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/schedules/generate",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "schedules",
                "generate"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "List festive dates",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/festive-dates",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "festive-dates"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Add festive date",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/festive-dates",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "festive-dates"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"date\": \"{{festiveDay}}\",\n  \"name\": \"Test holiday\",\n  \"reason\": \"Testing the festive 5-of-7 rule\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Departures in the 2 days before a festive date add an extra car at 5 of 7 sold (instead of 7 of 7)."
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const d = new Date(Date.UTC(2027, 1 + Math.floor(Math.random() * 9), 1 + Math.floor(Math.random() * 27)));",
                  "pm.collectionVariables.set('festiveDay', d.toISOString().slice(0, 10));"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created (or 409 if that random date exists)', () => pm.expect(pm.response.code).to.be.oneOf([201, 409]));"
                ]
              }
            }
          ]
        },
        {
          "name": "Operating rules (settings)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/settings",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "settings"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const s = pm.response.json().find(x => x.key === 'presenceWindowMin');",
                  "pm.collectionVariables.set('presenceWindowMin', s.value);"
                ]
              }
            }
          ]
        },
        {
          "name": "Change a setting",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/settings/presenceWindowMin",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "settings",
                "presenceWindowMin"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"value\": {{presenceWindowMin}},\n  \"reason\": \"Test run: re-confirming the presence window\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Re-saves the current value. Other keys: nightlyPlanAt, confirmRequestMin, lockMin, confirmDeadlineMin, checkInDeadlineMin, swapMin, minRestHours, fillThreshold, festiveFillThreshold, festiveLeadDays, maxCarsPerSlot, delayRefundThresholdMin, geofenceMeters, dispatchAlertPhones."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "07 Admin – queue & dispatch",
      "description": "Each stage has a first-in, first-out queue. Every night at 21:00 the planner assigns a PRIMARY and a STANDBY car to each of tomorrow's departures (and re-plans when things change). Staff can add or remove a car (with a reason) but can never reorder a queue.\n\nUses `dispatcherToken`.",
      "auth": {
        "type": "bearer",
        "bearer": [
          {
            "key": "token",
            "value": "{{dispatcherToken}}",
            "type": "string"
          }
        ]
      },
      "item": [
        {
          "name": "Stage queues",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/queues",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "queues"
              ]
            },
            "description": "Both stages: position, join time, whether the car is eligible right now (and why not), next assignment, and cars on the road with their ETA."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const q = pm.response.json();",
                  "pm.test('two stages', () => pm.expect(q.length).to.eql(2));",
                  "pm.test('positions are 1..n', () => q.forEach(s => s.waiting.forEach((c, i) => pm.expect(c.position).to.eql(i + 1))));"
                ]
              }
            }
          ]
        },
        {
          "name": "Run the planner now",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/dispatch/plan",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "dispatch",
                "plan"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Normally automatic (21:00 nightly, every 10 min, and after any change). Body may include `until` (YYYY-MM-DD)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('summary', () => pm.expect(pm.response.json()).to.have.property('planned'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Dispatch board for the day",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/dispatch?date={{searchDate}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "dispatch"
              ],
              "query": [
                {
                  "key": "date",
                  "value": "{{searchDate}}"
                }
              ]
            },
            "description": "Every departure with its primary and standby, confirmation and check-in times, deadlines (T-3h … T-15), load, and flags (NO_CAR, NO_STANDBY, UNCONFIRMED, NOT_CHECKED_IN). Saves the booked trip's primary driver so folder 08 can sign in as them."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const t = pm.response.json().find(x => x.id === Number(pm.collectionVariables.get('tripId')));",
                  "pm.test('booked trip is on the board', () => pm.expect(t).to.exist);",
                  "pm.test('it has a primary car', () => pm.expect(t.primary, 'planner found no car — check the queues').to.exist);",
                  "if (t && t.primary) {",
                  "  pm.collectionVariables.set('tripDriverPhone', '0' + t.primary.driver.phone.slice(3));",
                  "pm.collectionVariables.set('tripDriverEmail', t.primary.driver.email);",
                  "  pm.collectionVariables.set('tripVehicleId', t.primary.vehicleId);",
                  "}",
                  "pm.collectionVariables.set('tripVersion', t.version);"
                ]
              }
            }
          ]
        },
        {
          "name": "Trip timeline",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/trips/{{tripId}}/timeline",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "trips",
                "{{tripId}}",
                "timeline"
              ]
            },
            "description": "Everything that happened to a departure, oldest first: planning (with the queue snapshot and skip reasons), confirmations, check-ins, swaps, strikes, departure, arrival."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('planning recorded', () => pm.expect(pm.response.json().events.some(e => e.action === 'TripPlanned' || e.action === 'PrimaryFilledFromQueue')).to.be.true);"
                ]
              }
            }
          ]
        },
        {
          "name": "Block a seat",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/trips/{{tripId}}/seats/{{seatD}}/block",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "trips",
                "{{tripId}}",
                "seats",
                "{{seatD}}",
                "block"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"blocked\": true,\n  \"reason\": \"Parcel for Kisii branch\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Unblock the seat",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/trips/{{tripId}}/seats/{{seatD}}/block",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "trips",
                "{{tripId}}",
                "seats",
                "{{seatD}}",
                "block"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"blocked\": false,\n  \"reason\": \"Parcel sent on another car\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Add an extra car to the departure",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/trips/{{tripId}}/extra",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "trips",
                "{{tripId}}",
                "extra"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"vehicleTypeId\": 2,\n  \"reason\": \"Long queue of walk-ins at the stage\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Normally automatic when every car on the departure is full (7/7, or 5/7 just before a festive date)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created', () => pm.response.to.have.status(201));",
                  "pm.collectionVariables.set('extraTripId', pm.response.json().id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Assign an ineligible car → 409 (needs override)",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/trips/{{extraTripId}}/assignment",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "trips",
                "{{extraTripId}}",
                "assignment"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"role\": \"STANDBY\",\n  \"vehicleId\": {{expiredVehicleId}},\n  \"reason\": \"Trying the expired-insurance car\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('409 Conflict', () => pm.response.to.have.status(409));",
                  "pm.test('Ineligible', () => pm.expect(pm.response.json().title).to.eql('Ineligible'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Manually assign a car (audited)",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/trips/{{extraTripId}}/assignment",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "trips",
                "{{extraTripId}}",
                "assignment"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"role\": \"PRIMARY\",\n  \"vehicleId\": {{newVehicleId}},\n  \"reason\": \"Owner's new car on standby at the stage\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Shows up as MANUAL in the fairness and staff-actions reports. `override: true` (with a reason) allows an ineligible car."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Cancel the extra car's trip",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/trips/{{extraTripId}}/cancel",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "trips",
                "{{extraTripId}}",
                "cancel"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"reason\": \"Walk-ins took the 2nd car on the next departure\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Same passenger flow as \"no car\": each paid booking is offered a move or a full refund."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('nobody to notify', () => pm.expect(pm.response.json().offers).to.eql(0));"
                ]
              }
            }
          ]
        },
        {
          "name": "Queue history for the test car",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/queues/history?vehicleId={{newVehicleId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "queues",
                "history"
              ],
              "query": [
                {
                  "key": "vehicleId",
                  "value": "{{newVehicleId}}"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Add a car to the Nairobi queue (bottom)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/queues/1/entries",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "queues",
                "1",
                "entries"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"vehicleId\": {{newVehicleId}},\n  \"source\": \"OWNER_AVAILABLE\",\n  \"reason\": \"Owner says the car is ready at Accra Rd\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created', () => pm.response.to.have.status(201));",
                  "pm.collectionVariables.set('queueEntryId', pm.response.json().id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Remove it from the queue",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/queues/entries/{{queueEntryId}}/remove",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "queues",
                "entries",
                "{{queueEntryId}}",
                "remove"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"reason\": \"Test car, not really at the stage\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "08 Driver – assignments, check-in, boarding, arrival",
      "description": "Signs in as the driver the planner put on the booked trip (`tripDriverPhone`). Confirm → check in at the stage (GPS inside the geofence; Nairobi has a stage agent, so the agent scans the driver's QR) → scan tickets → depart → **Arrived** puts the car at the back of the destination queue.\n\nCheck-in opens 3 h before departure; earlier it returns 409 TooEarly (the agent-scan request is then skipped by its test).",
      "auth": {
        "type": "bearer",
        "bearer": [
          {
            "key": "token",
            "value": "{{driverToken}}",
            "type": "string"
          }
        ]
      },
      "item": [
        {
          "name": "Request OTP (trip driver)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/otp/request",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "otp",
                "request"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{tripDriverEmail}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Sends a 6-digit code. With OTP_DEV_ECHO=true the code comes back as `devCode` and is saved to `driverOtp`.\n\nRate limit: 3 per phone and 20 per IP every 10 minutes (resets when the API restarts)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('devCode returned (OTP_DEV_ECHO=true)', () => pm.expect(j.devCode).to.match(/^\\d{6}$/));",
                  "pm.collectionVariables.set('driverOtp', j.devCode);"
                ]
              }
            }
          ]
        },
        {
          "name": "Verify OTP (trip driver)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/otp/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "otp",
                "verify"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{tripDriverEmail}}\",\n  \"code\": \"{{driverOtp}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Exchanges the code for a 15-minute access token and a 30-day refresh token, saved to `driverToken` / `driverRefreshToken`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('role is DRIVER', () => pm.expect(j.user.role).to.eql('DRIVER'));",
                  "pm.collectionVariables.set('driverToken', j.accessToken);",
                  "pm.collectionVariables.set('driverRefreshToken', j.refreshToken);"
                ]
              }
            }
          ]
        },
        {
          "name": "Passenger calling a driver route → 403",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/assignments",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "assignments"
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{passengerToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('403 Forbidden', () => pm.response.to.have.status(403));"
                ]
              }
            }
          ]
        },
        {
          "name": "My assignments (primary / standby)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/assignments",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "assignments"
              ]
            },
            "description": "Upcoming assignments with phase (PLANNED, CONFIRM_REQUESTED, CONFIRMED, AWAITING_AGENT, CHECKED_IN), deadlines and which buttons apply."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const a = pm.response.json().find(x => x.trip.id === Number(pm.collectionVariables.get('tripId')) && x.role === 'PRIMARY');",
                  "pm.test('primary on the booked trip', () => pm.expect(a).to.exist);",
                  "pm.collectionVariables.set('assignmentId', a.id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Confirm the trip",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/assignments/{{assignmentId}}/confirm",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "assignments",
                "{{assignmentId}}",
                "confirm"
              ]
            },
            "description": "Must happen before T-90; otherwise the standby is promoted and this car goes to the bottom of the queue with a strike."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK (or 409 if past the deadline)', () => pm.expect(pm.response.code).to.be.oneOf([200, 409]));"
                ]
              }
            }
          ]
        },
        {
          "name": "My place in the queue",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/queue",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "queue"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('vehicle linked', () => pm.expect(pm.response.json().vehicle).to.exist);"
                ]
              }
            }
          ]
        },
        {
          "name": "My strikes",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/strikes",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "strikes"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Check in – away from the stage → 409",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/trips/{{tripId}}/check-in",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "trips",
                "{{tripId}}",
                "check-in"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"lat\": {{ksiLat}},\n  \"lng\": {{ksiLng}}\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('409 (OutsideStage, or TooEarly more than 3 h out)', () => pm.expect(pm.response.code).to.eql(409));"
                ]
              }
            }
          ]
        },
        {
          "name": "Check in at the stage",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/trips/{{tripId}}/check-in",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "trips",
                "{{tripId}}",
                "check-in"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"lat\": {{nboLat}},\n  \"lng\": {{nboLng}}\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Inside the geofence. Stage with an agent → returns a 5-minute QR to show the agent (AWAITING_AGENT); otherwise CHECKED_IN."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const j = pm.response.json();",
                  "pm.test('200 (or 409 TooEarly)', () => pm.expect(pm.response.code).to.be.oneOf([200, 409]));",
                  "pm.collectionVariables.set('checkInQr', j.qrPayload || '');"
                ]
              }
            }
          ]
        },
        {
          "name": "Stage agent scans the driver's QR",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/stage/check-in",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "stage",
                "check-in"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"qrPayload\": \"{{checkInQr}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{dispatcherToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if (pm.collectionVariables.get('checkInQr')) { pm.test('200 OK', () => pm.response.to.have.status(200)); } else { pm.test('skipped: check-in not open yet (TooEarly)', () => {}); }"
                ]
              }
            }
          ]
        },
        {
          "name": "Today's trips",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/trips/today",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "trips",
                "today"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Trip manifest",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/trips/{{tripId}}/manifest",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "trips",
                "{{tripId}}",
                "manifest"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('2+ passengers sold', () => pm.expect(pm.response.json().sold).to.be.at.least(2));"
                ]
              }
            }
          ]
        },
        {
          "name": "Check ticket by code (no boarding)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/tickets/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "tickets",
                "verify"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"tripId\": {{tripId}},\n  \"code\": \"{{ticketCode2}}\",\n  \"board\": false\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('valid, not boarded', () => { const j = pm.response.json(); pm.expect(j.valid).to.be.true; pm.expect(j.boarded).to.be.false; });"
                ]
              }
            }
          ]
        },
        {
          "name": "Scan QR and board",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/tickets/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "tickets",
                "verify"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"tripId\": {{tripId}},\n  \"qrPayload\": \"{{qrPayload}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('valid and boarded', () => { const j = pm.response.json(); pm.expect(j.valid).to.be.true; pm.expect(j.boarded).to.be.true; });"
                ]
              }
            }
          ]
        },
        {
          "name": "Scan the same QR again → already boarded",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/tickets/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "tickets",
                "verify"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"tripId\": {{tripId}},\n  \"qrPayload\": \"{{qrPayload}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('already boarded', () => pm.expect(pm.response.json().reason).to.match(/Already boarded/));"
                ]
              }
            }
          ]
        },
        {
          "name": "Scan a forged QR → rejected",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/tickets/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "tickets",
                "verify"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"tripId\": {{tripId}},\n  \"qrPayload\": \"1.{{tripId}}.forgedsignature1234567\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('forged', () => pm.expect(pm.response.json().reason).to.match(/Forged/));"
                ]
              }
            }
          ]
        },
        {
          "name": "Depart",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/trips/{{tripId}}/depart",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "trips",
                "{{tripId}}",
                "depart"
              ]
            },
            "description": "Closes the car's queue spot (DISPATCHED) and stands the standby down."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Arrived – away from the destination → 409",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/trips/{{tripId}}/arrived",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "trips",
                "{{tripId}}",
                "arrived"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"lat\": {{nboLat}},\n  \"lng\": {{nboLng}}\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('409 Conflict', () => pm.response.to.have.status(409));"
                ]
              }
            }
          ]
        },
        {
          "name": "Arrived at the destination stage",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/trips/{{tripId}}/arrived",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "trips",
                "{{tripId}}",
                "arrived"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"lat\": {{ksiLat}},\n  \"lng\": {{ksiLng}}\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Inside the destination geofence: trip completed, car joins the back of that stage's queue."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('joined the queue', () => pm.expect(pm.response.json().queue).to.exist);"
                ]
              }
            }
          ]
        },
        {
          "name": "Location ping (presence at the stage)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/driver/location",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "driver",
                "location"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"lat\": {{ksiLat}},\n  \"lng\": {{ksiLng}}\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "The app sends this every ~2 minutes while open. Inside the queue stage's geofence it marks the car as physically present (used when picking a replacement car at T-15)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('at the stage', () => pm.expect(pm.response.json().atStage).to.be.true);"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "09 No car / delay → passenger choices",
      "description": "Changes data: **cancels the second departure** (`tripId2`) and delays another.\n\nNo car → each paid booking is offered MOVE (next departure, same seat if free, else closest: front stays front, window stays window) or a full REFUND. Delays over 45 min offer KEEP or REFUND. Passengers answer in the app or on the SMS link (`/d/<token>`, no login). No answer: no car → refund; delay → keep.",
      "auth": {
        "type": "bearer",
        "bearer": [
          {
            "key": "token",
            "value": "{{passengerToken}}",
            "type": "string"
          }
        ]
      },
      "item": [
        {
          "name": "Seat map of the second departure",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/trips/{{tripId2}}/seats",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "trips",
                "{{tripId2}}",
                "seats"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const free = pm.response.json().seats.filter(s => s.status === 'AVAILABLE').map(s => s.seatNo);",
                  "pm.collectionVariables.set('seatE', free[0]);"
                ]
              }
            }
          ]
        },
        {
          "name": "Book a seat on it",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"tripId\": {{tripId2}},\n  \"seats\": [{{seatE}}]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created', () => pm.response.to.have.status(201));",
                  "pm.collectionVariables.set('bookingId2', pm.response.json().id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Pay",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{bookingId2}}/pay",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{bookingId2}}",
                "pay"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"phone\": \"{{passengerPhone}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('202 Accepted', () => pm.response.to.have.status(202));"
                ]
              }
            }
          ]
        },
        {
          "name": "Wait for payment → PAID",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{bookingId2}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{bookingId2}}"
              ]
            }
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Mock M-Pesa answers ~6s after \"Pay\". Give it 7s.",
                  "setTimeout(() => {}, 7000);"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const j = pm.response.json();",
                  "const done = j.status === 'PAID';",
                  "const n = Number(pm.collectionVariables.get('payRetries') || 0);",
                  "if (!done && n < 4) {",
                  "  // Still waiting for M-Pesa: the Collection Runner re-sends this request; when clicking manually, send it again.",
                  "  pm.collectionVariables.set('payRetries', n + 1);",
                  "  pm.test('payment still pending - retrying', () => {});",
                  "  if (pm.execution && pm.execution.setNextRequest) pm.execution.setNextRequest(pm.info.requestName);",
                  "  else postman.setNextRequest(pm.info.requestName);",
                  "} else {",
                  "  pm.collectionVariables.set('payRetries', 0);",
                  "  pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "  pm.test('booking is PAID', () => pm.expect(done, JSON.stringify(j.payment)).to.be.true);",
                  "  if (j.status === 'PAID') pm.collectionVariables.set('ticketCode3', j.passengers[0].ticket.code);",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "Dispatcher: no car for this departure",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/trips/{{tripId2}}/no-vehicle",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "trips",
                "{{tripId2}}",
                "no-vehicle"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"reason\": \"Breakdown at Kericho, no standby available\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{dispatcherToken}}",
                  "type": "string"
                }
              ]
            },
            "description": "Also happens automatically at T-15 when no car is available."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('1+ offer made', () => pm.expect(pm.response.json().offers).to.be.at.least(1));"
                ]
              }
            }
          ]
        },
        {
          "name": "Passenger sees the choice",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{bookingId2}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{bookingId2}}"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const d = pm.response.json().disruption;",
                  "pm.test('NO_VEHICLE offer pending', () => { pm.expect(d.type).to.eql('NO_VEHICLE'); pm.expect(d.status).to.eql('PENDING'); });",
                  "pm.test('MOVE offered', () => pm.expect(d.options).to.include('MOVE'));",
                  "pm.collectionVariables.set('offerLink', d.link);"
                ]
              }
            }
          ]
        },
        {
          "name": "SMS link page (no login)",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{offerLink}}",
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('choice page', () => pm.expect(pm.response.text()).to.include('Full refund'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Passenger chooses MOVE",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{bookingId2}}/disruption",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{bookingId2}}",
                "disruption"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"choice\": \"MOVE\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('moved', () => pm.expect(j.tripId).to.not.eql(Number(pm.collectionVariables.get('tripId2'))));",
                  "pm.collectionVariables.set('movedTripId', j.tripId);"
                ]
              }
            }
          ]
        },
        {
          "name": "Same booking, same ticket code, new departure",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{bookingId2}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{bookingId2}}"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "const j = pm.response.json();",
                  "pm.test('on the new trip', () => pm.expect(j.trip.id).to.eql(Number(pm.collectionVariables.get('movedTripId'))));",
                  "pm.test('ticket code unchanged', () => pm.expect(j.passengers[0].ticket.code).to.eql(pm.collectionVariables.get('ticketCode3')));"
                ]
              }
            }
          ]
        },
        {
          "name": "Dispatcher delays that departure 50 min",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/trips/{{movedTripId}}/delay",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "trips",
                "{{movedTripId}}",
                "delay"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"minutes\": 50,\n  \"reason\": \"Heavy traffic on Waiyaki Way\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{dispatcherToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('refund offered (over 45 min)', () => pm.expect(pm.response.json().refundOffered).to.be.true);"
                ]
              }
            }
          ]
        },
        {
          "name": "Passenger keeps the seat",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{bookingId2}}/disruption",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{bookingId2}}",
                "disruption"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"choice\": \"KEEP\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Choosing twice → 409",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/bookings/{{bookingId2}}/disruption",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "bookings",
                "{{bookingId2}}",
                "disruption"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"choice\": \"REFUND\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('409 Conflict', () => pm.response.to.have.status(409));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "10 Admin – bookings, refunds, reports, audit",
      "description": "Refunds: REQUESTED (support/admin) → APPROVED (finance/admin) → PAID with the M-Pesa reference (unique — one reversal can't pay two refunds). The audit log is append-only and hash-chained; the database refuses UPDATE/DELETE on it.",
      "auth": {
        "type": "bearer",
        "bearer": [
          {
            "key": "token",
            "value": "{{adminToken}}",
            "type": "string"
          }
        ]
      },
      "item": [
        {
          "name": "Search bookings by reference",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/bookings?q={{bookingRef}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "bookings"
              ],
              "query": [
                {
                  "key": "q",
                  "value": "{{bookingRef}}"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('found', () => pm.expect(pm.response.json().map(b => b.id)).to.include(Number(pm.collectionVariables.get('bookingId'))));"
                ]
              }
            }
          ]
        },
        {
          "name": "Search bookings by phone",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/bookings?q={{passengerPhone}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "bookings"
              ],
              "query": [
                {
                  "key": "q",
                  "value": "{{passengerPhone}}"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Booking timeline",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/bookings/{{bookingId}}/timeline",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "bookings",
                "{{bookingId}}",
                "timeline"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('payment recorded', () => pm.expect(pm.response.json().events.map(e => e.action)).to.include('PaymentCompleted'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Resend ticket (staff)",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/tickets/{{ticketCode}}/resend",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "tickets",
                "{{ticketCode}}",
                "resend"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Request a refund",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/bookings/{{bookingId}}/refund",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "bookings",
                "{{bookingId}}",
                "refund"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"reason\": \"Passenger missed the trip — goodwill refund\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 Created', () => pm.response.to.have.status(201));",
                  "pm.collectionVariables.set('refundId', pm.response.json().id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Dispatcher can't approve refunds → 403",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/refunds/{{refundId}}/approve",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "refunds",
                "{{refundId}}",
                "approve"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{dispatcherToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('403 Forbidden', () => pm.response.to.have.status(403));"
                ]
              }
            }
          ]
        },
        {
          "name": "Finance approves",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/refunds/{{refundId}}/approve",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "refunds",
                "{{refundId}}",
                "approve"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"reason\": \"Checked: trip departed without them\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{financeToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('not self-approved', () => pm.expect(pm.response.json().selfApproved).to.be.false);"
                ]
              }
            }
          ]
        },
        {
          "name": "Finance records the M-Pesa payout",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/refunds/{{refundId}}/paid",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "refunds",
                "{{refundId}}",
                "paid"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"mpesaRef\": \"{{mpesaRef}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{financeToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.collectionVariables.set('mpesaRef', 'RF' + Math.random().toString(36).slice(2, 10).toUpperCase());"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "List refunds",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/refunds?status=PAID",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "refunds"
              ],
              "query": [
                {
                  "key": "status",
                  "value": "PAID"
                }
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{financeToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Payments",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/payments?status=COMPLETED",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "payments"
              ],
              "query": [
                {
                  "key": "status",
                  "value": "COMPLETED"
                }
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{financeToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Pending passenger choices",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/disruptions?status=PENDING",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "disruptions"
              ],
              "query": [
                {
                  "key": "status",
                  "value": "PENDING"
                }
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{dispatcherToken}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Sales report",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/reports/sales?from={{searchDate}}&to={{searchDate}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "reports",
                "sales"
              ],
              "query": [
                {
                  "key": "from",
                  "value": "{{searchDate}}"
                },
                {
                  "key": "to",
                  "value": "{{searchDate}}"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Fairness report (per car)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/reports/fairness",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "reports",
                "fairness"
              ]
            },
            "description": "Last 7 days by default (`from`, `to`): trips, seats, revenue, times primary/standby, promotions, manual assignments, declines, strikes and average queue wait per car — so owners can see the queue is fair."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('cars listed', () => pm.expect(pm.response.json().cars.length).to.be.at.least(1));"
                ]
              }
            }
          ]
        },
        {
          "name": "Staff actions report",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/reports/staff-actions",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "reports",
                "staff-actions"
              ]
            },
            "description": "Overrides, queue edits, refunds, fare changes, cancellations per staff member, plus self-approved refunds."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('the manual assignment shows up', () => pm.expect(JSON.stringify(pm.response.json())).to.include('ManualAssignment'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Audit log (latest)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/audit?limit=20",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "audit"
              ],
              "query": [
                {
                  "key": "limit",
                  "value": "20"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('hash-chained rows', () => pm.expect(pm.response.json()[0].hash).to.have.length(64));"
                ]
              }
            }
          ]
        },
        {
          "name": "Verify the audit chain",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/audit/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "audit",
                "verify"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('chain intact', () => pm.expect(pm.response.json().ok).to.be.true);"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "11 M-Pesa callback (what Safaricom calls)",
      "description": "The callback URL is `/api/v1/payments/stk/callback/<MPESA_CALLBACK_SECRET>`. Select the **Sabaa local** environment (it holds the secret from `backend/.env`). In mock mode the API simulates this call itself.",
      "auth": {
        "type": "noauth"
      },
      "item": [
        {
          "name": "Callback with wrong secret → 404",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/payments/stk/callback/wrong-secret",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "payments",
                "stk",
                "callback",
                "wrong-secret"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"Body\": {\n    \"stkCallback\": {\n      \"MerchantRequestID\": \"29115-34620561-1\",\n      \"CheckoutRequestID\": \"{{checkoutRequestId}}\",\n      \"ResultCode\": 0,\n      \"ResultDesc\": \"The service request is processed successfully.\",\n      \"CallbackMetadata\": {\n        \"Item\": [\n          { \"Name\": \"Amount\", \"Value\": {{bookingTotal}} },\n          { \"Name\": \"MpesaReceiptNumber\", \"Value\": \"TKB{{$randomInt}}XYZ\" },\n          { \"Name\": \"TransactionDate\", \"Value\": 20261111120000 },\n          { \"Name\": \"PhoneNumber\", \"Value\": 254700000101 }\n        ]\n      }\n    }\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('404 Not Found', () => pm.response.to.have.status(404));"
                ]
              }
            }
          ]
        },
        {
          "name": "Callback – payment success",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/payments/stk/callback/{{mpesaCallbackSecret}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "payments",
                "stk",
                "callback",
                "{{mpesaCallbackSecret}}"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"Body\": {\n    \"stkCallback\": {\n      \"MerchantRequestID\": \"29115-34620561-1\",\n      \"CheckoutRequestID\": \"{{checkoutRequestId}}\",\n      \"ResultCode\": 0,\n      \"ResultDesc\": \"The service request is processed successfully.\",\n      \"CallbackMetadata\": {\n        \"Item\": [\n          { \"Name\": \"Amount\", \"Value\": {{bookingTotal}} },\n          { \"Name\": \"MpesaReceiptNumber\", \"Value\": \"TKB{{$randomInt}}XYZ\" },\n          { \"Name\": \"TransactionDate\", \"Value\": 20261111120000 },\n          { \"Name\": \"PhoneNumber\", \"Value\": 254700000101 }\n        ]\n      }\n    }\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Always acknowledged with `{\"ResultCode\":0}`; duplicates for a completed payment are ignored."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('mpesaCallbackSecret is set (select the Sabaa local environment)', () => pm.expect(pm.variables.get('mpesaCallbackSecret')).to.not.be.empty);",
                  "pm.test('200 OK', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "12 Dev tools (NODE_ENV=development only)",
      "description": "Run the dispatch timeline as if it were another time, to test T-3h … T-15 without waiting. Example: `?now=2026-11-13T05:00:00+03:00` runs the T-3h step for an 08:00 departure. It acts for real (SMS, strikes, swaps) — use it on test data.",
      "auth": {
        "type": "bearer",
        "bearer": [
          {
            "key": "token",
            "value": "{{adminToken}}",
            "type": "string"
          }
        ]
      },
      "item": [
        {
          "name": "Run dispatch tick (now)",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/admin/dev/dispatch-tick",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "admin",
                "dev",
                "dispatch-tick"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "pm.test('ran', () => pm.expect(pm.response.json()).to.have.property('trips'));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "13 Logout",
      "description": "Run last: revokes the passenger refresh token.",
      "auth": {
        "type": "noauth"
      },
      "item": [
        {
          "name": "Logout",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/logout",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "logout"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"refreshToken\": \"{{passengerRefreshToken}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('204 No Content', () => pm.response.to.have.status(204));"
                ]
              }
            }
          ]
        },
        {
          "name": "Refresh with revoked token → 401",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/auth/refresh",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "auth",
                "refresh"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"refreshToken\": \"{{passengerRefreshToken}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('401 Unauthorized', () => pm.response.to.have.status(401));"
                ]
              }
            }
          ]
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "http://localhost:4000",
      "type": "string",
      "description": "API origin. Android emulator → http://10.0.2.2:4000"
    },
    {
      "key": "passengerPhone",
      "value": "0700000101",
      "type": "string",
      "description": "Test passenger (any 07xx/01xx number)"
    },
    {
      "key": "secondPassengerPhone",
      "value": "0700000102",
      "type": "string"
    },
    {
      "key": "failPayPhone",
      "value": "0700100000",
      "type": "string",
      "description": "Ends in 000 → mock M-Pesa simulates \"cancelled by user\""
    },
    {
      "key": "adminPhone",
      "value": "0700000001",
      "type": "string"
    },
    {
      "key": "dispatcherPhone",
      "value": "0700000003",
      "type": "string"
    },
    {
      "key": "financePhone",
      "value": "0700000004",
      "type": "string"
    },
    {
      "key": "testDriverPhone",
      "value": "0700000103",
      "type": "string",
      "description": "Registered by folder 05"
    },
    {
      "key": "testStaffPhone",
      "value": "0700000106",
      "type": "string",
      "description": "Staff account created (then deactivated) by folder 04"
    },
    {
      "key": "from",
      "value": "NBO",
      "type": "string",
      "description": "Origin stage code"
    },
    {
      "key": "to",
      "value": "KSI",
      "type": "string",
      "description": "Destination stage code"
    },
    {
      "key": "travelDate",
      "value": "",
      "type": "string",
      "description": "YYYY-MM-DD (EAT). Blank = today, or tomorrow after 18:30 EAT"
    },
    {
      "key": "nboLat",
      "value": "-1.2831",
      "type": "string"
    },
    {
      "key": "nboLng",
      "value": "36.8262",
      "type": "string"
    },
    {
      "key": "ksiLat",
      "value": "-0.6771",
      "type": "string"
    },
    {
      "key": "ksiLng",
      "value": "34.7801",
      "type": "string"
    },
    {
      "key": "mpesaCallbackSecret",
      "value": "",
      "type": "string",
      "description": "Set in the Sabaa local environment (MPESA_CALLBACK_SECRET in backend/.env)"
    },
    {
      "key": "searchDate",
      "value": "",
      "type": "string"
    },
    {
      "key": "passengerOtp",
      "value": "",
      "type": "string"
    },
    {
      "key": "passengerToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "passengerRefreshToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "adminOtp",
      "value": "",
      "type": "string"
    },
    {
      "key": "adminToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "adminRefreshToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "dispatcherOtp",
      "value": "",
      "type": "string"
    },
    {
      "key": "dispatcherToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "dispatcherRefreshToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "financeOtp",
      "value": "",
      "type": "string"
    },
    {
      "key": "financeToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "financeRefreshToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "driverOtp",
      "value": "",
      "type": "string"
    },
    {
      "key": "driverToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "driverRefreshToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "tripId",
      "value": "",
      "type": "string"
    },
    {
      "key": "tripId2",
      "value": "",
      "type": "string"
    },
    {
      "key": "seatA",
      "value": "",
      "type": "string"
    },
    {
      "key": "seatB",
      "value": "",
      "type": "string"
    },
    {
      "key": "seatC",
      "value": "",
      "type": "string"
    },
    {
      "key": "seatD",
      "value": "",
      "type": "string"
    },
    {
      "key": "seatE",
      "value": "",
      "type": "string"
    },
    {
      "key": "idemKey",
      "value": "",
      "type": "string"
    },
    {
      "key": "bookingId",
      "value": "",
      "type": "string"
    },
    {
      "key": "bookingRef",
      "value": "",
      "type": "string"
    },
    {
      "key": "bookingTotal",
      "value": "",
      "type": "string"
    },
    {
      "key": "checkoutRequestId",
      "value": "",
      "type": "string"
    },
    {
      "key": "ticketCode",
      "value": "",
      "type": "string"
    },
    {
      "key": "ticketCode2",
      "value": "",
      "type": "string"
    },
    {
      "key": "ticketCode3",
      "value": "",
      "type": "string"
    },
    {
      "key": "qrPayload",
      "value": "",
      "type": "string"
    },
    {
      "key": "failBookingId",
      "value": "",
      "type": "string"
    },
    {
      "key": "payRetries",
      "value": "",
      "type": "string"
    },
    {
      "key": "adminUserId",
      "value": "",
      "type": "string"
    },
    {
      "key": "testStaffId",
      "value": "",
      "type": "string"
    },
    {
      "key": "ownerId",
      "value": "",
      "type": "string"
    },
    {
      "key": "expiredVehicleId",
      "value": "",
      "type": "string"
    },
    {
      "key": "testDriverId",
      "value": "",
      "type": "string"
    },
    {
      "key": "newPlate",
      "value": "",
      "type": "string"
    },
    {
      "key": "newVehicleId",
      "value": "",
      "type": "string"
    },
    {
      "key": "offDay",
      "value": "",
      "type": "string"
    },
    {
      "key": "routeId",
      "value": "",
      "type": "string"
    },
    {
      "key": "routeBaseFare",
      "value": "",
      "type": "string"
    },
    {
      "key": "routeFrontFare",
      "value": "",
      "type": "string"
    },
    {
      "key": "newScheduleTime",
      "value": "",
      "type": "string"
    },
    {
      "key": "scheduleId",
      "value": "",
      "type": "string"
    },
    {
      "key": "festiveDay",
      "value": "",
      "type": "string"
    },
    {
      "key": "presenceWindowMin",
      "value": "",
      "type": "string"
    },
    {
      "key": "tripDriverPhone",
      "value": "",
      "type": "string"
    },
    {
      "key": "tripVehicleId",
      "value": "",
      "type": "string"
    },
    {
      "key": "tripVersion",
      "value": "",
      "type": "string"
    },
    {
      "key": "extraTripId",
      "value": "",
      "type": "string"
    },
    {
      "key": "queueEntryId",
      "value": "",
      "type": "string"
    },
    {
      "key": "assignmentId",
      "value": "",
      "type": "string"
    },
    {
      "key": "checkInQr",
      "value": "",
      "type": "string"
    },
    {
      "key": "bookingId2",
      "value": "",
      "type": "string"
    },
    {
      "key": "offerLink",
      "value": "",
      "type": "string"
    },
    {
      "key": "movedTripId",
      "value": "",
      "type": "string"
    },
    {
      "key": "refundId",
      "value": "",
      "type": "string"
    },
    {
      "key": "mpesaRef",
      "value": "",
      "type": "string"
    },
    {
      "key": "passengerEmail",
      "value": "passenger101@nyakisiicabs.test"
    },
    {
      "key": "adminEmail",
      "value": "admin@nyakisiicabs.test"
    },
    {
      "key": "dispatcherEmail",
      "value": "dispatch@nyakisiicabs.test"
    },
    {
      "key": "financeEmail",
      "value": "finance@nyakisiicabs.test"
    },
    {
      "key": "testStaffEmail",
      "value": "staff106@nyakisiicabs.test"
    },
    {
      "key": "testDriverEmail",
      "value": "driver103@nyakisiicabs.test"
    },
    {
      "key": "tripDriverEmail",
      "value": ""
    }
  ]
}
