updates on the otp updates on the customer app

This commit is contained in:
2026-09-15 11:50:12 +05:30
parent e8f4c0a593
commit 89321c9e06
17 changed files with 1072 additions and 69 deletions

View File

@@ -84,11 +84,22 @@
## 3. Core Request & Response Payloads
### 1) OTP Verification (`POST /customer/auth/otp/verify`)
> **The field is `code`, not `otp`.** This section said `otp` until 11 Sep 2026
> and the customer app was built against it, while the server only ever read
> `code`. Every sign-in therefore failed with a `400 "Enter the code we sent
> you"` — a correct code failed exactly like a wrong one. `openapi-customer.yaml`
> had it right all along; the two disagreed and this one was wrong.
>
> The server now also accepts `otp` as a **deprecated alias**, so builds already
> in customers' hands keep working. Send `code`. If both are present, `code`
> wins.
```json
// Request
{
"identifier": "+919876543210",
"otp": "1234"
"code": "1234"
}
// Response (200 OK)
@@ -109,26 +120,25 @@
```
### 2) Fare Estimate (`POST /customer/fare/estimate`)
> **Corrected 11 Sep 2026** against `cxEstimateRequest`
> (`controllers/cxFareController.go`). The old shape used
> `pickup.latitude`/`longitude` (parsed as `lat`/`lng`), gave `pickup` a
> `stateCode`/`districtCode` it does not have, and described destinations as
> carrying a `packages` array of weights. The estimate is priced on
> `packageCount`; per-package weight is not known until the miler weighs it at
> the door.
```json
// Request
{
"pickup": {
"latitude": 13.0827,
"longitude": 80.2707,
"stateCode": "TN",
"districtCode": "CHN"
"lat": 13.0827,
"lng": 80.2707
},
"destinations": [
{
"stateCode": "TN",
"districtCode": "CHN",
"packages": [{ "weightKg": 2.5 }]
},
{
"stateCode": "KA",
"districtCode": "BLR",
"packages": [{ "weightKg": 1.0 }]
}
{ "stateCode": "TN", "districtCode": "CHN", "packageCount": 2 },
{ "stateCode": "KA", "districtCode": "BLR", "packageCount": 1 }
]
}
@@ -149,6 +159,20 @@
```
### 3) Booking Creation (`POST /customer/bookings`)
> **Corrected 11 Sep 2026.** The shape below previously did not match the
> parser (`cxCreateBookingRequest`, `controllers/cxBookingController.go`), and
> every mismatch failed **silently** through `BodyParser` — no error, just a
> zero value:
>
> | Was documented | Actually parsed | Effect of following the old doc |
> |---|---|---|
> | `pickup.latitude` / `longitude` | `pickup.lat` / `lng` | pickup coordinates `0` |
> | `pickup.contactName` / `contactPhone` | *not read at all* | dropped |
> | destination fields flat | nested under `details` | every recipient/address field dropped |
> | destination `latitude` / `longitude` | `details.pin.lat` / `lng` | drop coordinates `0` |
> | `estimate` absent from the doc | **is** read | the quote shown to the customer was not recorded |
```json
// Request
{
@@ -156,26 +180,27 @@
"pickup": {
"title": "Home",
"sub": "Flat 4B, Green Towers, Anna Nagar",
"latitude": 13.0827,
"longitude": 80.2707,
"contactName": "Alex Kumar",
"contactPhone": "+919876543210"
"lat": 13.0827,
"lng": 80.2707
},
"destinations": [
{
"recipientName": "Priya S",
"recipientPhone": "+919840123456",
"building": "12/A",
"street": "MG Road",
"landmark": "Near Metro",
"districtCode": "CHN",
"stateCode": "TN",
"latitude": 13.0850,
"longitude": 80.2100,
"districtCode": "CHN",
"packageCount": 1,
"codAmount": 450
"details": {
"street": "MG Road",
"building": "12/A",
"landmark": "Near Metro",
"recipientName": "Priya S",
"recipientPhone": "+919840123456",
"instructions": "Ring the bell",
"pin": { "lat": 13.0850, "lng": 80.2100 },
"codAmount": 450
}
}
],
"estimate": { "min": 240, "max": 310 },
"remarks": "Handle with care"
}
@@ -192,16 +217,18 @@
"pickup": {
"title": "Home",
"sub": "Flat 4B, Green Towers, Anna Nagar",
"latitude": 13.0827,
"longitude": 80.2707
"lat": 13.0827,
"lng": 80.2707
},
"destinations": [
{
"index": 0,
"stateCode": "TN",
"stateName": "Tamil Nadu",
"districtCode": "CHN",
"districtName": "Chennai",
"packageCount": 1,
"codAmount": 450,
"details": { "recipientName": "Priya S", "codAmount": 450 },
"trackingId": null,
"stage": null
}