mollie / magento2

Mollie Payments for Magento 2
https://www.mollie.com
Other
98 stars 50 forks source link

New Order IDs breaks the module #669

Closed mvenghaus closed 9 months ago

mvenghaus commented 11 months ago

Hey,

it seems that Mollie changed the payment id .. from "ord_1rsa7lu" -> "ord_1.rsa7lu'.

with that new point the check fails at different locations.

if (preg_match('/^ord_\w+$/', $transactionId)) {

All shops I tested are not working.

Regards Marcus

Frank-Magmodules commented 11 months ago

HI there @mvenghaus , thank you for contacting us here as well, we are checking this at the moment and will be back on this soon.

Swahjak commented 11 months ago

Having the same issue, pretty critical

Frank-Magmodules commented 11 months ago

Yes, thanks @Swahjak , we are on it together with Mollie.

patricksteenks commented 11 months ago

Same issue here.

wouter-toppy commented 11 months ago

This wil proberly fix the issue when changing the regex. (given that the new order ID is a valid one from mollie)

^ord_(\d\.)?\w+$

Swahjak commented 11 months ago

Would just having /^ord_/ make more sense? Assuming that payments always start with tr_ and orders with ord_

Swahjak commented 11 months ago

@everyone I can confirm that updating the regex to /^ord_/ does seem to mitigate this issue, we're already running this in production.

wouter-toppy commented 11 months ago

@everyone We've deployed this, and that is a hot fix for now until Mollie comes with the final fix. https://patch-diff.githubusercontent.com/raw/mollie/magento2/pull/670.diff

I Agree with @Swahjak about the new regex, but thats not my decission to make ;-) so i keep it with the this regex for now

Frank-Magmodules commented 11 months ago

Update:

Unfortunately, it appears that the new format of the order transaction ID from Mollie does not match the pattern expected by the preg_match function within Magento. As a result, all orders utilizing the Orders API will fail once they reach the webhook. We are actively working on a hotfix and aim to release it as soon as possible.

In the interim, we recommend switching to the Payments API for non-Klarna methods. This adjustment can be made in the plugin configuration per payment method.

fjbender commented 11 months ago

Hi all,

We apologize for this issue. The new order ID format actually has been in our systems for a long time now. The timing was not deliberate, but a result of the amount of order surpassing a certain number. We missed to address this change properly and proactively in our Magento plugins.

Stuck orders should be updated automatically after the hotfix has been applied whenever we send out a new webhook. We will try to extend the webhook retry period beyond the usual 24h for affected orders to give merchants more time to update the plugin.

Please also see https://status.mollie.com/incidents/nwrrw8s2zxws for additional information.

Frank-Magmodules commented 11 months ago

We have successfully rolled out the latest version which includes a fix that addresses the preg_match problem. To keep everyone informed, I'll keep this issue open for the time being.

ithuis commented 11 months ago

installed latest update, still seeeing this error

mollie.log Mollie.ERROR: error: Kan geen vergrendeling krijgen voor mollie.order.12371

system.log

.CRITICAL: Exception message: Kan geen vergrendeling krijgen voor mollie.order.12371
Trace: <pre>#1 Mollie\Payment\Model\Mollie->processTransactionForOrder() called at [vendor/mollie/magento2/Model/Mollie.php:344
breakerh commented 11 months ago

installed latest update, still seeeing this error

mollie.log Mollie.ERROR: error: Kan geen vergrendeling krijgen voor mollie.order.12371

system.log

.CRITICAL: Exception message: Kan geen vergrendeling krijgen voor mollie.order.12371
Trace: <pre>#1 Mollie\Payment\Model\Mollie->processTransactionForOrder() called at [vendor/mollie/magento2/Model/Mollie.php:344

just updated and everything works fine. Your error seems like a lock issue in your database?

@Frank-Magmodules I know it's not your job but maybe mollie should post a small statement somewhere to let people know?

Donomollie commented 11 months ago

@breakerh Hi Bram, what kind of statement do you mean?

We have an ongoing statement on our statuspage which we try to keep up to date, if you have any suggestions for other places i'd love to hear them.

ithuis commented 11 months ago

yeah, but we have the exact same symptoms. Orders are getting paid, webhook back fails, status nog updated.

breakerh commented 11 months ago

