Commit c3f3fb0b by Yvon

authorized vs authorised : fix code, add debug code and comment

parent 38241d8e
......@@ -200,6 +200,9 @@ class PaymentController extends AbstractController
* Voie 3 : le traitement de la requête se fait finalement simplement dans notifyRecurringPaymentAction sans utiliser
* les mécanismes complexes de Payum.
*
* Pour d'autres problèmes avec Payum, voir aussi les commentaires liés à
* l'utilisation de GetHumanStatus::STATUS_AUTHORIZED.
*
* Yvon KERDONCUFF
* 26/03/2024
*/
......@@ -240,15 +243,14 @@ class PaymentController extends AbstractController
&& array_key_exists('vads_identifier', $payment->getDetails())
&& $payment->getDetails()['vads_identifier'] == $vads_identifier
) {
if (
GetHumanStatus::STATUS_CAPTURED == $new_status
|| GetHumanStatus::STATUS_AUTHORIZED == $new_status
) {
// Do not use GetHumanStatus Payum constants as they do not match Payzen vads_trans_status
// e.g. GetHumanStatus::STATUS_AUTHORIZED does not match 'authorised' value sent by Payzen
if ('captured' == $new_status || 'authorised' == $new_status) {
$this->paymentUtils->handlePayzenNotificationCore($payment);
$this->em->flush();
}
return new Response('Recurring payment occurence taken into account.', 200);
//for debug purpose, display vads_trans_status in payzen backoffice
return new Response('Recurring payment occurence taken into account. vads_trans_status = ' . $new_status, 200);
}
}
//return error
......@@ -281,6 +283,17 @@ class PaymentController extends AbstractController
}
// Set flash message according to payment status
/* WARNING : THIS PIECE OF CODE IS USING INAPPROPRIATE GetHumanStatus::STATUS_AUTHORIZED :
*
* This is (another) issue here with Payum.
* current_payment_status will never match STATUS_AUTHORIZED
* on the opposite, we have no chance to detect 'authorised' value here
* because Payzen vads_trans_status is written 'authorised' and not 'authorized'
* However this code seems to work and I don't want to break it as this is Payum dependent
* and uses mechanisms I don't understand.
*
* @see comment above notifyRecurringPaymentAction for more Payum weird stuff
*/
if (GetHumanStatus::STATUS_CAPTURED == $payment->getStatus() || GetHumanStatus::STATUS_AUTHORIZED == $payment->getStatus()) {
$type = $payment->getDescription();
......
......@@ -84,6 +84,17 @@ class PaymentStatusExtension implements ExtensionInterface
$current_payment_status = $payment->getStatus();
$new_status = $status->getValue();
/* WARNING : THIS PIECE OF CODE IS USING INAPPROPRIATE GetHumanStatus::STATUS_AUTHORIZED :
*
* This is (another) issue here with Payum.
* current_payment_status will never match STATUS_AUTHORIZED
* on the opposite, we have no chance to detect 'authorised' value here
* because Payzen vads_trans_status is written 'authorised' and not 'authorized'
* However this code seems to work and I don't want to break it as this is Payum dependent
* and uses mechanisms I don't understand.
*
* @see comment above notifyRecurringPaymentAction for more Payum weird stuff
*/
if (
GetHumanStatus::STATUS_CAPTURED !== $current_payment_status
&& GetHumanStatus::STATUS_AUTHORIZED != $current_payment_status
......
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