Alien Plugin

Wubook developers created an intuitive plugin that gives third-party softwares to manage the creation and deletion of reservations on Wubook itself: it’s called Alien.

How to insert a reservation

We give you the opportunity to interact with Wubook reservations by simple JSON POST calls.

In order to insert a reservation, you’re going to have to specify the following mandatory parameters.

Warning

All the POST calls operations are managed via SERVER to SERVER technology: it means that you have to be under Wubook domain in order for them to work.

  • alien_code: Ask the Wubook property to give you this code in order for you to manage the Alien Interface (i.e. 994862c403d2111cd586d9ed8c49f4bf).
  • dfrom: Arrival date
  • dto: Departure date
  • lcode: The lodging code given to you by the property.
  • rooms: a data that include {room_id: [room_quantity, board]}. Board can be: nb (no board), bb (breakfast), hb (half board), fb (full board) and finally “” (no board).
  • customer: data containing customer information: lname is the last name, fname is the first name, email, city, phone, street, country, lang, arrival_hour and notes. The country and lang parameter are the 2-digit country abbreviation, for instance: IT,UK etc, lang defines the voucher translation (eventually sent to customer).
  • ccard: credit card information can be optional, depending on the preferences of the structure. The fields are cc_exp_year, cc_exp_month, cc_type, cc_cvv, cc_owner and cc_number, while CVC code can be optional. To know more about credit cart types, please click here .
  • amount: The final price of the whole reservation.
  • ancillary_data: optional information you wish to pass along.

On the following sentence, you’ll find an example of the insertion of an Alien reservation:

Note

This is just an example: it won’t work if you try it; please, implement your own server2server call!

/*REQUEST */

var customer= {
  'lname': 'Blissett',
  'email': 'my@email.com',
  'fname': 'Luther',
  'city' : 'Fano',
  'street' : 'via giammaria 33',
  'country' : 'IT',
  'lang' : 'IT',
  'phone' : '+3964329779',
  'arrival_hour': '14:00',
  'notes' : 'some notes!!!'
};
var rooms= {18: [1, 'fb']};
var ancillary_data = {'Smoking': 'Yes', 'Paid': '60 Euro'};
var ccard = {
        'cc_exp_year': '2017',
        'cc_exp_month': '06',
        'cc_type': '2',
        'cc_owner' : 'WuBook srl',
        'cc_number': '432948329543211',
        'cc_cvv': '321'
           };
var postObject= {
    'dfrom': '27/08/2015',
    'dto': '28/08/2015',
    'rooms': rooms,
    'customer': customer,
    'ancillary_data': ancillary_data,
    'origin': 'My service name',
    'ccard': ccard,
    'alien_code': '994862c403d2111cd586d9ed7c49f4bf',
    'lcode': 1213394817,
    'amount': '500.00'
};
var postObjectJson= JSON.stringify(postObject);
function myCallBack(data) {
  if (data.error) alert('There is an error: ' + data.error);
  else alert('Reservation created: code= ' + data.rcode);
}
$.post('https://wubook.net/wbkd/alien', {'data': postObjectJson}, myCallBack);


/*RESPONSE*/

{"rcode": 1439890642, "error": ""}

How to delete a reservation

Warning

Again, all the POST calls operations are managed via SERVER to SERVER technology: it means that you have to be under Wubook domain in order for them to work properly.

In order to delete a reservation, you need to specify the following mandatory parameters:

  • lcode: the property code given to you by the property.
  • alien_code: Ask the property to give you the code.
  • reservation_id: Wubook reservation identificator.
  • origin: your signature, so that the property knows that the reservation was made by you.
  • reason: an options string containing the reason of cancellation.

On the following sentence, you’ll find an example of the deletion of an Alien reservation:

Note

This is just an example: it won’t work if you try it; please, implement your own server2server call!

/*REQUEST*/

var id_res= 1439890642;

dataDeletion = {'reservation_id' : id_res,
            'alien_code' : 'b4b0292b2d4fe2069eff1c44ab44fa6b',
            'lcode' : 1213394817,
            'origin' : "My service name",
            'reason' : 'unknown',
            };

var postObjectJson= JSON.stringify(dataDeletion);

function myCallBack(data) {
  if (data.error) alert('There is an error: ' + data.error);
  else alert('Reservation Deleted: code= ' + data.rcode);
}

$.post('/wbkd/alien', {'data': postObjectJson}, myCallBack);


/*RESPONSE*/

'{"rcode": 1439890642, "error": ""}'