Integrate API for Restaurants Booking : Book A Table
11
Aug

Integrate API for Restaurants Booking : Book A Table

Book a table is a third party api with soap request/response .That is basically used for restaurant booking. Before book a restaurant book a table api is checking that availability of the restaurant by providing time and session of the user. Book a table provide all details of restaurant with special offers.

There are the following steps for integrating with complete restaurant booking process in cakePHP.

Book A Table API Integration:

For integrating Book a table api with php, create a class for WSDL request /response with Languages, Partner Code

$SoapClient = new SoapClient("https://book.livebookings.net/webservices/external/service.asmx?WSDL", array("trace" => 1, "exception" => 0,
"Languages"=>”en-GB” ,"PartnerCode"=>”YOUR PARTNER CODE”,"CountryCode"=>"GBR"));

Listing of Restaurants:

For getting list of all restaurant bookatable provides getRestaurants api .

$requestObject = array(

"RegionCode " => “GBR”,

"MaximumResults " => “1000”

);

$SoapClient ->GetRestaurants($requestObject);

Getting Details

For Getting detailed information of a single restaurant bookatable provide GetRestaurantDetail.

$requestObject = array(

“Id” =>”BookTableId”

);

$SoapClient ->GetRestaurantDetail( $requestObject);

Restaurant Booking

Before booked any restaurant, book a table check the table availability of the table with given details (number of people, date time and session).

a) Search Availability

For check the table availability we use Search Availability API.

$requestObject = array(

"SessionId" => Session,

"DiningDateAndTime" => DateTime,

"Size" => PartySize,

"RestaurantInternalIds" => BookTableID,

"ReturnPromotions" => true,

);

$SoapClient -> SearchAvailability( $requestObject);

Search availability api provide two type response one is called non – Promotions and second is Promotion.

Non – Promotions: – Non – Promotions is normal availability of a restaurant.

Promotions:- Restaurant availability with special offers. We get offers an available time by the given promotion id

b) Prepare Book Reservation

Make a reservation for an available time returned by SearchAvailability and prepared by calling PrepareBookReservation. Before BookReservation, PrepareBookReservation should be called to validate that the selected time is still valid.

$prepareBookRequest = array(

"SessionId" => Session,

"DiningDateAndTime" => DateTime,

"Size" => (int) PartySize,

"RestaurantLocationId" => (int) BookTableID,

"CorrelationData" => cdata,

);

$SoapClient ->PrepareBookReservation( $prepareBookRequest);

If User check PrepareBookReservation for any promotion offers then we pass PromotionId in the request array.

C) Book Reservation

Book reservation is the final step for booked any restaurant using book a table api. This is all request array that is use for book a restaurant

$bookReservationRequest = array(

"SessionId" =>Session,

"DiningDateAndTime" =>DateTime,

"Size" => (int) PartySize,

"RestaurantLocationId" => (int) $ BookTableID,

"CorrelationData" => Date,

"Booker" => $booker,

"CancelLink" => "cancel-reservation",

"SuppressCustomerConfirmations" => false,

"SuppressRestaurantConfirmations" => true,

// "SpecialRequests"=> if restaurant allows special requests, seen when preparing booking, this can be added here

"GuestAcceptsEmailMarketingFromRestaurant" => false,

);

Array $booker is hold all information about the use likes as:

$booker = array(

"UserWithoutALogin" => array(

"FirstName" => “FirstName”,

"LastName" =>”LastName”,

"EMail" => “example@gmail.com”,

"MobilePhoneNumber" =>” MobilePhoneNumber”,

"Title" =>” Title”,

),

);

$SoapClient ->BookReservation ($bookReservationRequest);

After complete booking book a table provide ReservationId , transaction_id and AllowedToCancelOnline.

D) Cancel Reservation

For cancel any restaurant booking we user Cancel Reservation API.

$requestObject = array(

"ReservationId" => “ReservationId”

"SuppressCustomerConfirmations" => false,

"SuppressRestaurantConfirmations" => true,

);

$SoapClient ->CancelReservation($bookReservationRequest);

That’s all about complete reservation system by bookatable API in cakePHP 3.0 . Contact us if you want to implement restaurants booking api in your application.

share
How to Execute Database Query in MongoDB

How to Execute Database Query in MongoDB

previous-blog-arrowPrevious
Get your Mobile App Development for Tourism

Get your Mobile App Development for Tourism

next-blog-arrowNext