Skip to content

Commit

Permalink
Added getDetailsArray() to return the response XML as array
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Guise committed Dec 1, 2015
1 parent 41ace1c commit 82e0a83
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Message/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Response extends AbstractResponse
private $cardReference;
private $message;
private $responsexml; /* Response XML from Gateway */
private $details;


/**
Expand All @@ -28,7 +29,7 @@ public function __construct($request, $data)
$this->response = $data;
$this->processResponse($this->response);
}

/**
*
* Process the response
Expand Down Expand Up @@ -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;
}
}
2 changes: 2 additions & 0 deletions tests/Message/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 82e0a83

Please sign in to comment.