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();