fix(v2): settle 定位尝试的瞬时读库错误归 SettleFailed(可重试),不再误标 not_found
AttemptByProviderRef 返回非哨兵错误(如 DB 抖动)时原先与"查无此单"终态 一并标 SettleNotFound;调用方按结果值决定 ack,会把已付订单永久丢弃。 非哨兵分支改判 SettleFailed(可重试,渠道会重投),errors.Is(ErrAttemptNotFound) 分支维持 SettleNotFound 不变。新增 TestSettleTransientReadErrorIsFailed 通过 关闭底层连接强制产出瞬时读库错误,验证结果与语义。
This commit is contained in:
@@ -43,7 +43,8 @@ func (g *Gateway) Settle(ctx context.Context, ev *provider.PaidEvent) (SettleRes
|
||||
if errors.Is(err, store.ErrAttemptNotFound) {
|
||||
return SettleNotFound, nil
|
||||
}
|
||||
return SettleNotFound, err
|
||||
// 读库瞬时失败是可重试态,不能与"查无此单"终态混淆。
|
||||
return SettleFailed, err
|
||||
}
|
||||
// 金额/币种核对:币种须一致,实付须 ≥ 应收(允许 crypto 多付,拒少付)。
|
||||
if ev.PaidCurrency != att.Currency || ev.PaidAmountMinor < att.AmountMinor {
|
||||
|
||||
Reference in New Issue
Block a user