UpdateBooking method

  • UpdateBooking API allows clients to modify or cancel existing bookings by providing the booking_id and updated information like slot details or status.

  • The API uses UpdateBookingRequest for sending update requests and UpdateBookingResponse for responses, including the updated booking and potentially an updated user payment option.

  • In case of update failure due to business logic errors, the error details will be provided in the booking_failure field of the UpdateBookingResponse, even with an HTTP 200 status.

  • When updating a booking results in payment option changes (e.g., cancellation leading to credit), the updated UserPaymentOption is included in the response.

The client uses UpdateBooking to modify or cancel an existing booking.

If updating a booking fails due to any business logic error, the error should be populated in the UpdateBookingResponse.booking_failure field and returned with HTTP status 200.

Request

UpdateBookingRequest

A request message contains updated information in the booking field. The request will contain a booking_id to identify the booking to update. It will also include one of:

  1. Slot details to update (booking modifications)
  2. Status to change (booking cancellation)

Fields which do not require change will not be provided in the request.

Return value

UpdateBookingResponse

// Request to update a Booking.
message UpdateBookingRequest {
  // The booking to be updated
  // The following fields can be set in a booking:
  // - status, to cancel a booking.
  // - one of the following is required:
  //   - start_time AND duration in the slot, to reschedule a booking.
  //   - party_size (for dining reservations).
  Booking booking = 1;
}

// Response with the updated Booking.
message UpdateBookingResponse {
  // The updated booking (required)
  Booking booking = 1;

  // The updated user payment option originally used to pay for this booking.
  // This should be set if the UpdateBookingRequest results in a change to
  // the UserPaymentOption.
  // For instance, if the booking is canceled, the UserPaymentOption should
  // reflect an additional credit to the user. In the case of a multi-use
  // payment option, the current_count should be increased by one to
  // allow the user to create another booking with this payment option. In the
  // case of a single-use payment option, a new single-use user payment option
  // should be returned. (required if altered in update)
  UserPaymentOption user_payment_option = 2;

  // If updating a booking fails, this field should reflect the business logic
  // error (e.g., booking is not cancellable) (required if failure occurs)
  BookingFailure booking_failure = 3;
}