English
Mock Channel: Setup
The mock side ships with built-in profiles and default rules; what you need to do is on the main app side. Configure in the order below and you can place orders.
Prerequisites
| Item | Requirement |
|---|---|
| Main app | Started in dev mode (daxpay.platform.deployment.mode=DEV); PROD does not wire the mock module |
| Channel sub-app | dax-pay-channel-one is running (20100) |
| Mock service | Running, default 10400; curl http://127.0.0.1:10400/health responds |
| Database | Demo data set (data-demo.sql) — the mock channel master data and demo merchant are in it; the clean data set data.sql has no mock channel, so switch data sets or add the master data rows yourself |
Start the mock service:
bash
# Repository root, dev profile, port 10400
mvnd spring-boot:runRun the console dev server separately (10500, /mock prefix proxied to 10400) only when changing the frontend; daily integration uses the static assets bundled in the backend. After changing console pages you must run cd ui && pnpm build again, otherwise the changes exist only in the dev server.
Step 1: Create a Mock Channel Merchant
On the Admin Panel "Channel Merchants" page, create a merchant: pick the "Mock Pay" product, set the channel merchant number to the built-in seed MOCKM99999 (or any number of your own), and leave all credential fields empty — mock onboarding requires no credentials, keys, or certificates.
Step 2: Include the Mock Channel in Routing
On the Admin Panel "Channel Routing" page, configure a strategy for the app and include the channel merchant from the previous step as a candidate:
- Basic mode (by channel): bind the channel merchant under any of the WeChat / Alipay / UnionPay / Douyin channels. The mock product strategy declares coverage of all platform payment methods, so orders from any method of the four channels can route here;
- Scene mode (by payment method): pick the channel merchant and capability on the matching payment method row. Candidate validation on save depends on capability master data; without the row, that method never appears as a candidate.
Step 3: Configure the Callback Address
The backend access address under Admin Panel "Platform Configuration → Endpoint Configuration" must be a main app address reachable from the mock service. Mock builds callback URLs from it; for local integration that is http://127.0.0.1:9999. If it is missing or unreachable, payments succeed but callbacks never come back.
Step 4: Confirm the Gateway Address and Keys
- The base address from the channel sub-app to the mock service defaults to
http://127.0.0.1:10400, configured bymock.gateway.base-url; change it when mock is not on the same machine; - Gateway signature validation uses only one global key pair; the default local chain needs no extra exchange. ISV mode requires pasting both the merchant private key and the platform public key from the console "System → Integration Materials" page into Admin Panel "Mock ISV".
Step 5: Verify the First Order
- Place an order from an app already bound to the mock route (any QR-based payment method);
- Open the payment confirmation page from the returned
payBody; - Click "Confirm Payment Succeeded"; the page echoes the callback delivery status;
- Back in the main app order list, the order should be successful and the fund voucher channel should be mock.
Once the first order works, the whole chain main app → channel sub-app → mock → callback is complete. To create failures, timeouts, or missing callbacks, see Scenario Rules and Runtime Switches and Transactions and Manual Decisions.
Failure Symptoms
| Symptom | Cause |
|---|---|
| Order fails with "product strategy does not exist" | The main app runs in PROD mode and the mock orchestration module is not wired at all |
| Order fails with "mock channel merchant not registered" (10013) | Mock-side profile missing: the SQLite database was rebuilt without seed data, or the channel merchant number differs from the mock side |
| Mock channel missing from routing candidates | Capability master data missing (clean data set), or the routing strategy was not saved successfully |
| Confirmation page does not open / phone scan returns 404 | The confirmation page address is generated from the mock service; the phone and mock are not on the same network |
| Payment succeeds but the order does not move | Callback address missing or unreachable; check the callback records in the order detail |
| Rules do not take effect | The decision chain priority is overridden by a higher layer; see Scenario Rules and Runtime Switches |