Closed taskula closed 10 months ago
@taskula Could you maybe give us some instructions on how to reproduce the issue to get order placed with Paytrail payment method, that is in pending
status? By default our module is changing this status to pending_payment
in \Paytrail\PaymentService\Gateway\Command\Initialize::execute
gateway command.
Also which module version you are using?
Hi, thanks for your response!
Could you maybe give us some instructions on how to reproduce the issue to get order placed with Paytrail payment method, that is in pending status?
Admin -> Stores -> Order Status
We have a bunch of statuses here, "pending" is default: no (contrary to what I said in my first post) and has state code "new", and "pending_payment" is default: yes and has state code "pending_payment". This is probably not the default status configuration, as we have tweaked them over the years for various other payment modules and order related cronjobs. We also have "pending_paytrail" but perhaps this is from the old Paytrail module(?). I don't quite understand how Magento selects the default status, but I believe we can still fix this issue:
By default our module is changing this status to
pending_payment
in\Paytrail\PaymentService\Gateway\Command\Initialize::execute
gateway command.
Looking at
https://github.com/paytrail/paytrail-for-adobe-commerce/blob/bba96960ae192a08a3b715a535e3d9fabe58b391/Gateway/Command/Initialize.php#L46
we are setting Order::STATE_PENDING_PAYMENT
, not hardcoded pending_payment like we have at the callback condition. I propose we modify
https://github.com/paytrail/paytrail-for-adobe-commerce/blob/de5b21b7efc8639b175a350800d198fcfa723ae8/Controller/Callback/Index.php#L56
$status == 'pending_payment'
to $status == Order::STATE_PENDING_PAYMENT
or alternatively add a configuration to allow admin to select a set of order statuses, and compare the status to the new configuration in this condition.
Also which module version you are using?
paytrail-for-adobe-commerce 2.0.0, Magento 2.4.6-p2
we are setting
Order::STATE_PENDING_PAYMENT
, not hardcoded pending_payment like we have at the callback condition. I propose we modify
$status == 'pending_payment'
to$status == Order::STATE_PENDING_PAYMENT
I just checked it in our system and Order::STATE_PENDING_PAYMENT does equal to "pending_payment". So the quoted solution would not resolve the issue in our system, although it would probably be correct to change it.
Anyhow, I still have no idea where this "pending" state is coming from in our system. I will have to figure that out and that is out of scope of this module, so I feel like this issue can be closed.
add a configuration to allow admin to select a set of order statuses
This would be nice to have but perhaps another day.
Describe the bug We've had a couple of payments where when customer is not for some reason redirected back to /payment/receipt, then Magento only receives a callback request to /payment/callback, and the order then does not change status and stays in pending state.
I've debugged it down to this condition which has hardcoded
pending_payment
status and determines whether order processing at this callback should commence. https://github.com/paytrail/paytrail-for-adobe-commerce/blob/de5b21b7efc8639b175a350800d198fcfa723ae8/Controller/Callback/Index.php#L56-L59Our orders are in
pending
status, so this condition is never true. As a temporary solution we've managed to get this working by adding an additional|| $status == 'pending'
condition. Could we implement another way to force payment processing instead of checking hardcoded order status? I honestly don't know why our installation haspending
as default and notpending_payment
, but hardcoding at a quick glance doesn't seem like a nice way to handle things.To Reproduce
/paytrail/callback/?checkout-account=xxx&checkout-algorithm=sha256&checkout-amount=xxx&checkout-stamp=xxx&checkout-reference=xxx&checkout-status=ok&checkout-provider=xxx&checkout-transaction-id=xxxsignature=xxx
Expected behavior
/paytrail/callback/?checkout-account=xxx&checkout-algorithm=sha256&checkout-amount=xxx&checkout-stamp=xxx&checkout-reference=xxx&checkout-status=ok&checkout-provider=xxx&checkout-transaction-id=xxxsignature=xxx
Additional context On a side note, the line inside this block dies and needs fixing. See #78 https://github.com/paytrail/paytrail-for-adobe-commerce/blob/de5b21b7efc8639b175a350800d198fcfa723ae8/Controller/Callback/Index.php#L59
main.CRITICAL: Error: Cannot use object of type Magento\Framework\Controller\Result\Json\Interceptor as array in /vendor/paytrail/paytrail-for-adobe-commerce/Controller/Callback/Index.php:59