Repository navigation
fix(creem): fix manual refill and billing log for Creem orders(#4179) - #4708
yanghong20050 wants to merge 4 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR makes provider-specific quota calculations and Creem logging changes in the top-up model, adds email i18n keys/locales and wires i18n into controller and service emails, and updates frontend billing/top-up UIs to format Creem quota values specially. ChangesPayment Provider Quota Handling
Email Internationalization & Notifications
Frontend Quota Display
Sequence Diagram(s): sequenceDiagram
participant Client
participant Controller
participant i18n
participant Mailer
Client->>Controller: HTTP request (verification/reset)
Controller->>i18n: Translate(lang, key, data)
Controller->>Mailer: common.SendEmail(subject, content)
Mailer->>Mailer: deliver email
sequenceDiagram
participant Service
participant Model
participant i18n
participant Mailer
Service->>Model: GetRootUser()
Service->>i18n: Translate(rootLang, key, data)
Service->>Mailer: common.SendEmail(subject, content)
Mailer->>Mailer: deliver email
Estimated code review effort 🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
51fdfc5 to
2b6f1df
Compare
RechargeCreem previously credited topUp.Amount as raw quota, so a $19 purchase only credited 19 quota (~$0.0000376). Align Creem with all other topup paths (manual complete / Stripe / Waffo) by multiplying Amount (USD) by QuotaPerUnit; reject non-positive quotas. Upstream context: QuantumNous#4179, PR QuantumNous#4708 (unmerged, opposite fix).
问题背景
Creem 支付通道的产品配置中,
quota字段由管理员直接填写系统内部 raw quota 值(例如填25000000表示给用户充值 $50 额度),与 Stripe/Waffo 等通道的Amount语义不同(后者存的是美元数量,需乘以QuotaPerUnit换算)。修复内容
Bug 1:管理员补单(
ManualCompleteTopUp)给 Creem 订单额度错误原代码对所有非 Stripe 通道统一执行
Amount × QuotaPerUnit,Creem 订单会被错误地再乘以 500,000:修复:为 Creem 单独分支,直接使用
topUp.Amount,不做换算。Bug 2:账单日志显示原始数字而非可读金额
Creem 充值成功的账单记录使用
%v, quota直接打印原始数字(如25000000),而 Stripe、Waffo 等通道使用logger.FormatQuota()格式化为$50.00,用户体验不一致。修复:改用
logger.FormatQuota(int(quota))与其他通道保持一致。变更文件
model/topup.goSummary by CodeRabbit
Bug Fixes
Improvements
New Features