| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * amadeus-ws-client | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * Copyright 2015 Amadeus Benelux NV | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * you may not use this file except in compliance with the License. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * You may obtain a copy of the License at | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * http://www.apache.org/licenses/LICENSE-2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * Unless required by applicable law or agreed to in writing, software | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * distributed under the License is distributed on an "AS IS" BASIS, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * See the License for the specific language governing permissions and | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * limitations under the License. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * @package Amadeus | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * @license https://opensource.org/licenses/Apache-2.0 Apache 2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | namespace Amadeus\Client\Struct\Pnr; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | use Amadeus\Client\RequestOptions\PnrRetrieveOptions; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | use Amadeus\Client\Struct\BaseWsMessage; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  * Structure class for representing the PNR_Retrieve request message | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  * @package Amadeus\Client\Struct\Pnr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  * @author Dieter Devlieghere <[email protected]> | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 33 |  |  |  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  | class Retrieve extends BaseWsMessage | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |     const RETR_TYPE_BY_RECLOC = 2; | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |     const RETR_TYPE_ACTIVE_PNR = 1; | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |     const RETR_TYPE_FROM_LIST = 25; | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |     const RETR_TYPE_BY_OFFICE_AND_NAME = 3; | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |     const RETR_TYPE_BY_SERVICE_AND_NAME = 4; | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |     const RETR_TYPE_BY_FREQUENT_TRAVELLER = 5; | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |     const RETR_TYPE_BY_ACCOUNT_NUMBER = 6; | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |     const RETR_TYPE_BY_CUSTOMER_PROFILE = 7; | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |     const RETR_TYPE_BY_INSURANCE_POLICY_NUMBER = 8; | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |     const RETR_TYPE_BY_NUMERIC_RECORD_LOCATOR = 9; | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |     const RETR_TYPE_FOR_TICKETING = 95; | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |      | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |      * @var Retrieve\Settings | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |     public $settings; | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 54 |  |  |      * @var Retrieve\RetrievalFacts | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |     public $retrievalFacts; | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |      | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |      * Construct PNR_Retrieve message | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |      * @param PnrRetrieveOptions $options | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 | 115 |  |     public function __construct($options) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         // Determine retrieval type depending on which options were provided. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         // Also, maintain backwards compatibility with how this message previously worked: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         // Warning, this won't work when combining options. In that case you'll get a soapfault from Amadeus. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 | 115 |  |         if (is_null($options->retrievalType)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 | 115 |  |             if (!empty($options->recordLocator)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 | 70 |  |                 $options->retrievalType = self::RETR_TYPE_BY_RECLOC; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 | 73 |  |             } elseif (!empty($options->customerProfile)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 | 5 |  |                 $options->retrievalType = self::RETR_TYPE_BY_CUSTOMER_PROFILE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 | 42 |  |             } elseif (!empty($options->accountNumber)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 | 5 |  |                 $options->retrievalType = self::RETR_TYPE_BY_ACCOUNT_NUMBER; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 | 37 |  |             } elseif (!empty($options->frequentTraveller)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 | 5 |  |                 $options->retrievalType = self::RETR_TYPE_BY_FREQUENT_TRAVELLER; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 | 32 |  |             } elseif ($this->checkAnyNotEmpty($options->service)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 | 5 |  |                 $options->retrievalType = self::RETR_TYPE_BY_SERVICE_AND_NAME; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 | 27 |  |             } elseif ($this->checkAnyNotEmpty($options->lastName, $options->officeId)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 | 12 |  |                 $options->retrievalType = self::RETR_TYPE_BY_OFFICE_AND_NAME; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 | 19 |  |             } elseif (!$options->recordLocator) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 | 15 |  |                 $options->retrievalType = self::RETR_TYPE_ACTIVE_PNR; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 | 6 |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 | 46 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 88 | 115 |  |         $this->retrievalFacts = new Retrieve\RetrievalFacts($options); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 | 115 |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 90 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 91 |  |  |  |