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

Duplicated discount rules #305

Closed
RVanDamage opened this issue Mar 12, 2021 · 24 comments · Fixed by #330
Closed

Duplicated discount rules #305

RVanDamage opened this issue Mar 12, 2021 · 24 comments · Fixed by #330

Comments

@RVanDamage
Copy link

Expected behavior

No duplicated discount rules

Actual behavior

On March 3rd we installed Mollie module v4.2.2
Since that day we started receiving orders (placed using Mollie payment) with duplicated discount rules. Check screenshot.
Pretty much every order with discount rule set, has this issue.

Luckily it looks like a display error, because on invoiced when we calculate it manually it does not count the discount twice.

However when we check the database, the entries are really added on order level. Check screenshot.

Environment

  • PrestaShop version: 1.7.6.3

Schermafbeelding 2021-03-12 om 16 59 39

Schermafbeelding 2021-03-12 om 17 01 07

@Saimis777
Copy link
Contributor

Hello @RVanDamage ,

Maybe you could install the latest version of Mollie? That is 4.2.3 and inform me if the issue still persists? You can find the latest version here - https://github.com/mollie/Prestashop/releases

Looking forward to your reply!

--
Best regards,
Invertus Support team

@RVanDamage
Copy link
Author

Hi @Saimis777,

Thanks for the quick reply :)

Before sending this ticket I already checked the changelog for v4.2.3 but didn't see anything regarding our problem.
Anyway, we upgraded the module to v4.2.3 about two hours ago.
And minutes ago we received a new order with the same issue :(

@Saimis777
Copy link
Contributor

Thank you for your reply @RVanDamage ,

Also, would it be possible to receive the shop's BO/FTP credentials for further investigation?If yes, could you send them to support@invertus.eu?

Looking forward to your reply!

--
Best regards,
Invertus Support team

@RVanDamage
Copy link
Author

No problem @Saimis777

We've just provided the asked backoffice credentials to you in an email.

@Saimis777
Copy link
Contributor

Confirming that we've received them @RVanDamage !

Will keep you posted!

--
Best regards,
Invertus Support team

@Saimis777
Copy link
Contributor

Hello @RVanDamage ,

Does this happen with other payment methods if you use discount? Mollie doesn’t add any extra discounts and it just saves Mollie status with transaction id. We don’t think that this issue is caused by Mollie. We couldn’t reproduce it and have no idea how could this happen, please try reproduce this issue with other payment modules. Our guess is that another module or Prestashop bug is causing this.

Looking forward to your reply!

--
Best regards,
Invertus Support team

@Saimis777
Copy link
Contributor

Hello @RVanDamage ,

Maybe you could clarify if you've managed to check my previous message? Have you managed to check if this happens with other payment methods, as we've checked, and could not reproduce these issues.

Looking forward to your reply!

--
Best regards,
Invertus Support

@RVanDamage
Copy link
Author

Hi @Saimis777,

We are still looking into this issue. The weird thing is that when we check the logs, the only module that got updated that day is the Mollie module. Maybe it's conflicting with some other module. I will keep you posted.

@Saimis777
Copy link
Contributor

@RVanDamage Thank you for that,

Will be looking forward to your reply!

--
Best regards,
Invertus Support team

@Saimis777
Copy link
Contributor

Hello @RVanDamage ,

How is it going? Any further news?

Let us know!

--
Best regards,
Invertus Support team

@Saimis777
Copy link
Contributor

Hello @RVanDamage ,

Regarding this case, are there any further news? Do you need assistance from our end?

--
Best regards,
Invertus Support team

@RVanDamage
Copy link
Author

Hi @Saimis777,

Excuse me for not replying, it's been very busy.
It seems we did not figure out yet what is causing this.

I understand you might want to close this thread? Is there anyway for me to re-open it later?

@Saimis777
Copy link
Contributor

Hey @RVanDamage,

No worries, we can keep it open for a while!

I'll check in back later!

--
Best regards,
Invertus Support team

@RVanDamage
Copy link
Author

Hi @Saimis777,

So after some while of debugging, we finally figured it out!
We found that the Mollie module is responsible for this.

Here's the proof:

  1. For normal, standard payment modules, the addCartRule code is executed only once, by the core classes/PaymentModule.php and then it's finished, no more info in the logs.
  2. For Mollie payment is looks like this:
  • first the same happens as for the standard module, so the core code executes addCartRule
  • then the Mollie module executes addCartRule twice in different parts of it's code, but what is interesting only the second execution causes the cart rules counter to go up to 2

We have a detailed stack trace of how it gets executed. Don't know what the Mollie module exactly does there, but we are 100% sure it does it. We can provide you this stack trace (TXT file) by email (since it also contains some sensitive server info, we rather not share it here.)

@Saimis777
Copy link
Contributor

Hey @RVanDamage ,

Thank you for that!

Maybe you could provide the TXT file via email as well please?

Looking forward to your reply!

--
Best regards,
Invertus Support team

@RVanDamage
Copy link
Author

Hi @Saimis777,

Sure I can, I will reply it to the original mail from about a month ago :)
I will do this right away.

@Saimis777
Copy link
Contributor

@RVanDamage ,

Information received, thank you!

Will keep you posted!

--
Best regards,
Invertus Support team

@RVanDamage
Copy link
Author

Hi @Saimis777,

Good to hear. I just upgraded you module from v4.2.2 to v4.2.3 on our DEV location.
Did another test and the issue remains.

Looking forward to whatever you guys find :)

@Saimis777
Copy link
Contributor

Hey @RVanDamage ,

Just wanted to inform you that we are still working on the case, I am waiting for further feedback from the developers.

--
Best regards,
Invertus Support team

@RVanDamage
Copy link
Author

Hi @Saimis777,

Thanks for your reply.

Sure thing! We actually already thought about making some patch to remove all duplicate cart rules from the DB. There's already thousands of affected orders like this for our customer. But we can only do this once the main issue is fixed in the Mollie module.

So no rush, we're here looking forward to your fix :)

@Saimis777
Copy link
Contributor

Hey @RVanDamage , hope you're having a great day so far!

I've received a clarification, that this will be fixed in 4.3.0 release. For now if you want to fix it please change:

mollie/src/Service/MailService.php file line 303 to:
$package = [
'id_carrier' => $order->id_carrier,
'id_address' => $order->id_address_delivery,
'products' => $order->getProducts()
];

You need to add the : 'products' => $order->getProducts()
this should fix this issue for you.

Let me know if it works!

--
Best regards,
Invertus Support team

@RVanDamage
Copy link
Author

Hi @Saimis777,

Very nice to hear :)
We will apply the fix right away!

Looking forward to the next release.

@Saimis777
Copy link
Contributor

Hello @RVanDamage ,

Did the fix work for you? Is everything okay? Should we keep the issue opened or it solved your issues?

Looking forward to your reply!

--
Best regards,
Invertus Support team

@Saimis777 Saimis777 linked a pull request Jun 4, 2021 that will close this issue
@Saimis777
Copy link
Contributor

Hey!

The 4.3.0 version was released, and your fix is included!

I've included the pull request, you can download the new version here - https://github.com/mollie/PrestaShop/releases/tag/4.3.0

Any feedback provided is greatly appreciated!

--
Best regards,
Invertus Support team

margud added a commit that referenced this issue Jun 29, 2022
MOLIM-347: qr code validation fix for payment API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants