Comments (3)
DerMika, I developed a solution to add an infant associated to another passenger.
I had modified de createTraveller funtion in src\Amadeus\Client\Struct\Pnr\AddMultiElements.php:
` protected function createTraveller($traveller)
{
$createdTraveller = new TravellerInfo(
ElementManagementPassenger::SEG_NAME,
$traveller->lastName
);
if (!is_null($traveller->number)) {
$createdTraveller->elementManagementPassenger->reference = new Reference(
Reference::QUAL_PASSENGER,
$traveller->number
);
}
if ($traveller->dateOfBirth instanceof \DateTime) {
$createdTraveller->passengerData[0]->dateOfBirth = new DateOfBirth(
$traveller->dateOfBirth->format('dmY')
);
}
if ($traveller->firstName !== null || $traveller->travellerType !== null) {
$createdTraveller->passengerData[0]->travellerInformation->passenger[] = new Passenger(
$traveller->firstName,
$traveller->travellerType
);
}
if ($traveller->withInfant === true || ($traveller->infant !== null && count($traveller->infant) > 0 ) ) {
//throw new \RuntimeException('Adding Infants is not yet supported');
$createdTraveller->passengerData[0]->travellerInformation->traveller->quantity = 2;
$createdTraveller->passengerData[0]->travellerInformation->passenger[0]->infantIndicator = 3;
$createdTraveller->passengerData[1] = new AddMultiElements\PassengerData($traveller->infant->lastName);
$createdTraveller->passengerData[1]->travellerInformation->passenger[] = new Passenger(
$traveller->infant->firstName,
$traveller->infant->travellerType
);
}
return $createdTraveller;
}`
To make the call I did this:
$aTravelers[] = array('number' => 1, 'lastName' => 'Doe', 'firstName' => 'John', 'travellerType' => 'ADT', 'withInfant' => true, 'infant' => array('number' => 5,'lastName' => 'Doe', 'firstName' => 'Baby', 'travellerType' => 'INF', 'dateOfBirth' => '03052016') );
And then
` foreach( $aTravelers as $traveler ) {
$traveller_inf = array();
if ($traveler["withInfant"]) {
$traveller_inf = new Traveller(['lastName' => $traveler["infant"]["lastName"],
'firstName' => $traveler["infant"]["firstName"],
'travellerType' => $traveler["infant"]["travellerType"],
'dateOfBirth' => $traveler["infant"]["dateOfBirth"],
'withInfant' => false
]);
}
$createPnrOptions->travellers[] = new Traveller([
'number' => $traveler["number"],
'lastName' => $traveler["lastName"],
'firstName' => $traveler["firstName"],
'travellerType' => $traveler["travellerType"],
'withInfant' => $traveler["withInfant"],
'infant' => $traveller_inf
]);
$aReferences[] = new Reference([
'type' => Reference::TYPE_PASSENGER_TATTOO,
'id' => $traveler["number"]
]); }`
If you wish, I could send you the entire source code.
Best regards
from amadeus-ws-client.
Hi @jcarriquiry, I was planning to add infant support, but I hadn't gotten around to it yet.
I wanted to make sure I could support all the infant scenarios mentioned in the PNR_AddMultiElements
docs. There are different ways to add infants depending on what information you have of them (last name, first name, date of birth,...).
I will add support for infants before I release the first version. Or if you have a pull request, don't hesitate to contribute ;)
from amadeus-ws-client.
Implemented support for 3 scenario's of Infant passengers (No infant information, only first name, or first name, last name and date of birth).
See the updated docs on how to add them to your requests: https://github.com/amabnl/amadeus-ws-client/blob/develop/docs/samples/pnr-create-modify.rst#passengers-infants
If you find any problems, feel free to open a new ticket!
from amadeus-ws-client.
Related Issues (20)
- CTCE, CTCM HOT 12
- PNR_DisplayHistory for vendor locator history
- Missing mandatory item HOT 1
- How can I make requests to be stateful? HOT 2
- 11 | Session HOT 5
- Air_MultiAvailability excluded connections question HOT 3
- ADD CONTACT IN SSR CTCM CTCE HOT 1
- Ticket_IgnoreRefund
- Ticket_IgnoreRefund : DOMDocument::loadXML() Empty string supplied as input HOT 2
- How to add Passengers Title
- Create Form of payment after PNR_AddMultiElements
- Ticket_RebookAndRepricePNR
- Booking seat for stops [PNR_AddMultiElements].
- psr/log version conflict with Laravel 10 HOT 2
- 11|Session - Hosting based restrictions HOT 1
- Ticket_CreateTSTFromPricing not group TST by type passenger
- airRetrieveSeatMap error processingLevel 1
- How to add Tax Info in MPTB request HOT 1
- Help for startup
- Processing ERROR for Rail PNR in Amadeus
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amadeus-ws-client.