SnapCar.Booking
A booking that represents a request by the user to be picked up.
Table of Contents
- Methods
- Properties
Constructor
SnapCar.Booking
-
rider
-
startLocation
-
endLocation
-
plannedStartDate
-
nameboard
-
driverInfo
-
meetingPoint
Parameters:
-
[rider]
SnapCar.Rider optionalThe passenger of the booking. Typically the currently identifier user.
-
[startLocation]
SnapCar.Location optionalThe location at which the rider needs to be picked up.
-
[endLocation]
SnapCar.Location optionalThe location at which the rider needs to be dropped off.
-
[plannedStartDate]
Date optionalThe planned pick up date.
-
[nameboard]
Boolean optionalSet to true if the nameboard option is required
-
[driverInfo]
String optionalAdditional pick up information to provide the driver with.
-
[meetingPoint]
SnapCar.MeetingPoint optionalMeeting at which the rider will find his driver.
Methods
cancel
()
jQuery.Promise
Cancels the booking. You may want to check the cancellation price by using the SnapCar.Booking.cancellationPrice() method before doing so.
Returns:
A Promise object. Success handlers are called with the updated instance of SnapCar.Booking as the single argument. Note that the initial instance itself is updated. Failure handlers are called with a single SnapCar.APIError argument upon error.
cancellationPrice
()
jQuery.Promise
Gets the booking cancellation price. Relevant only when the booking is either in the 'pending', 'going_to_get' or 'driver_waiting' state.
Returns:
A Promise object. Success handlers are called with a SnapCar.CancellationFee as the single argument. Failure handlers are called with a single SnapCar.APIError argument upon error.
confirm
()
jQuery.Promise
Confirms the booking (without flat price) to the SnapCar platform. Before calling this method, you have to provide at least a rider, a startLocation and the desired serviceClass.
Returns:
A Promise object. Success/progress handlers are called with a SnapCar.Booking as the single argument. If the booking has a specific planned start date, the success callbacks are called once the platform confirms the booking creation. However, if the booking has no planned start date, the progress callbacks are called once the platform confirms the booking creation and the success callbacks are called when the booking is no longer in the "pending" status (either accepted by the driver or cancelled). Failure handlers are called with a single SnapCar.APIError argument upon error.
flatPrices
()
jQuery.Promise
Calculates flat prices for all allowed service classes. Then, you may confirm one of these prices according to the service class selected by the user. The flat prices are based on the booking information (rider, planned start date, start location, end location, if the nameboard option is enabled). Before calling this method, you have to provide at least a rider, a startLocation and an endLocation which are the basic elements for price calculation. Flat prices cannot be calculated otherwise.
Returns:
A Promise object. Success handlers are called with an array of SnapCar.BookingPrice as the single argument. Check the value of the SnapCar.BookingPrice.serviceClassId property in order to know to which service class a booking price is associated. Failure handlers are called with a single SnapCar.APIError argument upon error.
refresh
()
jQuery.Promise
Refreshes the booking information.
Returns:
A Promise object. Success handlers are called with the updated instance of SnapCar.Booking as the single argument. Note that the initial instance itself is updated. Failure handlers are called with a single SnapCar.APIError argument upon error.
Properties
billedAmount
Float
const
The total billed amount
cancellationDate
Date
const
The date at which the booking was cancelled (if relevant).
cancellationReason
String
const
This code indicates the reason why the booking was cancelled. Check out the SnapCar.BookingCancellationReasons static class properties.
creationDate
Date
const
The booking creation date.
documents
ArrayThe list of billing documents.
driverArrivalDate
Date
const
The driver arrival date at the pick up location.
driverInfo
String
const
Additional pick-up information for the driver. Provided by the rider.
endDate
Date
const
The date at which the rider has been dropped off.
id
String
const
The booking unique identifier.
plannedStartDate
Date
const
The planned pick up date.
route
ArrayA list of timestamped points describing the driver route from the pick up location.
startDate
Date
const
The date at which the rider went on board.
status
String
const
The booking status, refer to the SnapCar.BookingStatuses properties to have a comprehensive list of all possible statuses.
timezone
String
const
The booking location's timezone.
tip
Float
const
The tip given by the rider to the driver through the SnapCar application.
vatAmount
Float
const
The total VAT amount.