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: handle zero cover fee percentage #3452

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

chickenn00dle
Copy link
Contributor

@chickenn00dle chickenn00dle commented Oct 1, 2024

All Submissions:

Changes proposed in this Pull Request:

Closes https://app.asana.com/0/1200550061930446/1208449408463805/f

Addresses an issue where the logic for rendering cover fee percentage text causes a fatal when switching subscriptions via My Account.

Screenshot 2024-10-01 at 13 19 54

How to test the changes in this Pull Request:

  1. Ensure name your price is enabled
  2. As a reader make a recurring donation
  3. Visit My account and select the subscription management tab
  4. If not already in the subscription view, select the subscription that was just purchased
  5. Click "Change price"
  6. Choose any subscription, input a new price, and submit
  7. On release you will get a fatal. On this branch you will not.

Bonus: Go through the normal checkout flow for a donation with cover fees to confirm nothing has broken.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@chickenn00dle chickenn00dle marked this pull request as ready for review October 1, 2024 17:26
@chickenn00dle chickenn00dle requested a review from a team as a code owner October 1, 2024 17:26
@chickenn00dle chickenn00dle added the [Status] Needs Review The issue or pull request needs to be reviewed label Oct 1, 2024
// Just one decimal place, please.
$flat_percentage = (float) number_format( ( ( $total - $subtotal ) * 100 ) / $subtotal, 1 );
$flat_percentage = 0;
if ( $subtotal > 0 ) {
Copy link
Contributor

@leogermani leogermani Oct 1, 2024

Choose a reason for hiding this comment

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

very NIT: but since we're here, why not also check if this is actually a number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing! Done in 846bdc2

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Oct 1, 2024
@chickenn00dle chickenn00dle merged commit 742b378 into release Oct 1, 2024
10 checks passed
@chickenn00dle chickenn00dle deleted the hotfix/handle-0-cover-fee-percentage branch October 1, 2024 17:50
matticbot pushed a commit that referenced this pull request Oct 1, 2024
## [5.3.12](v5.3.11...v5.3.12) (2024-10-01)

### Bug Fixes

* handle zero cover fee percentage ([#3452](#3452)) ([742b378](742b378))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 5.3.12 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Oct 1, 2024
# [5.4.0-alpha.8](v5.4.0-alpha.7...v5.4.0-alpha.8) (2024-10-01)

### Bug Fixes

* handle zero cover fee percentage ([#3452](#3452)) ([742b378](742b378))
* **oauth:** validate ID, prevent early deletion and improve logs ([#3450](#3450)) ([763848e](763848e))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 5.4.0-alpha.8 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @alpha released [Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants