From 5108084696c8cbf2a74aa355391a13d12aaf74f7 Mon Sep 17 00:00:00 2001 From: Jesper Kold-Hansen Date: Fri, 14 Jul 2023 13:49:17 +0200 Subject: [PATCH] Minor fixes that allowed for better debugging --- src/Http/Controllers/OmnipayController.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Http/Controllers/OmnipayController.php b/src/Http/Controllers/OmnipayController.php index bc412d3..a67ea4d 100644 --- a/src/Http/Controllers/OmnipayController.php +++ b/src/Http/Controllers/OmnipayController.php @@ -35,7 +35,7 @@ public function purchase(Transaction $transaction) $transaction->logs()->create([ 'payload' => [ - 'action' => 'Complete Authorization', + 'action' => 'Purchase', 'message' => $response->getMessage(), 'data' => $response->getData(), ], @@ -99,6 +99,9 @@ public function completePurchase(Transaction $transaction) } elseif ($response->isCancelled()) { $transaction->status = Transaction::STATUS_VOID; $transaction->save(); + } elseif ($response->isPending()) { + $transaction->status = Transaction::STATUS_PURCHASE; + $transaction->save(); } else { $transaction->status = Transaction::STATUS_DECLINED; $transaction->save(); @@ -151,7 +154,7 @@ public function authorize(Transaction $transaction) $transaction->logs()->create([ 'payload' => [ - 'action' => 'Complete Authorization', + 'action' => 'Authorize', 'message' => $response->getMessage(), 'data' => $response->getData(), ], @@ -200,7 +203,7 @@ public function completeAuthorize(Transaction $transaction) $transaction->logs()->create([ 'payload' => [ - 'action' => 'Complete Authorization', + 'action' => 'Complete Authorize', 'message' => $response->getMessage(), 'data' => $response->getData(), ], @@ -214,6 +217,9 @@ public function completeAuthorize(Transaction $transaction) } elseif ($response->isCancelled()) { $transaction->status = Transaction::STATUS_VOID; $transaction->save(); + } elseif ($response->isPending()) { + $transaction->status = Transaction::STATUS_AUTHORIZE; + $transaction->save(); } else { $transaction->status = Transaction::STATUS_DECLINED; $transaction->save();