English
Mock Channel: Scenario Rules and Runtime Switches
The mock core model is default success, exceptions through overrides. Understand the decision chain priority and you will not hit "I changed a rule but nothing happened".
Decision Priority
Each transaction is decided in this order, stopping at the first match (high → low):
- Order manual override — single-order operations on the payment confirmation page, order list, or phone payment code;
- Merchant-level override — per-subject overrides configured for that merchant in subject profiles;
- ISV-level override — per-subject overrides configured for that ISV in subject profiles;
- Transaction type default — the fixed defaults in the table below.
Single-order operations always win; subject-level overrides win at "change the result of a whole class of transactions" without clicking order by order. Global bypass (all success / all failure) was removed in 0.3.0: it is orthogonal to the "default success + overrides" model, and leaving it switched on silently fails whole batches.
Default Results per Transaction Type
| Transaction | Default without overrides | How to create another result |
|---|---|---|
| Payment | Immediate success | Click "Payment Failed / Keep Pending" on the confirmation page, or configure a payment override in subject profiles |
| Refund · Alipay / UnionPay / Douyin / aggregate | Immediate success | Configure a refund override in subject profiles |
| Refund · WeChat | Processing | Manual confirmation in the refund order list, or a refund override in subject profiles |
| Split payment | By amount last-digit rule; unmatched stays processing | Split payment rule table |
| Pre-authorization | Freeze succeeds | Fail on the pre-authorization page after creating the order, or configure a pre-authorization override in subject profiles |
Payment code has no "fail by amount last digit" convention: to fail, use "Fail Immediately" in the phone payment code emulator; pending-family orders are decided manually on the confirmation page.
Split Payment Rules
Split payment rules are the only rule table kept site-wide, with a single dimension: the ones digit of the amount. Within the same type, list order wins first match. The two defaults: last digit 1 succeeds, last digit 2 fails, anything else falls back to processing.
Rule changes take effect immediately and do not affect documents already created. Historical rule rows for payment, refund, and pre-authorization in existing databases are cleaned up automatically on startup.
Runtime Switches
| Switch | Default | Description |
|---|---|---|
| Automatic callbacks | On | Every final state sends a callback automatically; failures retry by count (backoff 5s / 30s / 60s) |
| Pending order advance | Manual | Can be set to "Auto Success", where the scheduler pushes pending orders to success after N seconds |
| Callback retry count | Configurable 0–10 | Retry limit for failed automatic callbacks |
| WeChat openid validation | On | Emulated appid/openid validation for JSAPI / mini program payments; turned off skips the whole block, for debugging comparison only |
Payment code channel prefix recognition (WeChat 10–15, Alipay 25–30, UnionPay starting with 62) is a constant in code with no configuration entry. To create an "unrecognized channel" scenario, use a code value outside these ranges (for example, starting with 77).
Common Scenario Recipes
| Scenario | Configuration |
|---|---|
| Payment success | Default |
| Payment failure | Click "Payment Failed" on the confirmation page, or configure a payment override in subject profiles |
| Order stays pending (test timeout / close) | Click "Keep Pending" on the confirmation page and leave auto-advance off |
| Refund succeeds asynchronously | WeChat refund: defaults to processing → manual confirmation in the refund order list |
| Refund failure | Configure a refund override in subject profiles |
| Split payment failure | Change the amount last digit to 2 (or add a last-digit rule) |
| Split payment processing | Amount last digit matches neither 1 nor 2 |
| Freeze failure | Create a pre-authorization order in the console, then fail it on the pre-authorization page |
| Callback lost / re-push | Turn off automatic callbacks and resend, or set retry count to 0 and send manually |
Page locations are in Console Tour; document state meanings are in Transactions and Manual Decisions.