api/对接接口文档.md

147 lines
4.1 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.

# 印尼支付行为画像查询接口
## 接口信息
| 项目 | 说明 |
|---|---|
| 接口路径 | `POST /api/v1/fortispay/payment-feature` |
| 请求格式 | `application/json; charset=UTF-8` |
| 响应格式 | `application/json` |
## 请求头部
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|------------------------------|
| Content-Type | String | Y | `application/json` |
| X-Request-Id | String | N | 网关请求唯一标识ID,用于全链路追踪,原样回显在响应头中 |
| X-Language | String | N | 语言标识,传 `en` 返回英文结果,不传默认中文 |
## 响应头部
| 参数 | 类型 | 说明 |
|---|---|---|
| X-Request-Id | String | 回显请求头中的 X-Request-Id,未传则自动生成 32 位 UUID |
| X-Session-Id | String | 三方服务返回的唯一会话标识(Fortispay responseId) |
## 请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | String | Y | 用户姓名 |
| idCard | String | Y | 身份证号,支持明文或 MD5 密文 |
| mobile | String | Y | 手机号(带国家码),支持明文或 MD5 密文 |
| encryptAlgo | String | N | 加密算法。**不传**表示明文,服务端原样透传给三方;传入 `MD5` 表示已加密,直接透传 |
### 请求示例
```json
{
"name": "ABCXYZ",
"idCard": "3201190108990002",
"mobile": "6285887456612"
}
```
> idCard、mobile 传明文时无需传 encryptAlgo,服务端原样透传给三方。
```json
{
"name": "ABCXYZ",
"idCard": "cf0ab15098ab149e5273dd82f2c737e6",
"mobile": "bd82af6340240c43175a80aedf7e6eef",
"encryptAlgo": "MD5"
}
```
> idCard、mobile 传密文时必须传 encryptAlgo="MD5"。
## 响应体
返回以下 6 个特征字段:
- `app_behavior` — 申请行为变量
- `loan_behavior` — 放款行为变量
- `repay_behavior` — 还款行为变量
- `time_structure` — 行为时间结构变量
- `delinq_monitor` — 逾期行为监控
- `flow_anomaly` — 资金流量异常监控变量
| 字段 | 类型 | 说明 |
|---|---|-------------------------------------------|
| code | String | 响应码,`"0"` 表示成功,更多请查看富通接口规范.pdf 常见响应编码表 |
| message | String | 提示消息,如 `"success"` |
| status | Integer | 查询状态,仅code为 `"0"` 时有值(`1` = 查得,`0` = 未查得) |
| responseId | String | 三方响应的唯一标识ID |
| data | Object | 结果数据(Map),仅code为 `"0"` 时不为null |
### 成功响应示例
```json
{
"code": "0",
"message": "success",
"status": 1,
"responseId": "0b5a09b6ea7d77dbbbb92e05dc9744ad",
"data": {
"app_behavior": { "..." : "..." },
"loan_behavior": { "..." : "..." },
"repay_behavior": { "..." : "..." },
"time_structure": { "..." : "..." },
"delinq_monitor": { "..." : "..." },
"flow_anomaly": { "..." : "..." }
}
}
```
### 未查得响应示例
```json
{
"code": "0",
"message": "success",
"status": 0,
"responseId": "0b5a09b6ea7d77dbbbb92e05dc9744ad",
"data": {
"app_behavior": { "..." : null },
"loan_behavior": { "..." : null },
"repay_behavior": { "..." : null },
"time_structure": { "..." : null },
"delinq_monitor": { "..." : null },
"flow_anomaly": { "..." : null }
}
}
```
## 错误响应
统一错误格式:
```json
{
"error": "ERROR_CODE",
"message": "错误描述",
"timestamp": "2026-07-08T10:30:00Z"
}
```
| HTTP状态码 | error | 说明 |
|---|---|------------------|
| 400 | VALIDATION_ERROR | 请求参数校验失败 |
| 502 | HTTP_ERROR | 三方 API HTTP 错误 |
| 503 | NETWORK_ERROR | 三方 API 网络不可达 |
| 500 | INTERNAL_ERROR | 服务内部未知异常 api配置信息未找到 |
## 完整调用示例
```bash
curl -X POST http://{host}:{port}/api/v1/fortispay/payment-feature \
-H "Content-Type: application/json" \
-H "X-Request-Id: 9c6ccc0f3ad3886dfe56ed364b6dc3e8" \
-H "X-Language: en" \
-d '{
"name": "ABCXYZ",
"idCard": "3201190108990002",
"mobile": "6285887456612"
}'
```