mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Prevent duplicate token payments
This commit is contained in:
parent
644c905961
commit
20b5f66e3f
@ -102,6 +102,16 @@ class OnlinePaymentController extends BaseController
|
||||
return redirect()->to('view/' . $invitation->invitation_key);
|
||||
}
|
||||
|
||||
// add a delay check for token links
|
||||
if ($gatewayTypeId == GATEWAY_TYPE_TOKEN) {
|
||||
$key = 'payment_token:' . $invitation->invitation_key;
|
||||
if (cache($key)) {
|
||||
return redirect()->to('view/' . $invitation->invitation_key);
|
||||
} else {
|
||||
cache([$key => true], \Carbon::now()->addSeconds(10));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return $paymentDriver->startPurchase(Input::all(), $sourceId);
|
||||
} catch (Exception $exception) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user