Nº10 · Independent prototype · Oct 2026独立原型 · 2026 年 10 月Card disputes · Go · synthetic data银行卡争议 · Go · 合成数据

Dispute Ingestion Service

Card networks redeliver and regulators set deadlines; this service turns both into one record per case, a dated deadline and a person in the loop for anything risky.卡组织会重复投递,监管会设截止时间;这个服务把两者变成:每个案件一条记录、明确的截止日期,有风险的都交给人。

  1. CSV batch · webhookCSV 批次 · webhook
  2. Validate校验
  3. Dedupe去重
  4. Deadlines + risk截止日期 + 风险
  5. Manual review人工审核
  6. Hash-chained ledger哈希链账本
SECTION · DISPUTE INGESTION SERVICEDesign view · code on GitHub设计视图 · 代码在 GitHub

01Problem问题

Disputes arrive as network CSV batches and issuer webhooks, often more than once. Each one starts a Regulation E or Z clock, and an automatic credit on a fraudulent claim is money that does not come back.争议以卡组织 CSV 批次和发卡行 webhook 的形式到达,而且经常重复。每一条都会启动 Reg E 或 Reg Z 的计时,对欺诈申请自动入账,钱就回不来了。

02What I built我做了什么

  • Normalizes Visa and Mastercard reason codes and issuer categories into one model; amounts parse to integer cents, and every field error in a row is kept in a quarantine log.把 Visa、Mastercard 原因码和发卡行类别统一成一个模型;金额解析为整数分;一行里的每个字段错误都写入隔离日志。
  • Idempotent ingestion keyed on network + case ID: a redelivery returns 200, the same ID with different content returns 409.以「卡组织 + 案件号」做幂等:重复投递返回 200,同一编号内容不同返回 409。
  • Simplified Reg E (debit) and Reg Z (credit) deadlines, plus a flag for filings outside the 120-day network window.简化版 Reg E(借记卡)和 Reg Z(信用卡)截止日期,并标记超出 120 天卡组织窗口的申请。
  • Auto-credits only low-risk, in-window cases under a limit; named fraud signals send a case to manual review. There is no auto-deny.只有低风险、在窗口内、低于限额的案件自动临时入账;命中具名欺诈信号就转人工审核;不做自动拒绝。
  • Parallel validation, serialized commits, and a hash-chained ledger that is verified on startup and refuses to start if edited.并行校验、串行提交;哈希链账本启动时校验,被改过就拒绝启动。

03Measured测量结果

20 → 1
concurrent redeliveries of one case create one record同一案件 20 次并发重投只建一条记录
13
tests, all passing under go test -race个测试,go test -race 下全部通过

04Limits, stated plainly局限,直说

  • Synthetic data only; not connected to any network or bank.只用合成数据;没有接入任何卡组织或银行。
  • Regulatory rules are simplified: no bank holidays, new-account extensions or per-reason-code network windows.监管规则是简化版:没有银行假日、新账户延期,也没有按原因码区分的卡组织窗口。
  • The ledger is a local file; a production version would keep the chain in PostgreSQL behind a unique constraint.账本是本地文件;生产版本会把哈希链放进 PostgreSQL,并加唯一约束。
  • Built while preparing for a payments role, to learn the domain.为准备一个支付方向的岗位、学习这个领域而做。