Prevent duplicate token payments

This commit is contained in:
Hillel Coren 2018-04-17 12:56:35 +03:00
parent 644c905961
commit 20b5f66e3f

View File

@ -102,6 +102,16 @@ class OnlinePaymentController extends BaseController
return redirect()->to('view/' . $invitation->invitation_key); 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 { try {
return $paymentDriver->startPurchase(Input::all(), $sourceId); return $paymentDriver->startPurchase(Input::all(), $sourceId);
} catch (Exception $exception) { } catch (Exception $exception) {