omise / omise-woocommerce

Omise WooCommerce Plugin
https://docs.opn.ooo/woocommerce-plugin
MIT License
47 stars 27 forks source link

Fix - When webhook is enabled, order status updated twice and triggered two emails to merchant. #176

Closed mayurkathale closed 4 years ago

mayurkathale commented 4 years ago

1. Objective

On WooCommerce plugin, if merchant enables webhook configuration, sometimes they can see the order status updated twice and gets 2 email notification for the same order.

This issue happens as callback action after payment and webhook executes concurrently, updating notes and order status at the same time causing sending email notification twice.

Duplicate notes: duplicate_notes

Related information: Internal Ticket(s): https://phabricator.omise.co/T22125

2. Description of change

3. Quality assurance

🔧 Environments: i.e.

✏️ Details: Steps to reproduce:

Actual behaviour: After order completion, duplicate(twice) emails gets sent to customer for order comfirmation, Duplicate notes attached to order. This happens intermittently.

Expected behaviour: After order completion, no duplicate order email should get sent to customer and no duplicate note should get added to

4. Impact of the change

Card payment should work normally

5. Priority of change

High.

6. Additional Notes

Using following solution suggested by @guzzilar https://gist.github.com/thenbrent/974053a348eb7f3ea4c4cb827a39d2e7

mayurkathale commented 4 years ago

Closing this PR as preferring #179 instead.