Files
rnpay/docs/walletman对接文档.md
2026-06-17 01:57:49 +08:00

41 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# WalletMan 对接文档
Android 宿主 App 通过 **HTTP + WebSocket + FCM** 连接 walletman 服务端完成钱包绑定、TCP 代理出网、token 过期静默重绑。
## 文档索引
| 文档 | 读者 | 内容 |
|------|------|------|
| [后端对接](./walletman后端对接.md) | 服务端 / 联调 | HTTP / WS / FCM 协议、接口、触发条件 |
| [前端对接](./walletman前端对接.md) | Android / RN 开发 | rnwalletman 集成、Manifest、JS API、绑钱包 |
## 快速概念
- **clientId**:设备唯一 ID与 App 侧 `DeviceInfo.getUniqueIdSync()` 一致,用于 WS 注册和 FCM 投递。
- **walletId**`{walletType}_{phone}`,如 `paytm_9876543210`
- **Token 绑钱包**:魔改 ipay 包 AIDL 读 token → `POST /register`
- **OTP 绑钱包**`POST /request-otp``POST /verify-otp`
- **FCM 重绑**:服务端检测 inactive → 下发 `rebind_wallet` → 客户端静默 AIDL → `POST /register`;失败再弹本地通知。
## 本地联调
```bash
# 服务端(默认 :16000
cd servers/walletman/cmd/server
go run . -tls android
# 测试页
open http://localhost:16000/test/index.html
```
生产环境通常由 Nginx 反代 HTTP/WS`https://domain/ws`),端口不必暴露 16000。
## 仓库参考
| 路径 | 说明 |
|------|------|
| `servers/walletman/` | Go 服务端 |
| `libs/rnwalletman/` | RN 库Proxy + Bind 组件) |
| `android/app/.../RnpayProxyService.java` | rnpay 宿主 registerWallet 示例 |
| `screens/HomeScreen.tsx` | rnpay Proxy / 绑钱包 / 通知点击示例 |