Travelport / travelport-uapi-tutorial-php

The travelport-uapi-tutorial-php is a PHP project for Universal API that will help you connect and code a standard workflow including Air, Vehicle, and Hotel.
35 stars 47 forks source link

Ticketing #186

Closed imon91 closed 5 years ago

imon91 commented 5 years ago

Hello After booking step for ticketing When I have run API it show an error message. I have shared it. please check

<?xml version="1.0"?>

vivekjyotipramanik commented 5 years ago

Hi imon91,

Could you please confirm if you had used Form Of payment in the AirCreateReservationReq. Please share the AirCreateReservationReq and Rsp. Thanks.

imon91 commented 5 years ago

Dear vivekjyotipramanik I did not use Form Of payment in the AirCreateReservationReq. I have shared AirCreateReservationReq and Rsp. Thank you

[Uploading response.docx…]()

imon91 commented 5 years ago

Dear vivekjyotipramanik I did not use Form Of payment in the AirCreateReservationReq. I have shared AirCreateReservationReq and Rsp. Thank you

<?xml version="1.0"?>

Bangladesh new palasia indore MP 452001 BD indore new palasia indore DHAKA 121 BD DEPARTS DAC TERMINAL 1 - ARRIVES JSR TERMINAL 1 *DEPARTURE DAC TERMINAL 1 / ARRIVAL JSR TERMINAL 1* DAC BG JSR 2371GDACFO BDT2371END 0.00 0.00
imon91 commented 5 years ago

<?xml version="1.0"?>

Bangladesh new palasia indore mp 452001 BD indore new palasia indore Dhaka 121 BD gws-eJxNT10PgjAM/DHk3tsNgb0NGSJGIVGi4cX//zO8bprYpR9pr9dbjNGJBlFp479VwM6H1A/XGQuUXjsvoXGAFzeDDVGDWCAMS5+2pw/avdJ6EzLSXAiQsle22FNUxwnHtGUK+uVxh/Ot5iM7xBM8kfG0ImtzaqglD0u0kyJjM9RMSE2qy8gMe46myAQYbzmKNz9logT4FeOZpQkvmjv2Dt+RtKDMDzraPcQ= MYTRIPANDMORE.COM/BAGGAGEDETAILSQF.BAGG 2P BAGGAGE DISCOUNTS MAY APPLY BASED ON FREQUENT FLYER STATUS/ ONLINE CHECKIN/FORM OF PAYMENT/MILITARY/ETC. BAGGAGE CHARGES DATA NOT AVAILABLE BAGGAGE CHARGES DATA NOT AVAILABLE CARRY ON ALLOWANCE DATA NOT AVAILABLE MYTRIPANDMORE.COM/BAGGAGEDETAILSQF.BAGG
vivekjyotipramanik commented 5 years ago

Hi imon91,

You have to use form of payment either in AirCreateReservationReq or AirTicketingReq. Please find below the sample end to flow. Thanks.

https://support.travelport.com/webhelp/uapi/uAPI.htm#SampleWeb/Kelvin/AirWorkflows/Kel_012-1P_Air_LFS_MinimumData.htm%3FTocPath%3DSamples%7CXML%2520Samples%2520%7CAir%2520Samples%7CAir%2520Samples%7CAir%2520Workflows%7CGDS%2520Workflows%2520(Apollo%252C%2520Galileo%252C%2520Worldspan)%7C_____2

imon91 commented 5 years ago

hello vivekjyotipramanik If I have used payment in AirCreateReservationReq it shows error. for version 29. without payment can it send the PNR ID or record ? would you tell me please Thanks

vivekjyotipramanik commented 5 years ago

Hi imon91,

Please provide the error you are getting while using Form Of Payment. Please use a latest version of schema like 43. 29 is very old. Thanks.

imon91 commented 5 years ago

hello vivekjyotipramanik I have attached it

tt
imon91 commented 5 years ago

for adding this line

tw2
imon91 commented 5 years ago

