Last active
December 11, 2015 05:48
-
-
Save jamesmills/4554740 to your computer and use it in GitHub Desktop.
Travel Editions Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include('inc/functions.php'); | |
$myTourOS = new TourOs(); | |
// Get a new session from Tours API and store it in out own session to use it again | |
$_SESSION['tourOsToken'] = (string)$myTourOS->getSession(); | |
output($_SESSION['tourOsToken'], 'tourOsToken'); | |
// get the detials of the departure sending our own session and the ID sent in the URI | |
$myDeparture = $myTourOS->getDeparture($_SESSION['tourOsToken'], $_GET['id']); | |
output((string)$myDeparture->tour->departures->departure[0]->cacheID, 'cacheID'); | |
// check the availability using the cacheID returned from above | |
// I DONT KNOW IF THIS WAS THE RIGHT ID | |
$myCheckAvailability = $myTourOS->checkAvailability($_SESSION['tourOsToken'], (string)$myDeparture->tour->departures->departure[0]->cacheID, '<occupancy><room adults="2" children="0" infants="0"/> </occupancy>'); | |
output($myCheckAvailability, 'checkAvailability'); | |
// create a new passenger (this would come from a from but forcing it for testing) | |
$passenger = array( | |
'dob' => '01-JAN-1980', | |
'forname' => 'James', | |
'gender' => 'M', | |
'lead' => 'True', | |
'passportNumber' => '1234567890', | |
'surname' => 'Mills', | |
'title' => 'Mr', | |
'type' => '1' //Adult = 1 Child = 2 Infant = 3 | |
); | |
// Test adding the passenger details to the order session. | |
$myEditPassenger = $myTourOS->editPassenger($_SESSION['tourOsToken'], 0, $passenger); | |
output($myEditPassenger, 'editPassenger'); | |
// This shoudll add the holiday to the order session | |
// I COULD NOT GET THIS TO WORK. THIS IS WHAT MADE ME THINK I DID NOT HAVE THE RIGHT ID??? | |
$myAddComponent = $myTourOS->addComponent($_SESSION['tourOsToken'], (string)$myDeparture->tour->departures->departure[0]->cacheID); | |
output($myAddComponent, 'myAddComponent'); | |
// This gets the basket (the full session that we are building above) | |
$myBasket = $myTourOS->getBasket($_SESSION['tourOsToken']); | |
output($myBasket, 'myBasket'); | |
exit; | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment