From 7661a3dd90777e4c56168832fb28fb2ff7d2961e Mon Sep 17 00:00:00 2001 From: Jesper Filtenborg <69187219+JesperFiltenborg@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:22:32 +0100 Subject: [PATCH 1/3] fix: transact missing on instant completion --- src/Http/Controllers/OmnipayController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Http/Controllers/OmnipayController.php b/src/Http/Controllers/OmnipayController.php index a67ea4d..9cb468c 100644 --- a/src/Http/Controllers/OmnipayController.php +++ b/src/Http/Controllers/OmnipayController.php @@ -44,6 +44,7 @@ public function purchase(Transaction $transaction) // We assume this means API driven if ($response->isTransparentRedirect()) { if ($response->isSuccessful()) { + $transaction->transaction = $response->getTransactionReference(); $transaction->status = Transaction::STATUS_PURCHASE_COMPLETE; $transaction->save(); } @@ -51,6 +52,7 @@ public function purchase(Transaction $transaction) return response()->json($response->getData()); } if ($response->isSuccessful()) { + $transaction->transaction = $response->getTransactionReference(); return redirect($transaction->redirect_to); } if ($response->isRedirect()) { @@ -163,6 +165,7 @@ public function authorize(Transaction $transaction) // We assume this means API driven if ($response->isTransparentRedirect()) { if ($response->isSuccessful()) { + $transaction->transaction = $response->getTransactionReference(); $transaction->status = Transaction::STATUS_AUTHORIZE_COMPLETE; $transaction->save(); } @@ -170,6 +173,7 @@ public function authorize(Transaction $transaction) return response()->json($response->getData()); } if ($response->isSuccessful()) { + $transaction->transaction = $response->getTransactionReference(); return redirect($transaction->redirect_to); } if ($response->isRedirect()) { @@ -212,6 +216,7 @@ public function completeAuthorize(Transaction $transaction) // We assume this means API driven if ($response->isTransparentRedirect()) { if ($response->isSuccessful()) { + $transaction->transaction = $response->getTransactionReference(); $transaction->status = Transaction::STATUS_AUTHORIZE_COMPLETE; $transaction->save(); } elseif ($response->isCancelled()) { @@ -228,6 +233,7 @@ public function completeAuthorize(Transaction $transaction) return response()->json($response->getData()); } if ($response->isSuccessful()) { + $transaction->transaction = $response->getTransactionReference(); $transaction->status = Transaction::STATUS_AUTHORIZE_COMPLETE; $transaction->save(); return redirect($transaction->redirect_to); @@ -304,6 +310,7 @@ public function capture(Transaction $transaction) ]); if ($response->isSuccessful()) { + $transaction->transaction = $response->getTransactionReference(); $transaction->status = Transaction::STATUS_CAPTURE; $transaction->save(); } else { From acf078829a1848945fa0887d7065cbcf97b4bd9c Mon Sep 17 00:00:00 2001 From: Jesper Filtenborg <69187219+JesperFiltenborg@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:25:56 +0100 Subject: [PATCH 2/3] cleanup --- src/Http/Controllers/OmnipayController.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Http/Controllers/OmnipayController.php b/src/Http/Controllers/OmnipayController.php index 9cb468c..d3ce9bd 100644 --- a/src/Http/Controllers/OmnipayController.php +++ b/src/Http/Controllers/OmnipayController.php @@ -216,7 +216,6 @@ public function completeAuthorize(Transaction $transaction) // We assume this means API driven if ($response->isTransparentRedirect()) { if ($response->isSuccessful()) { - $transaction->transaction = $response->getTransactionReference(); $transaction->status = Transaction::STATUS_AUTHORIZE_COMPLETE; $transaction->save(); } elseif ($response->isCancelled()) { @@ -233,7 +232,6 @@ public function completeAuthorize(Transaction $transaction) return response()->json($response->getData()); } if ($response->isSuccessful()) { - $transaction->transaction = $response->getTransactionReference(); $transaction->status = Transaction::STATUS_AUTHORIZE_COMPLETE; $transaction->save(); return redirect($transaction->redirect_to); From 7af17f87859527fbc1388c93dff4d867a21ee493 Mon Sep 17 00:00:00 2001 From: Jesper Filtenborg <69187219+JesperFiltenborg@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:32:04 +0100 Subject: [PATCH 3/3] cleanup --- src/Http/Controllers/OmnipayController.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Http/Controllers/OmnipayController.php b/src/Http/Controllers/OmnipayController.php index d3ce9bd..014bf27 100644 --- a/src/Http/Controllers/OmnipayController.php +++ b/src/Http/Controllers/OmnipayController.php @@ -52,7 +52,6 @@ public function purchase(Transaction $transaction) return response()->json($response->getData()); } if ($response->isSuccessful()) { - $transaction->transaction = $response->getTransactionReference(); return redirect($transaction->redirect_to); } if ($response->isRedirect()) { @@ -173,7 +172,6 @@ public function authorize(Transaction $transaction) return response()->json($response->getData()); } if ($response->isSuccessful()) { - $transaction->transaction = $response->getTransactionReference(); return redirect($transaction->redirect_to); } if ($response->isRedirect()) {