`<?php air booking requested code $TARGETBRANCH = ''; $CREDENTIALS = ''; $PROVIDER ='1G'; // Any provider you want to use like 1G/1P/1V/ACH $PreferredDepDate = date('2019-01-10', strtotime("75 day")); $PreferredRetDate = date('2019-01-24', strtotime("81 day"));

$message = <<<EOM

Bangladesh new palasia indore mp 452001 BD indore new palasia indore Dhaka 121 BD gws-eJxNT10PgjAM/DHk3tsNgb0NGSJGIVGi4cX//zO8bprYpR9pr9dbjNGJBlFp479VwM6H1A/XGQuUXjsvoXGAFzeDDVGDWCAMS5+2pw/avdJ6EzLSXAiQsle22FNUxwnHtGUK+uVxh/Ot5iM7xBM8kfG0ImtzaqglD0u0kyJjM9RMSE2qy8gMe46myAQYbzmKNz9logT4FeOZpQkvmjv2Dt+RtKDMDzraPcQ= MYTRIPANDMORE.COM/BAGGAGEDETAILSQF.BAGG 2P BAGGAGE DISCOUNTS MAY APPLY BASED ON FREQUENT FLYER STATUS/ ONLINE CHECKIN/FORM OF PAYMENT/MILITARY/ETC. BAGGAGE CHARGES DATA NOT AVAILABLE BAGGAGE CHARGES DATA NOT AVAILABLE CARRY ON ALLOWANCE DATA NOT AVAILABLE MYTRIPANDMORE.COM/BAGGAGEDETAILSQF.BAGG EOM; $file = "003-".$PROVIDER."_FlightBookReq.xml"; // file name to save the request xml for test only(if you want to save the request/response) prettyPrint($message,$file); //Calling the Pretty Print function // // Run the request // $auth = base64_encode("$CREDENTIALS"); $soap_do = curl_init("https://americas.universal-api.travelport.com/B2BGateway/connect/uAPI/AirService"); /*("https://americas.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/AirService");*/ $header = array( "Content-Type: text/xml;charset=UTF-8", "Accept-Encoding: gzip,deflate", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: \"\"", "Authorization: Basic $auth", "Content-length: ".strlen($message), ); //curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 30); //curl_setopt($soap_do, CURLOPT_TIMEOUT, 30); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $message); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true); curl_setopt($soap_do, CURLOPT_ENCODING, ''); $return = curl_exec($soap_do); curl_close($soap_do); $file = "001-".$PROVIDER."_LowFareSearchRsp.xml"; // file name to save the response xml for test only(if you want to save the request/response) $content = prettyPrint($return,$file); parseDetailOutput($content); function prettyPrint($result,$file){ $dom = new DOMDocument; $dom->preserveWhiteSpace = false; $dom->loadXML($result); $dom->formatOutput = true; //call function to write request/response in file outputWriter($file,$dom->saveXML()); return $dom->saveXML(); } function outputWriter($file,$content){ file_put_contents($file, $content); // Write request/response and save them in the File } //Parse the previous response to get the values to populate Request xml function parseDetailOutput($content){ //$hotelDetailRsp = file_get_contents('002_HotelDetailRsp.xml'); // Parsing the Hotel Detail Response xml $hotelDetailRsp = $content; //use this if response is not saved anywhere else use above variable $xml = simplexml_load_String("$hotelDetailRsp", null, null, 'SOAP', true); if(!$xml) { header("Location: http://LocationOfErrorPage/projects/Hotel/error.php"); // Use the location of the error page } $Results = $xml->children('SOAP',true); foreach($Results->children('SOAP',true) as $fault){ if(strcmp($fault->getName(),'Fault') == 0){ //trigger_error("Error occurred request processing!", E_USER_ERROR); header("Location: http://LocationOfErrorPage/projects/Hotel/error.php"); // Use the location of the error page } } foreach($Results->children('flight',true) as $nodes){ foreach($nodes->children('flight',true) as $hsr){ if(strcmp($hsr->getName(),'RequestedHotelDetails') == 0){ foreach($hsr->children('flight',true) as $hp){ if(strcmp($hp->getName(),'FlightProperty') == 0){ foreach($hp->attributes() as $a => $b ){ $GLOBALS[$a] = "$b"; } $COUNT = 0; $Address = 'Address'; foreach($hp->children('flight',true) as $pa){ if(strcmp($pa->getName(),'PropertyAddress') == 0){ foreach($pa->children('flight',true) as $ha){ if(strcmp($ha->getName(),'Address') == 0){ $GLOBALS[$Address.$COUNT++] = $ha[0]; } } } } } } foreach($hsr->children('flight',true) as $hp){ if(strcmp($hp->getName(),'FlightRateDetail') == 0){ foreach($hp->attributes() as $a => $b ){ $GLOBALS[$a] = "$b"; } break; } } } break; } } } //call function to write output in a file // // Official PHP CURL manual; http://php.net/manual/en/book.curl.php // ?>`
imon91 commented 5 years ago

and would you please tell Locator code is PNR number which is required for next step ticketing as AirReservationLocatorCode

vivekjyotipramanik commented 5 years ago

Hi imon91,

you might be getting this error for sending incorrect credentials. I am seeing in the code, the TargetBranch and credentials are blank. Please send proper credentials.

The AirResevationLocatorCode will be generated inside the element as attribute LocatorCode. Thanks.

imon91 commented 5 years ago

