backend requirements onthe xustomer app
This commit is contained in:
@@ -39,3 +39,21 @@ func CityGateMiddleware(c *fiber.Ctx) error {
|
||||
"code": "CITY_NOT_SUPPORTED",
|
||||
})
|
||||
}
|
||||
|
||||
// PincodeInOperatingCity reports whether a pincode falls in a city Doormile
|
||||
// runs in, and names it.
|
||||
//
|
||||
// Exported because the customer app's booking request does not carry a
|
||||
// pickuppincode at all — its pickup point is a title/sub/lat/lng from the place
|
||||
// search, so CityGateMiddleware's body sniff finds nothing and waves it
|
||||
// through. A middleware that silently no-ops on the one caller it matters most
|
||||
// for is worse than no middleware, so the customer handler resolves the pickup
|
||||
// point to a pincode itself and asks this directly.
|
||||
func PincodeInOperatingCity(pincode string) (string, bool) {
|
||||
pincode = strings.TrimSpace(pincode)
|
||||
if len(pincode) < 3 {
|
||||
return "", false
|
||||
}
|
||||
city, ok := operatingCityPrefixes[pincode[:3]]
|
||||
return city, ok
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user