| @@ 35-71 (lines=37) @@ | ||
| 32 | * @package Amadeus\Client\ResponseHandler\Air |
|
| 33 | * @author Dieter Devlieghere <[email protected]> |
|
| 34 | */ |
|
| 35 | class HandlerFlightInfo extends StandardResponseHandler |
|
| 36 | { |
|
| 37 | /** |
|
| 38 | * @param SendResult $response |
|
| 39 | * @return Result |
|
| 40 | */ |
|
| 41 | public function analyze(SendResult $response) |
|
| 42 | { |
|
| 43 | $analyzeResponse = new Result($response); |
|
| 44 | ||
| 45 | $code = null; |
|
| 46 | $message = null; |
|
| 47 | ||
| 48 | $domXpath = $this->makeDomXpath($response->responseXml); |
|
| 49 | ||
| 50 | $categoryNodes = $domXpath->query('//m:responseError/m:errorInfo/m:errorDetails/m:errorCategory'); |
|
| 51 | if ($categoryNodes->length > 0) { |
|
| 52 | $analyzeResponse->status = $this->makeStatusFromErrorQualifier($categoryNodes->item(0)->nodeValue); |
|
| 53 | } |
|
| 54 | ||
| 55 | $codeNodes = $domXpath->query('//m:responseError/m:errorInfo/m:errorDetails/m:errorCode'); |
|
| 56 | if ($codeNodes->length > 0) { |
|
| 57 | $code = $codeNodes->item(0)->nodeValue; |
|
| 58 | } |
|
| 59 | ||
| 60 | $messageNodes = $domXpath->query('//m:responseError/m:interactiveFreeText/m:freeText'); |
|
| 61 | if ($messageNodes->length > 0) { |
|
| 62 | $message = $this->makeMessageFromMessagesNodeList($messageNodes); |
|
| 63 | } |
|
| 64 | ||
| 65 | if (!is_null($message) && !is_null($code)) { |
|
| 66 | $analyzeResponse->messages[] = new Result\NotOk($code, $message); |
|
| 67 | } |
|
| 68 | ||
| 69 | return $analyzeResponse; |
|
| 70 | } |
|
| 71 | } |
|
| 72 | ||
| @@ 37-76 (lines=40) @@ | ||
| 34 | * @package Amadeus\Client\ResponseHandler\PAY |
|
| 35 | * @author Konstantin Bogomolov <[email protected]> |
|
| 36 | */ |
|
| 37 | class HandlerDeleteVirtualCard extends StandardResponseHandler |
|
| 38 | { |
|
| 39 | /** |
|
| 40 | * Analyze the result from the message operation and check for any error messages |
|
| 41 | * |
|
| 42 | * @param SendResult $response |
|
| 43 | * @return Result |
|
| 44 | * @throws Exception |
|
| 45 | */ |
|
| 46 | public function analyze(SendResult $response) |
|
| 47 | { |
|
| 48 | $analyzeResponse = new Result($response); |
|
| 49 | ||
| 50 | $code = null; |
|
| 51 | $message = null; |
|
| 52 | ||
| 53 | $domXpath = $this->makeDomXpath($response->responseXml); |
|
| 54 | ||
| 55 | $categoryNodes = $domXpath->query('//ama:Errors/ama:Error/@Type'); |
|
| 56 | if ($categoryNodes->length > 0) { |
|
| 57 | $analyzeResponse->status = $this->makeStatusFromErrorQualifier($categoryNodes->item(0)->nodeValue); |
|
| 58 | } |
|
| 59 | ||
| 60 | $codeNodes = $domXpath->query('//ama:Errors/ama:Error/@Code'); |
|
| 61 | if ($codeNodes->length > 0) { |
|
| 62 | $code = $codeNodes->item(0)->nodeValue; |
|
| 63 | } |
|
| 64 | ||
| 65 | $messageNodes = $domXpath->query('//ama:Errors/ama:Error/@ShortText'); |
|
| 66 | if ($messageNodes->length > 0) { |
|
| 67 | $message = $this->makeMessageFromMessagesNodeList($messageNodes); |
|
| 68 | } |
|
| 69 | ||
| 70 | if (!is_null($message) && !is_null($code)) { |
|
| 71 | $analyzeResponse->messages[] = new Result\NotOk($code, $message); |
|
| 72 | } |
|
| 73 | ||
| 74 | return $analyzeResponse; |
|
| 75 | } |
|
| 76 | } |
|
| 77 | ||
| @@ 36-75 (lines=40) @@ | ||
| 33 | * @package Amadeus\Client\ResponseHandler\PAY |
|
| 34 | * @author Konstantin Bogomolov <[email protected]> |
|
| 35 | */ |
|
| 36 | class HandlerGenerateVirtualCard extends AbstractCardDetailsResponseHandler |
|
| 37 | { |
|
| 38 | /** |
|
| 39 | * Analyze the result from the message operation and check for any error messages |
|
| 40 | * |
|
| 41 | * @param SendResult $response |
|
| 42 | * @return Result |
|
| 43 | * @throws Exception |
|
| 44 | */ |
|
| 45 | public function analyze(SendResult $response) |
|
| 46 | { |
|
| 47 | $analyzeResponse = new Result($response); |
|
| 48 | ||
| 49 | $code = null; |
|
| 50 | $message = null; |
|
| 51 | ||
| 52 | $domXpath = $this->makeDomXpath($response->responseXml); |
|
| 53 | ||
| 54 | $categoryNodes = $domXpath->query('//ama:Errors/ama:Error/@Type'); |
|
| 55 | if ($categoryNodes->length > 0) { |
|
| 56 | $analyzeResponse->status = $this->makeStatusFromErrorQualifier($categoryNodes->item(0)->nodeValue); |
|
| 57 | } |
|
| 58 | ||
| 59 | $codeNodes = $domXpath->query('//ama:Errors/ama:Error/@Code'); |
|
| 60 | if ($codeNodes->length > 0) { |
|
| 61 | $code = $codeNodes->item(0)->nodeValue; |
|
| 62 | } |
|
| 63 | ||
| 64 | $messageNodes = $domXpath->query('//ama:Errors/ama:Error/@ShortText'); |
|
| 65 | if ($messageNodes->length > 0) { |
|
| 66 | $message = $this->makeMessageFromMessagesNodeList($messageNodes); |
|
| 67 | } |
|
| 68 | ||
| 69 | if (!is_null($message) && !is_null($code)) { |
|
| 70 | $analyzeResponse->messages[] = new Result\NotOk($code, $message); |
|
| 71 | } |
|
| 72 | ||
| 73 | return $this->fillCardDetails($analyzeResponse, $domXpath); |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||
| @@ 36-76 (lines=41) @@ | ||
| 33 | * @package Amadeus\Client\ResponseHandler\PAY |
|
| 34 | * @author Konstantin Bogomolov <[email protected]> |
|
| 35 | */ |
|
| 36 | class HandlerGetVirtualCardDetails extends AbstractCardDetailsResponseHandler |
|
| 37 | { |
|
| 38 | /** |
|
| 39 | * Analyze the result from the message operation and check for any error messages |
|
| 40 | * |
|
| 41 | * @param SendResult $response |
|
| 42 | * @return Result |
|
| 43 | * @throws Exception |
|
| 44 | */ |
|
| 45 | public function analyze(SendResult $response) |
|
| 46 | { |
|
| 47 | $analyzeResponse = new Result($response); |
|
| 48 | ||
| 49 | $code = null; |
|
| 50 | $message = null; |
|
| 51 | ||
| 52 | $domXpath = $this->makeDomXpath($response->responseXml); |
|
| 53 | ||
| 54 | $categoryNodes = $domXpath->query('//ama_ct:Errors/ama_ct:Error/@Type'); |
|
| 55 | if ($categoryNodes->length > 0) { |
|
| 56 | $analyzeResponse->status = $this->makeStatusFromErrorQualifier($categoryNodes->item(0)->nodeValue); |
|
| 57 | } |
|
| 58 | ||
| 59 | $codeNodes = $domXpath->query('//ama_ct:Errors/ama_ct:Error/@Code'); |
|
| 60 | if ($codeNodes->length > 0) { |
|
| 61 | $code = $codeNodes->item(0)->nodeValue; |
|
| 62 | } |
|
| 63 | ||
| 64 | $messageNodes = $domXpath->query('//ama_ct:Errors/ama_ct:Error/@ShortText'); |
|
| 65 | if ($messageNodes->length > 0) { |
|
| 66 | $message = $this->makeMessageFromMessagesNodeList($messageNodes); |
|
| 67 | } |
|
| 68 | ||
| 69 | if (!is_null($message) && !is_null($code)) { |
|
| 70 | $analyzeResponse->messages[] = new Result\NotOk($code, $message); |
|
| 71 | return $analyzeResponse; |
|
| 72 | } |
|
| 73 | ||
| 74 | return $this->fillCardDetails($analyzeResponse, $domXpath); |
|
| 75 | } |
|
| 76 | } |
|
| 77 | ||
| @@ 37-76 (lines=40) @@ | ||
| 34 | * @package Amadeus\Client\ResponseHandler\PAY |
|
| 35 | * @author Konstantin Bogomolov <[email protected]> |
|
| 36 | */ |
|
| 37 | class HandlerListVirtualCards extends StandardResponseHandler |
|
| 38 | { |
|
| 39 | /** |
|
| 40 | * Analyze the result from the message operation and check for any error messages |
|
| 41 | * |
|
| 42 | * @param SendResult $response |
|
| 43 | * @return Result |
|
| 44 | * @throws Exception |
|
| 45 | */ |
|
| 46 | public function analyze(SendResult $response) |
|
| 47 | { |
|
| 48 | $analyzeResponse = new Result($response); |
|
| 49 | ||
| 50 | $code = null; |
|
| 51 | $message = null; |
|
| 52 | ||
| 53 | $domXpath = $this->makeDomXpath($response->responseXml); |
|
| 54 | ||
| 55 | $categoryNodes = $domXpath->query('//ama_ct:Errors/ama_ct:Error/@Type'); |
|
| 56 | if ($categoryNodes->length > 0) { |
|
| 57 | $analyzeResponse->status = $this->makeStatusFromErrorQualifier($categoryNodes->item(0)->nodeValue); |
|
| 58 | } |
|
| 59 | ||
| 60 | $codeNodes = $domXpath->query('//ama_ct:Errors/ama_ct:Error/@Code'); |
|
| 61 | if ($codeNodes->length > 0) { |
|
| 62 | $code = $codeNodes->item(0)->nodeValue; |
|
| 63 | } |
|
| 64 | ||
| 65 | $messageNodes = $domXpath->query('//ama_ct:Errors/ama_ct:Error/@ShortText'); |
|
| 66 | if ($messageNodes->length > 0) { |
|
| 67 | $message = $this->makeMessageFromMessagesNodeList($messageNodes); |
|
| 68 | } |
|
| 69 | ||
| 70 | if (!is_null($message) && !is_null($code)) { |
|
| 71 | $analyzeResponse->messages[] = new Result\NotOk($code, $message); |
|
| 72 | } |
|
| 73 | ||
| 74 | return $analyzeResponse; |
|
| 75 | } |
|
| 76 | } |
|
| 77 | ||