Skip to content

Commit

Permalink
Merge pull request #107 from phpguru/issue/106-outcome-details
Browse files Browse the repository at this point in the history
Adding a getOutcome method to Message\Response to solve Issue 106
  • Loading branch information
barryvdh committed Jun 13, 2018
2 parents 9241dc4 + 946b585 commit 769d8ab
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Message/Response.php
Expand Up @@ -55,13 +55,29 @@ public function isSuccessful()
*/
public function getChargeReference()
{
if (isset($this->data['object']) && $this->data['object'] == 'charge') {
if (isset($this->data['object']) && 'charge' === $this->data['object']) {
return $this->data['id'];
}

return null;
}

/**
* Get the outcome of a charge from the response
*
* @return array|null
*/
public function getOutcome()
{
if (isset($this->data['object']) && 'charge' === $this->data['object']) {
if (isset($this->data['outcome']) && !empty($this->data['outcome'])) {
return $this->data['outcome'];
}
}

return null;
}

/**
* Get the transaction reference.
*
Expand Down

0 comments on commit 769d8ab

Please sign in to comment.