Repository navigation
fix(billing): show the credit purchase amount as a formatted price - #1948
Conversation
Checkout metadata is stored as JSON, so the synced Stripe amount total reads back as a float64. Formatting it with %d wrote descriptions like "at %!d(float64=1000)[usd]". Convert it to int64 first, the same way the product quantity is read.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: raystack/frontier/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughCheckout credit descriptions now use formatted amounts with parsed ISO currency codes and currency-specific decimal scales. Invalid currency codes retain the minor-unit amount and original code in brackets. ChangesCheckout credit descriptions
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Merge Risk: 🟡 Moderate · up to Credit purchase descriptions can show an incorrect amount for ISK purchases. Correct the conversion before merging unless this limitation is explicitly accepted. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… unit Stripe reports the amount total in the currency's minor unit, so a $10.00 purchase read "at 1000[usd]". Format it with the currency's symbol and decimals instead, so it reads "at $10.00" (and "¥1,000" for a zero-decimal currency). An unknown currency code keeps the old format.
Coverage Report for CI Build 36109356300Coverage decreased (-0.009%) to 51.745%Details
Uncovered Changes
Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: raystack/frontier/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID: a8044daf-a918-446a-8ae8-fc6a8dedc057
📒 Files selected for processing (2)
billing/checkout/service.gogo.mod
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.
A narrow symbol rendered every dollar currency as a bare $, so CAD, AUD and USD purchases read the same. Print the amount in the major unit with the ISO code instead, e.g. "10.00 USD", and drop the symbol printer.
Summary
addition of 10 credits for Tokens at %!d(float64=1000)[usd].amount_totalreads back as afloat64, and formatting it with%dfails. It is now converted withcast.ToInt64, the same way the product quantity is read.golang.org/x/text/currencyfor the number of decimals:at 10.00 USDinstead ofat 1000[usd], and1000 JPYfor a zero-decimal currency. An unknown currency code keeps the old1000[xyz]format.golang.org/x/textmoves from an indirect to a direct dependency.