Skip to content

Commit

Permalink
Abort payment attempt when the order is already paid
Browse files Browse the repository at this point in the history
  • Loading branch information
michielgerritsen committed Jul 11, 2024
1 parent 931127b commit 5b0cbbd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Model/Client/Payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Mollie\Api\MollieApiClient;
use Mollie\Api\Resources\Payment as MolliePayment;
use Mollie\Api\Types\PaymentStatus;
use Mollie\Payment\Exceptions\PaymentAborted;
use Mollie\Payment\Helper\General as MollieHelper;
use Mollie\Payment\Model\Client\Payments\ProcessTransaction;
use Mollie\Payment\Service\Mollie\DashboardUrl;
Expand Down Expand Up @@ -552,6 +553,10 @@ private function getCheckoutUrl(MollieApiClient $mollieApi, ?string $transaction
}

$payment = $mollieApi->payments->get($transactionId);
if ($payment->status == 'paid') {
throw new PaymentAborted(__('This order already has been paid.'));
}

return $payment->getCheckoutUrl();
}
}

0 comments on commit 5b0cbbd

Please sign in to comment.