Skip to content

Commit

Permalink
fix: Adding a catured state.
Browse files Browse the repository at this point in the history
It is now possible to go to a captured state through the notification
endpoint.
  • Loading branch information
addgod committed Jun 4, 2024
1 parent 5108084 commit 6aa737a
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/Http/Controllers/OmnipayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,15 @@ public function completePurchase(Transaction $transaction)
if ($response->isTransparentRedirect()) {
if ($response->isSuccessful()) {
$transaction->status = Transaction::STATUS_PURCHASE_COMPLETE;
$transaction->save();
} 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();
}

$transaction->save();

return response()->json($response->getData());
}
if ($response->isSuccessful()) {
Expand Down Expand Up @@ -213,18 +210,16 @@ public function completeAuthorize(Transaction $transaction)
if ($response->isTransparentRedirect()) {
if ($response->isSuccessful()) {
$transaction->status = Transaction::STATUS_AUTHORIZE_COMPLETE;
$transaction->save();
} 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();
}

$transaction->save();

return response()->json($response->getData());
}
if ($response->isSuccessful()) {
Expand Down Expand Up @@ -439,13 +434,12 @@ public function notify(Transaction $transaction = null)
}
} elseif ($response->isCancelled()) {
$transaction->status = Transaction::STATUS_VOID;
$transaction->save();
} elseif ($response->isRefunded()) {
} elseif (method_exists($response, 'isCaptured') && $response->isCaptured()) {
$transaction->status = Transaction::STATUS_CAPTURE;
} elseif (method_exists($response, 'isRefunded') && $response->isRefunded()) {
$transaction->status = Transaction::STATUS_REFUND_FULLY;
$transaction->save();
} else {
$transaction->status = Transaction::STATUS_DECLINED;
$transaction->save();
}

$transaction->save();
Expand Down

0 comments on commit 6aa737a

Please sign in to comment.