Hello,
I'm opening this issue because we faced an issue on our installation using the module for oney payment.
The order is changed to processing while it's supposed to be in payment_review status while the file is pending on Oney side.
After one response of your support team, I dug deeper in the module code to understand if the mistake is in our configuration or in the module.
Here is the documentation linked to us : https://payzen.io/fr-FR/payment-method/3x_4x_Oney/redirection-form/traiter-les-donnees-de-la-reponse.html
Here is the response from the support member :
Nous pensons que votre problématique est liée à une mauvaise interprétation du mail envoyé au client.
Lors de notre appel à l'IPN nous avons indiqué dans un premier temps que la transaction était avec le statut Waiting_authorization. Puis une fois qu'Oney nous a envoyé le résultat final nous avons appelé une 2eme fois l'IPN pour informer votre système.
Following the documentation and response, I was expecting to find some string containing "Waiting_authorization" in the module but none is present.
I search in the documentation and status to find this :
https://payzen.io/fr-FR/payment-method/cb/redirection-form/traiter-les-donnees-de-la-reponse.html
So for some reason :
In the Oney API response :
In the CB API response :
I'm not sure which one is a typo or if this is the expected behaviour but having this, the module helper API function are not working :
// In https://github.com/lyra/plugin-magento/blob/master/Model/Api/Form/Api.php
[...]
public static function getPendingStatuses()
{
return array(
'INITIAL',
'WAITING_AUTHORISATION',
'WAITING_AUTHORISATION_TO_VALIDATE',
// Maybe we should add this ?
'WAITING_AUTHORIZATION',
// Maybe we should add some more ?
'UNDER_VERIFICATION',
'PRE_AUTHORISED',
'WAITING_FOR_PAYMENT',
'AUTHORISED_TO_VALIDATE',
'SUSPENDED',
'PENDING',
'REFUND_TO_RETRY'
);
}
[...]
I don't know the full set of status which are returns by your API but it seems that according to this helper code, following the "else" we end up having a status to processing according to the "registered_order_status" configuration field (Which is annotated as : Status of orders when payment is successfull.")
// In https://github.com/lyra/plugin-magento/blob/master/Helper/Payment.php
[...]
public function nextOrderState(
\Magento\Sales\Model\Order $order,
\Lyranetwork\Payzen\Model\Api\Form\Response $response,
$ignoreFraud = false
) {
// =========> Status is not to validate as it's not in the list
if ($response->isToValidatePayment()) {
$newStatus = 'payzen_to_validate';
$newState = \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW;
// =========> Status is not to pending as it's not in the list
} elseif ($response->isPendingPayment()) {
$newStatus = 'payment_review';
$newState = \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW;
} else {
// =========> This is not a SEPA response
if ($this->isSepa($response)) {
// Pending funds transfer order state.
$newStatus = 'payzen_pending_transfer';
} else {
// =========> Here we are with a success status but an API response code as "WAITING_AUTHORIZATION"
$newStatus = $this->dataHelper->getCommonConfigData(
'registered_order_status',
$order->getStore()->getId()
);
}
$processingStatuses = $this->orderConfig->getStateStatuses(
\Magento\Sales\Model\Order::STATE_PROCESSING,
false
);
$newState = in_array($newStatus, $processingStatuses) ? \Magento\Sales\Model\Order::STATE_PROCESSING :
\Magento\Sales\Model\Order::STATE_NEW;
}
$stateObject = $this->dataObjectFactory->create();
if (! $ignoreFraud && $response->isSuspectedFraud()) {
$stateObject->setBeforeState($newState);
$stateObject->setBeforeStatus($newStatus);
$newState = \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW;
$newStatus = 'fraud';
}
$stateObject->setState($newState);
$stateObject->setStatus($newStatus);
return $stateObject;
}
[...]
I'll open a PR for the suitable change, feel free to merge it if my understanding of the module is correct.
Kind Regards,
Baptiste
Hello,
I'm opening this issue because we faced an issue on our installation using the module for oney payment.
The order is changed to processing while it's supposed to be in payment_review status while the file is pending on Oney side.
After one response of your support team, I dug deeper in the module code to understand if the mistake is in our configuration or in the module.
Here is the documentation linked to us : https://payzen.io/fr-FR/payment-method/3x_4x_Oney/redirection-form/traiter-les-donnees-de-la-reponse.html
Here is the response from the support member :
Following the documentation and response, I was expecting to find some string containing "Waiting_authorization" in the module but none is present.
I search in the documentation and status to find this :
https://payzen.io/fr-FR/payment-method/cb/redirection-form/traiter-les-donnees-de-la-reponse.html
So for some reason :
In the Oney API response :
In the CB API response :
I'm not sure which one is a typo or if this is the expected behaviour but having this, the module helper API function are not working :
I don't know the full set of status which are returns by your API but it seems that according to this helper code, following the "else" we end up having a status to processing according to the "registered_order_status" configuration field (Which is annotated as : Status of orders when payment is successfull.")
I'll open a PR for the suitable change, feel free to merge it if my understanding of the module is correct.
Kind Regards,
Baptiste