Commit de69d0fa by Yvon

prevent multiple flux creation on user redirection to payment/done after recurring payment creation

parent ad6e0143
...@@ -227,13 +227,16 @@ class PaymentController extends AbstractController ...@@ -227,13 +227,16 @@ class PaymentController extends AbstractController
//so we should not be handling recurring payment after the initial payement. //so we should not be handling recurring payment after the initial payement.
//We must indeed prevent a user from a browser reload e.g. //We must indeed prevent a user from a browser reload e.g.
if (GetHumanStatus::STATUS_NEW == $payment->getStatus()) { if ($payment->getIsRecurrent()) {
// No notification arrived at this point : execute Notify action //Because we take into account all incoming notifications for recurring payments,
// Recurring payment should not trigger notify action here except on initial payment //neither successive recurring payment occurences nor initial recurring payment should be
// as only Payzen agent is allowed to trigger occurences after the first one //handled by this controler as it will lead to duplicates.
//so...
//- do not execute notify
//- do not invalidate token
} elseif (GetHumanStatus::STATUS_NEW == $payment->getStatus()) {
// First time we receive notification for this payment : execute Notify action and invalidate token
$gateway->execute(new Notify($token)); $gateway->execute(new Notify($token));
} elseif (!$payment->getIsRecurrent()) {
// Invalidate token, except if payment is recurrent
$this->payum->getHttpRequestVerifier()->invalidate($token); $this->payum->getHttpRequestVerifier()->invalidate($token);
} else { } else {
//maybe user is trying to trigger another occurence of a recurring payment //maybe user is trying to trigger another occurence of a recurring payment
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment