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

Avoid resending Processing Order customer email when merchant wins dispute #3674

Merged
merged 4 commits into from
Dec 23, 2024

Conversation

annemirasol
Copy link
Contributor

@annemirasol annemirasol commented Dec 20, 2024

Fixes #3603

Changes proposed in this Pull Request:

When the merchant wins a dispute, the order gets its pre-dispute status back. In some cases, the order goes back to processing, which causes the "Your order has been received" email to be sent to the customer again. We've received feedback that this causes confusion to the customer, who just lost a dispute and may not be very happy to begin with.

This PR adds logic to avoid resending the "Processing Order" email for the above-described scenario.

Testing instructions

  1. Make sure your webhooks are enabled and working.
  2. Install the email logging plugin of your choice, e.g. Post SMTP Email Log
  3. As a shopper, add a physical product to cart and go to checkout.
  4. Use 4000000000000259 as the CC number, and complete the purchase.
  5. Wait a couple of minutes, and verify in wp-admin Orders that the order dispute has kicked in, and the order status has been set to on-hold.
  6. View your email logs. Notice a few emails have been sent, including one Your <Store Name> order has been received customer email.
  7. In the Stripe dashboard, simulate winning a dispute:
    • Go to the Disputes dashboard (https://dashboard.stripe.com/test/disputes), and view the dispute.
    • Click "Counter dispute"
    • Under "Why should you win this dispute?", choose "The purchase was made by the rightful account owner"
    • Under "Product or service details", choose "Physical product"
    • Click "Next"
    • Under "Supporting evidence", expand "+ Additional information" and type winning_evidence in the textbox.
    • Check "I understand..." and click "Submit"
Screenshot 2024-12-20 at 2 23 32 PM
  1. Wait a couple of minutes, and verify in wp-admin Orders that the order dispute has been closed in the merchant favor, and the order status has been set back to processing.
  2. View your email logs.
  3. In develop, the Your <Store Name> order has been received email has been resent.
  4. In this branch, the email was not resent.

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

@annemirasol annemirasol force-pushed the tweak/3603-skip-customer-email-on-dispute-win branch from 24ffd80 to 9f0512e Compare December 20, 2024 21:18
@annemirasol annemirasol marked this pull request as ready for review December 23, 2024 16:20
@annemirasol annemirasol self-assigned this Dec 23, 2024
@annemirasol annemirasol requested review from a team and wjrosa and removed request for a team December 23, 2024 16:38
Copy link
Contributor

@wjrosa wjrosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, @annemirasol! The code is good, and it works as expected. I can confirm the email is sent only once 👍

@annemirasol annemirasol merged commit ddcceba into develop Dec 23, 2024
33 of 35 checks passed
@annemirasol annemirasol deleted the tweak/3603-skip-customer-email-on-dispute-win branch December 23, 2024 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customer emails get resent when merchant wins dispute
2 participants