@breakerh Hi Bram, what kind of statement do you mean?

We have an ongoing statement on our statuspage which we try to keep up to date, if you have any suggestions for other places i'd love to hear them.

My bad.. that's actually perfect

hostep commented 11 months ago

@Donomollie, @fjbender: does that mean Mollie isn't planning on reverting this change on their end?

You can't seriously expect all Magento shops using Mollie to update the plugin? (especially not on a Friday afternoon).

Frank-Magmodules commented 11 months ago

@ithuis , i think the issue that you describe regarding the lock is not related to this topic, please feel free to contact us directly so we can help you out here.

ithuis commented 11 months ago

@Frank-Magmodules will do

Frank-Magmodules commented 11 months ago

HI all here,

For those that are not running on the latest version and don’t want to update on a Friday afternoon, we have created patches. You can find them here:

Mollie-v2.16.0.diff https://gist.github.com/Frank-Magmodules/dcd6754421295480f7d9f0db661e6305

Mollie-v2.22.0.diff *Added on 02-08-2023 https://gist.github.com/Frank-Magmodules/04fa945998820e27dd3ac5d260e878d8

Mollie-v2.26.0.diff https://gist.github.com/Frank-Magmodules/9d2efd59360d9c8cd62997906203a906

Mollie-v2.27.0.diff https://gist.github.com/Frank-Magmodules/daae475844f4086d81452d32c6385fb5

Mollie-v2.28.0.diff https://gist.github.com/Frank-Magmodules/579b252a75ceb4b1aa0a1c4239254f16

They may be applicable to other versions as well. If not, feel free to ask for a specific version.

darektw commented 11 months ago

Hello we are using Mollie-v2.28.0

We have cancelled orders from the weekend, will they also be updated after applying this patch? Currently, they are still canceled in Magento panel and remain on canceled status in Mollie dashboard too.

After applying the patch, we have an error after mollie trasanction "There was an error checking the transaction status." "_Invalid payment ID: 'ord1.xxxxx'. A payment ID should start with 'tr'._" it comes from vendor/mollie/mollie-api-php/src/Endpoints/PaymentEndpoint.php

MarianNapi commented 11 months ago

Hey @darektw I just patched myself for v2.21.1 and it works fine now. The error you posted should actually be shown BEFORE you apply the patch. (See adminhtml order page and click the "Fetch Status" Button)

Make sure your patch successfully changed 3 occurances (1x in Payments.php and 2x in Mollie.php) EDIT: For your Version it actually should be 5 Occurances with 1 in CreateMollieShipment.php and CreateInvoiceShipment.php

image

mvenghaus commented 11 months ago

@darektw beside the error the order should be "complete" .. but the customer was redirected to an empty cart with an error message .. i think you should fetch the status like @MarianNapi said and notify the customer that everything is correct with his order

Frank-Magmodules commented 11 months ago

Hi there @darektw , Yes, applying the patch should fix your issue. It sounds like the patch isn’t applied correctly. You can check this by clicking the “Fetch status” button in the admin on the order page. If this succeeds and updates the order, you have applied it successfully. If you have trouble or need help applying the patch, don’t hesitate to contact us through our contact form.

aurel5542 commented 11 months ago

Hello, can I apply the patch and stay in magento production mode? Do I have to deploy static content after or can you please give some infos how to apply the patch without changing magento mode to default or developer? Thank you

Frank-Magmodules commented 11 months ago

Hi @aurel5542 ,

Without knowing about the exact setup you have running this is hard to say. In most cases, there is some sort of deployment system in place that handles the deployment without downtime in most cases. Based on your question I’m assuming you don’t have this kind of system in place.

Now, it is possible to apply the patch on your production site, but if you execute it incorrectly, this could bring your whole site down. But, if you do that, you don’t have to run the static content deploy command as the patch doesn’t touch any static assets. Please be aware that you might need to flush opcache as well.

To be better safe than sorry: I do recommend checking this with your agency and/or testing your action on the staging/development instance first

Frank-Magmodules commented 9 months ago

HI All,

This issue has remained open for nearly two months. We are confident that all affected merchants are now aware of the problem and have taken the necessary steps to update their Mollie installations. Therefore, we are officially closing this issue. If anyone has any questions or concerns regarding this matter, please don't hesitate to reach out.