From 28b7d2458ead0b66a28192f40c1d9ae0c9444f20 Mon Sep 17 00:00:00 2001 From: Steffen Brem Date: Thu, 6 Oct 2016 17:15:22 +0200 Subject: [PATCH] * Reference isn't needed, since it will already be known. * Add `fetchTransaction` requirement to supports. --- src/Action/NotifyAction.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Action/NotifyAction.php b/src/Action/NotifyAction.php index 9df03c9..c194d7c 100644 --- a/src/Action/NotifyAction.php +++ b/src/Action/NotifyAction.php @@ -27,13 +27,8 @@ public function execute($request) $response = $this->omnipayGateway->fetchTransaction($details->toUnsafeArray())->send(); - $data = $response->getData(); + $details->replace((array)$response->getData()); - if (is_array($data)) { - $details->replace($data); - } - - $details['_reference'] = $response->getTransactionReference(); $details['_status'] = $response->isSuccessful() ? 'captured' : 'failed'; $details['_status_code'] = $response->getCode(); $details['_status_message'] = $response->isSuccessful() ? '' : $response->getMessage(); @@ -48,7 +43,8 @@ public function supports($request) { return $request instanceof Notify && - $request->getModel() instanceof \ArrayAccess + $request->getModel() instanceof \ArrayAccess && + method_exists($this->omnipayGateway, 'fetchTransaction') ; } }