--------------------------------------------------------------------------- FundingSource — 资金来源接口(钱包 or 订阅) --------------------------------------------------------------------------- FundingSource 抽象了预扣费的资金来源。
| 12 | |
| 13 | // FundingSource 抽象了预扣费的资金来源。 |
| 14 | type FundingSource interface { |
| 15 | // Source 返回资金来源标识:"wallet" 或 "subscription" |
| 16 | Source() string |
| 17 | // PreConsume 从该资金来源预扣 amount 额度 |
| 18 | PreConsume(amount int) error |
| 19 | // Settle 根据差额调整资金来源(正数补扣,负数退还) |
| 20 | Settle(delta int) error |
| 21 | // Refund 退还所有预扣费 |
| 22 | Refund() error |
| 23 | } |
| 24 | |
| 25 | // --------------------------------------------------------------------------- |
| 26 | // WalletFunding — 钱包资金来源实现 |
no outgoing calls
no test coverage detected