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

Fix order total for partial capture #3319

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Serfe-com
Copy link

Fixes #2799

This PR addresses two issues related to order status updates and partial capture:

  1. Prevents changes to the order total when updating the order status during a partial capture.
  2. Adds a refund entry with the message "Partial Capture" to accurately reflect partial refunds in line with Stripe's charge details.

Changes proposed in this Pull Request:

  • Webhook process_webhook_capture:

    • Prevents modification of the order total during status changes.
    • Introduces a partial refund entry to ensure the order total remains unaffected by status changes.
    • Add an status change from "on_hold" to "processing"
  • Order Notes:

    • Adjusts the number representation to a float with two decimal places for consistency and clarity.

Testing instructions

⚠️ Note: you need to have webhooks working in order to receive the capture webhook from Stripe.

  1. Enable auth and capture from the Stripe settings.

    • WooCommerce → Settings → Payments → Stripe → Settings (Transaction preferences)
  2. Purchase any product.

  3. Go to the Stripe Dashboard and view the transaction.
    screenshot-dashboard stripe com-2024 07 26-13_53_21

  4. Click the capture button and enter an amount below the full total. eg $15 ⇒ $5
    Screenshot from 2024-07-26 13-25-26

  5. View the order in WooCommerce with the following information:

    • It's on processing status
    • The order has a partial refund with the no-capture amount
    • The order total doesn't change

Screenshot from 2024-07-26 13-27-14
Screenshot from 2024-07-26 13-27-04

  1. If you change the order status to any status, you will no see any total change

  • 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

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.

Partial capture from Stripe dashboard results in incorrect order totals and status
1 participant