Skip to content

Commit 294214b

Browse files
committed
prices: Use default seat filler of 2
Discovered while using ubers, if a seat count is void so 0, Uber expects the default to be set to 2.
1 parent 6697bdc commit 294214b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

v1/prices.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ func (upf *UpfrontFare) NoCarsAvailable() bool {
242242

243243
var errInvalidSeatCount = errors.New("invalid seatcount, default and maximum value is 2")
244244

245+
const defaultSeatCount = 2
246+
245247
func (esReq *EstimateRequest) validateForUpfrontFare() error {
246248
if esReq == nil {
247249
return errNilEstimateRequest
@@ -253,6 +255,10 @@ func (esReq *EstimateRequest) validateForUpfrontFare() error {
253255
return errInvalidSeatCount
254256
}
255257

258+
if esReq.SeatCount == 0 {
259+
esReq.SeatCount = defaultSeatCount
260+
}
261+
256262
// UpfrontFares require:
257263
// * StartPlace or (StartLatitude, StartLongitude)
258264
// * EndPlace or (EndLatitude, EndLongitude)

0 commit comments

Comments
 (0)