Skip to content

Commit

Permalink
Remove else from Driver::transaction (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor authored Sep 10, 2020
1 parent 9f2a366 commit 10fcef6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Gateway/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,13 @@ public function transaction(Order $order, string $type = 'payment', float $amoun
{
if (! in_array($type, ['payment', 'refund'])) {
throw new InvalidArgumentException('The transaction type must be "payment" or "refund".');
} elseif ($type === 'payment' && $order->paid()) {
}

if ($type === 'payment' && $order->paid()) {
throw new TransactionFailedException("The order #{$order->id} is fully paid.");
} elseif ($type === 'refund' && $order->refunded()) {
}

if ($type === 'refund' && $order->refunded()) {
throw new TransactionFailedException("The order #{$order->id} is fully refunded.");
}

Expand Down

0 comments on commit 10fcef6

Please sign in to comment.