Show:

A booking that represents a request by the user to be picked up.

Constructor

SnapCar.Booking
(
  • rider
  • startLocation
  • endLocation
  • plannedStartDate
  • nameboard
  • driverInfo
  • meetingPoint
)

Parameters:

  • [rider] SnapCar.Rider optional

    The passenger of the booking. Typically the currently identifier user.

  • [startLocation] SnapCar.Location optional

    The location at which the rider needs to be picked up.

  • [endLocation] SnapCar.Location optional

    The location at which the rider needs to be dropped off.

  • [plannedStartDate] Date optional

    The planned pick up date.

  • [nameboard] Boolean optional

    Set to true if the nameboard option is required

  • [driverInfo] String optional

    Additional pick up information to provide the driver with.

  • [meetingPoint] SnapCar.MeetingPoint optional

    Meeting 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:

jQuery.Promise:

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:

jQuery.Promise:

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:

jQuery.Promise:

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:

jQuery.Promise:

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:

jQuery.Promise:

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

bookingPrice

SnapCar.BookingPrice const

The initial order information.

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

Array const

The 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.

endLocation

SnapCar.Location const

The location at which the rider has been dropped off.

id

String const

The booking unique identifier.

meetingPoint

SnapCar.MeetingPoint const

Meeting at which the rider will find its driver.

plannedStartDate

Date const

The planned pick up date.

rider

SnapCar.Rider const

The passenger of the booking.

route

Array const

A list of timestamped points describing the driver route from the pick up location.

serviceClass

SnapCar.ServiceClass const

The ordered service class for this booking.

startDate

Date const

The date at which the rider went on board.

startLocation

SnapCar.Location const

The pick up location.

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.

vehicle

SnapCar.Vehicle const

The vehicle used by the driver to pick the rider up.