Skip to content

Commit

Permalink
Adding a getOutcome method to omnipay-stripe
Browse files Browse the repository at this point in the history
  • Loading branch information
phpguru committed Jun 13, 2018
1 parent 9241dc4 commit 946b585
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Message/Response.php
Original file line number Diff line number Diff line change
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 946b585

Please sign in to comment.