Hello vivekjyotipramanik I have send it with right credentials.But but I forgot to send it to you. again I send it to you . and I asked you that LocatorCode is related with PNR number would you tell that please.. Thanks `<?php

$TARGETBRANCH = 'P3018376'; $CREDENTIALS = 'Universal API/uAPI3479047859-dfa41a9b:tL+9P4o_cE'; $PROVIDER ='1G'; // Any provider you want to use like 1G/1P/1V/ACH $PreferredDepDate = date('2019-01-10', strtotime("75 day")); $PreferredRetDate = date('2019-01-24', strtotime("81 day"));

$message = <<<EOM

Bangladesh new palasia indore mp 452001 BD indore new palasia indore Dhaka 121 BD gws-eJxNT10PgjAM/DHk3tsNgb0NGSJGIVGi4cX//zO8bprYpR9pr9dbjNGJBlFp479VwM6H1A/XGQuUXjsvoXGAFzeDDVGDWCAMS5+2pw/avdJ6EzLSXAiQsle22FNUxwnHtGUK+uVxh/Ot5iM7xBM8kfG0ImtzaqglD0u0kyJjM9RMSE2qy8gMe46myAQYbzmKNz9logT4FeOZpQkvmjv2Dt+RtKDMDzraPcQ= MYTRIPANDMORE.COM/BAGGAGEDETAILSQF.BAGG 2P BAGGAGE DISCOUNTS MAY APPLY BASED ON FREQUENT FLYER STATUS/ ONLINE CHECKIN/FORM OF PAYMENT/MILITARY/ETC. BAGGAGE CHARGES DATA NOT AVAILABLE BAGGAGE CHARGES DATA NOT AVAILABLE CARRY ON ALLOWANCE DATA NOT AVAILABLE MYTRIPANDMORE.COM/BAGGAGEDETAILSQF.BAGG EOM; $file = "003-".$PROVIDER."_FlightBookReq.xml"; // file name to save the request xml for test only(if you want to save the request/response) prettyPrint($message,$file); //Calling the Pretty Print function // // Run the request // $auth = base64_encode("$CREDENTIALS"); $soap_do = curl_init("https://americas.universal-api.travelport.com/B2BGateway/connect/uAPI/AirService"); /*("https://americas.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/AirService");*/ $header = array( "Content-Type: text/xml;charset=UTF-8", "Accept-Encoding: gzip,deflate", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: \"\"", "Authorization: Basic $auth", "Content-length: ".strlen($message), ); //curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 30); //curl_setopt($soap_do, CURLOPT_TIMEOUT, 30); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $message); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true); curl_setopt($soap_do, CURLOPT_ENCODING, ''); $return = curl_exec($soap_do); curl_close($soap_do); $file = "001-".$PROVIDER."_LowFareSearchRsp.xml"; // file name to save the response xml for test only(if you want to save the request/response) $content = prettyPrint($return,$file); parseDetailOutput($content); function prettyPrint($result,$file){ $dom = new DOMDocument; $dom->preserveWhiteSpace = false; $dom->loadXML($result); $dom->formatOutput = true; //call function to write request/response in file outputWriter($file,$dom->saveXML()); return $dom->saveXML(); } function outputWriter($file,$content){ file_put_contents($file, $content); // Write request/response and save them in the File } //Parse the previous response to get the values to populate Request xml function parseDetailOutput($content){ //$hotelDetailRsp = file_get_contents('002_HotelDetailRsp.xml'); // Parsing the Hotel Detail Response xml $hotelDetailRsp = $content; //use this if response is not saved anywhere else use above variable $xml = simplexml_load_String("$hotelDetailRsp", null, null, 'SOAP', true); if(!$xml) { header("Location: http://LocationOfErrorPage/projects/Hotel/error.php"); // Use the location of the error page } $Results = $xml->children('SOAP',true); foreach($Results->children('SOAP',true) as $fault){ if(strcmp($fault->getName(),'Fault') == 0){ //trigger_error("Error occurred request processing!", E_USER_ERROR); header("Location: http://LocationOfErrorPage/projects/Hotel/error.php"); // Use the location of the error page } } foreach($Results->children('flight',true) as $nodes){ foreach($nodes->children('flight',true) as $hsr){ if(strcmp($hsr->getName(),'RequestedHotelDetails') == 0){ foreach($hsr->children('flight',true) as $hp){ if(strcmp($hp->getName(),'FlightProperty') == 0){ foreach($hp->attributes() as $a => $b ){ $GLOBALS[$a] = "$b"; } $COUNT = 0; $Address = 'Address'; foreach($hp->children('flight',true) as $pa){ if(strcmp($pa->getName(),'PropertyAddress') == 0){ foreach($pa->children('flight',true) as $ha){ if(strcmp($ha->getName(),'Address') == 0){ $GLOBALS[$Address.$COUNT++] = $ha[0]; } } } } } } foreach($hsr->children('flight',true) as $hp){ if(strcmp($hp->getName(),'FlightRateDetail') == 0){ foreach($hp->attributes() as $a => $b ){ $GLOBALS[$a] = "$b"; } break; } } } break; } } } //call function to write output in a file // // Official PHP CURL manual; http://php.net/manual/en/book.curl.php // ?>`
imon91 commented 5 years ago

Hello vivekjyotipramanik Now I have got this type error thouy my credential is absolutely right. would you check please .this is happening when I run the booking file. thanks capture54