Files
pangolin/docs/pay-v2-dev-log.md
T
wangjia ff91be928a
ci-pangolin / Lint — shellcheck (pull_request) Successful in 10s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 25s
ci-pangolin / Cleartext Scan — Android 禁明文 (pull_request) Successful in 16s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 17s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 57s
ci-pangolin / Flutter — analyze + test (pull_request) Successful in 37s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 4s
ci-pangolin / DS-flow — 原型/跨端同源/代码色单源闸 (pull_request) Successful in 3s
ci-pangolin / Go — build + test (pull_request) Failing after 12s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Failing after 11s
ci-pangolin / Go — integration (mysql/redis testcontainers) (pull_request) Failing after 4m49s
ci-pangolin / Golden — 视觉回归 (全量:components/auth/desktop/tablet) (pull_request) Failing after 20s
docs(pay-v2): 开发决策日志 step3-4(客户端落地 + 集成测试)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
2026-07-12 00:07:51 +08:00

47 lines
4.3 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.
# pay v2 支付+订单 — 自动开发决策日志
> 2026-07-11 起,自动模式落地。用户明早 double check。每个决断记这里。
## 背景
用户指令:把今天设计的支付/订单功能全部落成真实代码(Flutter + Go),前后端测试,增量提交,自行决断,留记录。
## 最终 UX 模型(prototype 已定稿)
- 购买页一个**支付渠道 segswitch**:默认 **USDT→加密货币**,可切 **人民币→支付宝**。渠道=币种=方式,一步定,无弹层。
- 套餐价随渠道切换(一口价不换算):月 ¥29.99/$4.99 · 季 ¥68.88/$12.99 · 年 ¥199.99/$34.99。
- 买完直达支付页:crypto=USDT 地址+精确金额;alipay=桌面二维码/移动拉起 App。
- 订单:列表→详情,状态 pending/paid/settled/expired。
- nezha(哪吒)已从购买流程移除。
## 决策日志
- **[step0]** prototype 支付渠道 switch 收口(3 屏 + `.segswitch` 原子入真相源+登记)。→ 提交后进开发。
## [step1] prototype 支付渠道 switch 收口(2026-07-11
- `.segswitch` 原子入 atoms.css + 登记 index.htmlpurchase.html/ui-mobile/ui-desktop 三屏改成购买页渠道 switch(默认 USDT→crypto / 人民币→alipay),删两步弹层 + nezha。
- 闸全绿:check-ds 5 项 / check-l1-sync58 图标 + 190 l10n×6)。
## [step2] 服务端 pay orders + 分币种 catalog2026-07-11
- catalog.go`CatalogItem.PriceUsdtMicro`USDT 展示价,一口价)+ `SettlementCurrency`/`DisplayAmountMinor` helpercrypto→USDT / 法币→CNY)。
- store.go`PurchaseRow.CreatedAt``Insert` 增 amount/currency 参(下单落展示金额,webhook 覆盖实际);新增 `ListByUser`
- handler.go:新增 `List`GET /v1/pay/orders,纯本地台账倒序)+ `orderView` 富字段;`GetOrder` 详情回带 sku/plan/method/amount/currency/created_at/paid_at;下单按方式落展示金额。
- main.go:注册 `GET /v1/pay/orders`
- 测试:新增 List 越权/倒序/富字段、下单展示金额分币种、详情富字段;**修 3 个 pre-existing 迁移测试**renumber 21→23 遗留)。`go test ./...` 全绿。
- 决策:USDT 展示价放服务端 catalog$4.99/$12.99/$34.99),客户端 switch 直接读,不硬编码;实际扣款仍以 pay 侧为准。
## [step3] 客户端 Flutter 落地(2026-07-11
- 探查结论:购买/支付主干已存在(Riverpod + payment_api + payment_page 多态渲染);缺订单列表/详情整链 + 购买页 segswitch/分币种。
- **锁定共享契约(主 agent 手写,防并行冲突)**:
- models/payment.dart`PayChannel{usdt,cny}`.currency/.method);`PayCatalogItem.priceUsdtMicro` + `priceLabel(ch)`/`perMonthLabel(ch)`/`months`**priceLabel 改带参**);新 `PayOrderSummary``PayOrderStatus.summary` 富字段。
- payment_api.dart`listOrders()`
- l10n+19 getter(支付渠道 switch 4 + 订单 15)×6 语言,l10n 闸绿(209×6)。
- StatusPill 复用(created→connecting/等待付款、paid→connected/已开通、canceled→neutral/已取消)。
- **两 agent 并行建屏**A=SegSwitch widget + purchase_page 重构(渠道 switch 置顶、分币种价、删底部弹窗) + payment_page 订单卡;B=orders_provider + orders_page(列表+详情) + 导航(NavView.orders + desktop_shell + account 入口)。
- 决策:USDT 展示价由服务端 catalog 下发(不客户端硬编码);「继续支付」MVP 走购买页重下单(retry-resume 列为后续)。
## [step4] 集成 + 测试 + 提交(2026-07-12
- 整体 `flutter analyze` 0 error3 个 pre-existing infowithOpacity×2 + unused import)。
- `flutter test` 226 全绿:修 priceLabel 带参、假 API 补 listOrders、购买页测改成默认 USDT+切 CNY 断言、新增订单列表/空态/详情测试、golden 重录(icon 迁移+账户订单入口+连接键 loader)。
- 服务端 `go test ./...` 全绿。
- l10n 19 getter ×6 语言补 @overridecheck-l1-sync 绿(209×6)。check-ds 绿。
- **提交**a5adbf3 server / f6ce526 design / 272eca0 client。→ push + draft PR。
- 遗留(非阻塞,明日可议):订单「继续支付」走重新下单(非 retry-resume);订单无 expired 本地态;`local-l13-start.sh` 是本地联调脚本(含 throwaway 密钥)不入 git。