From 946b585a8019f9af12feb71820f2672a362e2ce6 Mon Sep 17 00:00:00 2001 From: Geoffrey Hoffman Date: Wed, 13 Jun 2018 07:37:54 -0700 Subject: [PATCH] Adding a getOutcome method to omnipay-stripe --- src/Message/Response.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Message/Response.php b/src/Message/Response.php index 28ec80d1..a94e1e71 100644 --- a/src/Message/Response.php +++ b/src/Message/Response.php @@ -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. *