| @@ 35-70 (lines=36) @@ | ||
| 32 | * @package Amadeus\Client\ResponseHandler\Service |
|
| 33 | * @author Mike Hernas <[email protected]> |
|
| 34 | */ |
|
| 35 | class HandlerBookPriceService 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 | $domXpath = $this->makeDomXpath($response->responseXml); |
|
| 45 | ||
| 46 | $errorCodeNodeList = $domXpath->query("//ama:Error"); |
|
| 47 | ||
| 48 | if ($errorCodeNodeList->length > 0) { |
|
| 49 | $analyzeResponse->status = Result::STATUS_ERROR; |
|
| 50 | ||
| 51 | foreach (iterator_to_array($errorCodeNodeList) as $msg) { |
|
| 52 | $analyzeResponse->messages[] = new Result\NotOk( |
|
| 53 | $msg->getAttribute('Code'), |
|
| 54 | trim($msg->getAttribute('ShortText')) |
|
| 55 | ); |
|
| 56 | } |
|
| 57 | ||
| 58 | return $analyzeResponse; |
|
| 59 | } |
|
| 60 | ||
| 61 | $success = $domXpath->query('//m:Success'); |
|
| 62 | if ($success->length > 0) { |
|
| 63 | $analyzeResponse->status = Result::STATUS_OK; |
|
| 64 | return $analyzeResponse; |
|
| 65 | } |
|
| 66 | ||
| 67 | $analyzeResponse->status = Result::STATUS_UNKNOWN; |
|
| 68 | return $analyzeResponse; |
|
| 69 | } |
|
| 70 | } |
|
| 71 | ||
| @@ 35-68 (lines=34) @@ | ||
| 32 | * @package Amadeus\Client\ResponseHandler\Ticket |
|
| 33 | * @author Mike Hernas <[email protected]> |
|
| 34 | */ |
|
| 35 | class HandlerIgnoreRefund 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 | $domXpath = $this->makeDomXpath($response->responseXml); |
|
| 45 | ||
| 46 | $errorCodeNodeList = $domXpath->query("//ama:Errors"); |
|
| 47 | ||
| 48 | if ($errorCodeNodeList->length > 0) { |
|
| 49 | $analyzeResponse->status = Result::STATUS_ERROR; |
|
| 50 | ||
| 51 | $errorCatNode = $errorCodeNodeList->item(0); |
|
| 52 | foreach (iterator_to_array($errorCodeNodeList) as $msg) { |
|
| 53 | $analyzeResponse->messages[] = trim($msg->nodeValue); |
|
| 54 | } |
|
| 55 | ||
| 56 | return $analyzeResponse; |
|
| 57 | } |
|
| 58 | ||
| 59 | $success = $domXpath->query('//m:Success'); |
|
| 60 | if ($success->length > 0) { |
|
| 61 | $analyzeResponse->status = Result::STATUS_OK; |
|
| 62 | return $analyzeResponse; |
|
| 63 | } |
|
| 64 | ||
| 65 | $analyzeResponse->status = Result::STATUS_UNKNOWN; |
|
| 66 | return $analyzeResponse; |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||
| @@ 35-68 (lines=34) @@ | ||
| 32 | * @package Amadeus\Client\ResponseHandler\Ticket |
|
| 33 | * @author Mike Hernas <[email protected]> |
|
| 34 | */ |
|
| 35 | class HandlerInitRefund 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 | $domXpath = $this->makeDomXpath($response->responseXml); |
|
| 45 | ||
| 46 | $errorCodeNodeList = $domXpath->query("//ama:Errors"); |
|
| 47 | ||
| 48 | if ($errorCodeNodeList->length > 0) { |
|
| 49 | $analyzeResponse->status = Result::STATUS_ERROR; |
|
| 50 | ||
| 51 | $errorCatNode = $errorCodeNodeList->item(0); |
|
| 52 | foreach (iterator_to_array($errorCodeNodeList) as $msg) { |
|
| 53 | $analyzeResponse->messages[] = trim($msg->nodeValue); |
|
| 54 | } |
|
| 55 | ||
| 56 | return $analyzeResponse; |
|
| 57 | } |
|
| 58 | ||
| 59 | $success = $domXpath->query('//m:GeneralReply//m:Success'); |
|
| 60 | if ($success->length > 0) { |
|
| 61 | $analyzeResponse->status = Result::STATUS_OK; |
|
| 62 | return $analyzeResponse; |
|
| 63 | } |
|
| 64 | ||
| 65 | $analyzeResponse->status = Result::STATUS_UNKNOWN; |
|
| 66 | return $analyzeResponse; |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||
| @@ 35-68 (lines=34) @@ | ||
| 32 | * @package Amadeus\Client\ResponseHandler\Ticket |
|
| 33 | * @author Mike Hernas <[email protected]> |
|
| 34 | */ |
|
| 35 | class HandlerProcessRefund 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 | $domXpath = $this->makeDomXpath($response->responseXml); |
|
| 45 | ||
| 46 | $errorCodeNodeList = $domXpath->query("//ama:Errors"); |
|
| 47 | ||
| 48 | if ($errorCodeNodeList->length > 0) { |
|
| 49 | $analyzeResponse->status = Result::STATUS_ERROR; |
|
| 50 | ||
| 51 | $errorCatNode = $errorCodeNodeList->item(0); |
|
| 52 | foreach (iterator_to_array($errorCodeNodeList) as $msg) { |
|
| 53 | $analyzeResponse->messages[] = trim($msg->nodeValue); |
|
| 54 | } |
|
| 55 | ||
| 56 | return $analyzeResponse; |
|
| 57 | } |
|
| 58 | ||
| 59 | $success = $domXpath->query('//m:GeneralReply//m:Success'); |
|
| 60 | if ($success->length > 0) { |
|
| 61 | $analyzeResponse->status = Result::STATUS_OK; |
|
| 62 | return $analyzeResponse; |
|
| 63 | } |
|
| 64 | ||
| 65 | $analyzeResponse->status = Result::STATUS_UNKNOWN; |
|
| 66 | return $analyzeResponse; |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||