Commit 8414ff8a by Damien Moulard

slightly chang fix & add fix elsewhere

parent d12c269d
......@@ -243,9 +243,9 @@ class PaymentController extends AbstractController
&& array_key_exists('vads_identifier', $payment->getDetails())
&& $payment->getDetails()['vads_identifier'] == $vads_identifier
) {
// Do not use GetHumanStatus Payum constants as they do not match Payzen vads_trans_status
// Payum GetHumanStatus constants don't match Payzen vads_trans_status here
// e.g. GetHumanStatus::STATUS_AUTHORIZED does not match 'authorised' value sent by Payzen
if ('captured' == $new_status || 'authorised' == $new_status) {
if (in_array($new_status, ['captured', 'authorised', GetHumanStatus::STATUS_CAPTURED, GetHumanStatus::STATUS_AUTHORIZED])) {
$this->paymentUtils->handlePayzenNotificationCore($payment);
$this->em->flush();
}
......@@ -289,12 +289,10 @@ class PaymentController extends AbstractController
* 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()) {
if (in_array($payment->getStatus(), ['captured', 'authorised', GetHumanStatus::STATUS_CAPTURED, GetHumanStatus::STATUS_AUTHORIZED])) {
$type = $payment->getDescription();
if (Payment::TYPE_ACHAT_MONNAIE_ADHERENT == $type || Payment::TYPE_ACHAT_MONNAIE_PRESTA == $type) {
......
......@@ -90,19 +90,11 @@ class PaymentStatusExtension implements ExtensionInterface
* 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
) {
if (
GetHumanStatus::STATUS_CAPTURED == $new_status
|| GetHumanStatus::STATUS_AUTHORIZED == $new_status
) {
if (!in_array($current_payment_status, ['captured', 'authorised', GetHumanStatus::STATUS_CAPTURED, GetHumanStatus::STATUS_AUTHORIZED])) {
if (in_array($new_status, ['captured', 'authorised', GetHumanStatus::STATUS_CAPTURED, GetHumanStatus::STATUS_AUTHORIZED]) ) {
$this->paymentUtils->handlePayzenNotificationCore($payment);
// Invalidate (delete) notify token after payment is captured
$this->em->remove($token);
......
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