feat(provider): first-payment monthly coupon (ONE50) with dynamic Nacos config
Summary
为从未充值过的用户首次月付订阅自动应用 50% 优惠券(ONE50),仅月付生效。规则、折扣率、生效期、多语言文案均通过 Nacos promotion.config 动态控制。
详见 plan:docs/plans/2026-04-22-001-feat-first-payment-monthly-coupon-plan.md。
改动颗粒度
Step 1(纯读,可独立上线)
ConfigConstants.PROMOTION_CONFIG_DATA_ID-
PromotionConfigDTO+PromotionConfigProperties(Nacos 动态刷新) -
PromotionService+Impl(snapshotForUser / evaluateForCheckout / computeDiscountedPrice) -
MultiLanguageConfigVO.Plan加monthlyPromotion/annuallyPromotion -
PlanMultiLanguageConfigService新增(String, Long)重载,旧签名保留 admin 用
Step 2(写侧,结账闭环)
-
CheckoutSessionRO.promotionCode新增可空字段 -
CheckoutService新用户分支调evaluateForCheckout透传 -
NewSubscriptionFlowService互斥处理setAllowPromotionCodes/addDiscount,Stripe 失败降级重试
sit 验证
- v200 / commit
a532e02/s1-flymoon-payment已部署到 sit namespace - 匿名
getMultiLanguageConfig返回monthlyPromotion: null✓ - Stripe smoke test:
Y3kDqScWcoupon +promo_1TPeTb...命中后金额 50% off ✓
prod 上线依赖
-
Stripe live mode 必须重建:test 与 live 隔离,新建 Coupon(
percent_off=50, duration=once)+ PromotionCodeONE50 - prod Nacos 发布
promotion.config,先enabled=false冷启动 - 切 enabled=true 后第一小时盯:
创建 Stripe Session成功率、evaluateForCheckoutwarn 日志、Coupon 兑换数
回滚预案
任何异常 PUT Nacos enabled=false,10s 内全 Pod 失效,0 代码回滚。