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

[ET-2015] Adjusted the logic for calculating fees when using Stripe. #2964

Merged
merged 4 commits into from
Mar 14, 2024

Conversation

redscar
Copy link
Contributor

@redscar redscar commented Mar 14, 2024

🎫 Ticket

ET-2015

🗒️ Description

In a previous PR (#2403) we removed certain parts of the is_licensed_plugin logic due to its resource-intensive nature, especially noticeable on the checkout page when Stripe is enabled. This PR reintroduces the logic with the idea of caching the revalidation of id_current_license_valid.

Scenario -
When $revalidate is true we need to check the most recent license. This happens here. This method is always called when you checkout for Stripe to see if the fee must be added.

I added in additional caching when $revalidate is true. The cache will only last an hour and will help alleviate multiple calls to is_current_license_valid which is resource intensive.

I originally tackled this using Tribe Cache. However, I found that the value wasn't being kept in the cache and it was blank every page load. Therefore I moved forward using transients instead.

🎥 Artifacts

✔️ Checklist

  • Changelog entry in the readme.txt file.
  • Code is covered by NEW wpunit or integration tests.
  • Code is covered by EXISTING wpunit or integration tests.
  • Are all the required tests passing?
  • Automated code review comments are addressed.
  • Have you added Artifacts?
  • Check the base branch for your PR.
  • Add your PR to the project board for the release.

@redscar redscar added the code review Status: requires a code review. label Mar 14, 2024
Co-authored-by: Mike Cotton <mike@theeventscalendar.com>
@redscar redscar merged commit fdab9d4 into release/G24.cocker-spaniel Mar 14, 2024
13 of 14 checks passed
@redscar redscar deleted the tweak/ET-2015_process_stripe_fee branch March 14, 2024 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code review Status: requires a code review.
Projects
None yet
2 participants