fix(wallet): read topup gateway flags from topupInfo instead of status#4599
fix(wallet): read topup gateway flags from topupInfo instead of status#4599ImogeneOctaviap794 wants to merge 1 commit intoQuantumNous:mainfrom
Conversation
The /api/status endpoint does not expose enable_stripe_topup or enable_online_topup; these flags only exist on /api/user/topup/info (which is already passed in as the topupInfo prop). As a result, on the subscription plans card the EPay/Stripe payment buttons were always hidden and users saw 'Online payment is not enabled' even when the admin had configured EPay (only Creem worked, since it already read from topupInfo). The classic frontend and the wallet recharge form on the same page already read these flags from topupInfo, so this aligns subscription with that behavior. Also drop the now-unused useStatus import.
|
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 (1)
WalkthroughThe ChangesFeature Flag Sourcing Refactor
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
📝 变更描述 / Description
修复新前端(default frontend)订阅卡片中支付网关判断错误的 bug。
问题表现
管理员已正确配置在线支付(如易支付 EPay)后,余额充值正常工作,但点击订阅套餐"立即订阅"时,购买弹窗仍提示:
经典前端(
web/classic)和同一页面的余额充值卡片均不受影响,仅新前端的订阅卡片有此问题。根因
web/default/src/features/wallet/components/subscription-plans-card.tsx中enableStripe与enableOnlineTopUp错误地从status?.(/api/status接口)读取,但这两个开关 仅存在于/api/user/topup/info(即组件已通过 props 传入的topupInfo);/api/status根本不暴露这两个字段。因此
hasStripe与hasEpay永远为false,购买弹窗判定hasAnyPayment === false,展示"未开启"横幅,唯独 Creem(已正确从topupInfo读取)能用。修复
将这两行的来源从
status?.改为topupInfo?.,与同文件内enableCreem、同页面的recharge-form-card.tsx(topupInfo?.enable_online_topup || topupInfo?.enable_stripe_topup)以及经典前端web/classic的SubscriptionPlansCard/SubscriptionPurchaseModal行为完全一致。同时移除随之不再使用的useStatus导入。🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
无
✅ 提交前检查项 / Checklist
v1.0.0-rc.2在生产环境构建镜像并部署,复现 bug → 应用修复 → 订阅购买弹窗的易支付选择框与"支付"按钮正常出现,已验证通过。📸 运行证明 / Proof of Work
复现步骤
stripe_price_id/creem_product_id)。对照参考(证明修复方向正确)
web/default/src/features/wallet/components/recharge-form-card.tsx:113-117已正确从topupInfo读取相同两个字段。web/classic/src/components/topup/index.jsx:636-637同样从data.enable_*_topup(即 topup-info 接口)读取。controller/user/topup.go的GetUserTopUpInfo返回enable_online_topup/enable_stripe_topup/enable_creem_topup;/api/status接口不暴露这些字段。Diff 大小
仅一个文件,+2/-4 行:
web/default/src/features/wallet/components/subscription-plans-card.tsx。Summary by CodeRabbit