bindbox-game/.trae/documents/落地支付域持久化与退款幂等(执行计划).md
邹方成 6ee627139c
Some checks failed
Build docker and publish / linux (1.24.5) (push) Failing after 40s
feat: 新增支付测试小程序与微信支付集成
feat(pay): 添加支付API基础结构
feat(miniapp): 创建支付测试小程序页面与配置
feat(wechatpay): 配置微信支付参数与证书
fix(guild): 修复成员列表查询条件
docs: 更新代码规范文档与需求文档
style: 统一前后端枚举显示与注释格式
refactor(admin): 重构用户奖励发放接口参数处理
test(title): 添加称号效果参数验证测试
2025-11-17 00:42:08 +08:00

26 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 实施范围
- 支付域持久化:预下单/交易/退款/通知/账单与差异表
- 退款恢复比例与幂等:统一分↔积分换算,部分/全额退款逻辑
- 订单详情与前端金额展示:元格式化与真实字段展示
## 后端改动
- 建表与索引:`payment_preorders/payment_transactions/payment_refunds/payment_notify_events/payment_bills/payment_bill_diff`;唯一键:`order_no/out_trade_no/transaction_id/refund_no/notify_id`
- DAO与模型生成`internal/repository/mysql/dao, model`新增 payment_* gen 文件
- 预下单:落库`payment_preorders`并回填`orders.pay_preorder_id`;返回调起参数
- 通知:入库`payment_notify_events/payment_transactions``orders`从1→2并写`paid_at`
- 退款:入库`payment_refunds`;恢复积分=订单积分抵扣分×退款分/实付分÷100累计不超抵扣积分全额退款一次性恢复剩余订单状态与累计已退款更新
- 对账:拉取账单入库`payment_bills`,生成`payment_bill_diff`,接口导出差异
## 前端改动
- 金额统一元格式化展示,内部用分;
- 详情展示:`transaction_id/refund_no/channel/支付方式`、累计已退与可退余额(元);退款记录表按元显示
## 幂等与安全
- 幂等键:`order_no/notify_id/refund_no`
- 条件更新:`WHERE status=...`;回调与退款入库去重
- 日志与告警:验签失败、金额不一致、退款异常、对账差异
## 验收与测试
- 单元:换算、比例恢复、幂等
- 集成:预下单→回调→主动退款→详情一致;对账拉取与差异
- 前后端构建与联调通过