Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payment refused order coming with no status #2452

Open
sushantjw opened this issue Jan 19, 2024 · 9 comments
Open

Payment refused order coming with no status #2452

sushantjw opened this issue Jan 19, 2024 · 9 comments
Assignees
Labels
Bug report Indicates that issue has been marked as a possible bug

Comments

@sushantjw
Copy link

Describe the bug
When the payment is refused for the order the order does not get any cancellation request and stays with null status.

To Reproduce

  1. Place an order and checkout with an unsupported card.

Expected behavior
Get a cancellation request if the order is not further proceeded.

Magento version
2.4.6-p3

Plugin version
8.18.1

Screenshots
image

**Desktop

  • OS: Windows 11
  • Browser: Google Chrome
  • Version: 120.0.6099.225

Additional context
Adyen Log:
ERROR: Unhandled order state '' {"orderId":"361373","orderIncrementId":"1001423590","orderState":null,"orderStatus":null,"pspReference":"L36XBG7HCXTZ9V72"} {"uid":"79d7d9f"}

@sushantjw sushantjw added the Bug report Indicates that issue has been marked as a possible bug label Jan 19, 2024
@hossam-adyen hossam-adyen self-assigned this Jan 19, 2024
@hossam-adyen
Copy link
Contributor

Hi @sushantjw, thanks for opening this issue, with the given steps I wasn't able to reproduce this issue and we don't expect an order with null status when we process notifications

$currentState = $this->getCurrentState($order->getState());
if (!$currentState) {
$this->logger->addAdyenNotification(
"ERROR: Unhandled order state '{orderState}'",
array_merge(
$this->logger->getOrderContext($order),
['pspReference' => $notification->getPspreference()]
)
);

@sushantjw
Copy link
Author

Hey @hossam-adyen, thank you for the reply. We have list of orders which don't have any state and status all created through failed payment. The Adyen event log all show that these orders have failed authorization due to unsupported card or failed 3DS. From my understanding, these orders should get cancellation event which doesn't seems to be there in Adyen event log.

@hossam-adyen
Copy link
Contributor

Dear @sushantjw,

Upon processing, those orders failed to be canceled due to the lack of a current state. This is unexpected, as orders should always have a state at this stage. Could you please investigate the logs from both Magento and Adyen to determine why these orders were created without a state?

@sushantjw
Copy link
Author

sushantjw commented Jan 30, 2024

 if ($action) {
            if ($methodInstance->isInitializeNeeded()) {
                $stateObject = new \Magento\Framework\DataObject();
                // For method initialization we have to use original config value for payment action
                $methodInstance->initialize($methodInstance->getConfigData('payment_action'), $stateObject);
                $orderState = $stateObject->getData('state') ?: $orderState;
                $orderStatus = $stateObject->getData('status') ?: $orderStatus;
                $isCustomerNotified = $stateObject->hasData('is_notified')
                    ? $stateObject->getData('is_notified')
                    : $isCustomerNotified;
            } else {
                $orderState = Order::STATE_PROCESSING;
                $this->processAction($action, $order);
                $orderState = $order->getState() ? $order->getState() : $orderState;
                $orderStatus = $order->getStatus() ? $order->getStatus() : $orderStatus;
            }
        } 
...
...
...
...
$this->updateOrder($order, $orderState, $orderStatus, $isCustomerNotified);

This is the place() method in Magento (https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Sales/Model/Order/Payment.php)

When I use invalid card the function executes the else block and calls $this->processAction($action, $order); method.
The order state and status are never commited at this step and the execution throws an exception so it doesn't hit the update order code and never saves the order state and status.

The JCB card that I am currently testing with always comes with empty state and status.
Note: JCB is not accepted card in our merchant account.

@hossam-adyen
Copy link
Contributor

Hi @sushantjw, thanks for the insights, to take this further, can you share the exception that you are mentioning with the stack trace for this case?

@pvkooten
Copy link

can also confirm this issue on
Adobe Commerce ver. 2.4.6-p3
Adyen version 9.3.

we also do have this issue for a long time, we tried to figure out with support and sent a lot of logs.
maybe you can get something out case: 03141095

also what @sushantjw says is similar to our situation,
The JCB card that I am currently testing with always comes with empty state and status.
Note: JCB is not accepted card in our merchant account.

@pvkooten
Copy link

@hossam-adyen do you perhaps have any update?

@wilfriedwolf
Copy link

Same here.
Adobe Commerce Version: 2.4.5-p5
Adyen Version: 9.4.1

Not opened a case with the adyen support yet, since there seems to be some ongoing, but @hossam-adyen feel free to ask questions if this can help.

@pvkooten
Copy link

Also confirmed 2.4.6-p6
Adyen Version 9.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug report Indicates that issue has been marked as a possible bug
Projects
None yet
Development

No branches or pull requests

4 participants