impress-org / givewp

GiveWP - The #1 Donation Plugin for WordPress. Easily accept donations and fundraise using your WordPress website.
https://givewp.com/
GNU General Public License v3.0
345 stars 191 forks source link

The donation repository should clear the post cache after having updated it #6654

Closed glaubersilva closed 1 year ago

glaubersilva commented 1 year ago

User Story

When the update method from the donation repository is used, the cache for the post updated is not cleared and it can generate inconsistent results when the WP native functions that rely on this post cache are used.

Expected Behavior

After updating a donation, the post cache related to it should be cleared.

Steps to Reproduce

  1. Update a donation status from 'pending' to 'publish' using model functions like $donation->save();
  2. Retrieve the donation status using the get_post_status() function native from WP and you'll see that the status still will be 'pending' instead of 'publish'.

    Additional Context

This problem is preventing the give_is_payment_complete() function from the Give core to return the correct value and this is directly affecting the is_receipt_link_allowed() function from the PDF recipes addon that relies on the return of the first function mentioned. As result, this bug is preventing the "Download Receipt" link to be available in the e-mail sent to the donors.

Visuals

pdf-receipts-side-effects

pdf-receipts-side-effects-2

Acceptance Criteria

canny[bot] commented 1 year ago

This issue has been linked to a Canny post: PDF Receipt download link isn't generating for some gateways :tada:

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 14 additional days. Note, if this Issue is reporting a bug, please reach out to our support at https://givewp.com/support. If this is a feature request, please see our feedback board at feedback.givewp.com — that’s the best place to make feature requests, unless you’re providing a PR.