-
Notifications
You must be signed in to change notification settings - Fork 544
[Dashboard] Fix Stripe balance calculation in getStripeBalance function #7269
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
[Dashboard] Fix Stripe balance calculation in getStripeBalance function #7269
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
WalkthroughThe Changes
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (7)
🔇 Additional comments (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
6ae607e
to
ae3014a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7269 +/- ##
=======================================
Coverage 55.57% 55.57%
=======================================
Files 909 909
Lines 58681 58681
Branches 4167 4167
=======================================
Hits 32612 32612
Misses 25961 25961
Partials 108 108
🚀 New features to boost your workflow:
|
size-limit report 📦
|
TL;DR
Fixed Stripe balance calculation to correctly convert from cents to dollars.
What changed?
Modified the
getStripeBalance
function to divide the customer balance by -100 instead of multiplying by -1. This properly converts the Stripe balance from cents to dollars.How to test?
getStripeBalance
function with the customer IDWhy make this change?
Stripe stores monetary values in the smallest currency unit (cents for USD). The previous implementation incorrectly handled this by only inverting the sign, but not converting from cents to dollars. This fix ensures that balances are displayed in the correct currency format for users.
PR-Codex overview
This PR updates the balance calculation in the
stripe-actions.ts
file to correct how the balance is derived from Stripe's API. It changes the operation from multiplication by -1 to division by -100 to accurately reflect the customer's balance.Detailed summary
customer.balance * -1
tocustomer.balance / -100
for accurate balance conversion.Summary by CodeRabbit