diff --git a/src/Message/Response.php b/src/Message/Response.php index 24c017d..87b4b5f 100644 --- a/src/Message/Response.php +++ b/src/Message/Response.php @@ -14,6 +14,7 @@ class Response extends AbstractResponse private $cardReference; private $message; private $responsexml; /* Response XML from Gateway */ + private $details; /** @@ -28,7 +29,7 @@ public function __construct($request, $data) $this->response = $data; $this->processResponse($this->response); } - + /** * * Process the response @@ -141,4 +142,17 @@ public function getCardReference() ? $this->cardReference : null; } + /** + * + * Return the transaction details as (array) from the gateway + * + * @returns array $this->responsexml + */ + public function getDetailsArray() + { + + return isset($this->responsexml) + ? $this->responsexml + : null; + } } diff --git a/tests/Message/ResponseTest.php b/tests/Message/ResponseTest.php index 2d409c2..f76e89b 100644 --- a/tests/Message/ResponseTest.php +++ b/tests/Message/ResponseTest.php @@ -38,6 +38,8 @@ public function testPurchaseSuccess() $this->assertTrue($response->isSuccessful()); $this->assertEquals('P1511W0005042864', $response->getTransactionId()); $this->assertEquals('Transaction Successful', $response->getMessage()); + $txnDetails = $response->getDetailsArray(); + $this->assertEquals('Transaction Successful', $txnDetails['Message']); } public function testPurchaseByTokenSuccess()