api/对接接口文档.md

138 lines
3.8 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 | 用户姓名 |
| id_card | String | Y | 身份证号,支持明文或 MD5 密文 |
| mobile | String | Y | 手机号(带国家码),支持明文或 MD5 密文 |
| encrypt_algo | String | N | 加密算法。**不传**表示明文,服务端原样透传给三方;传入 `MD5` 表示已加密,直接透传 |
### 请求示例
```json
{
"name": "ABCXYZ",
"id_card": "3201190108990002",
"mobile": "6285887456612"
}
```
> id_card、mobile 传明文时无需传 encrypt_algo,服务端原样透传给三方。
```json
{
"name": "ABCXYZ",
"id_card": "cf0ab15098ab149e5273dd82f2c737e6",
"mobile": "bd82af6340240c43175a80aedf7e6eef",
"encrypt_algo": "MD5"
}
```
> id_card、mobile 传密文时必须传 encrypt_algo="MD5"。
## 响应体
服务透传三方接口原始响应,不做字段裁剪。
| 字段 | 类型 | 说明 |
|---|---|-------------------------------------------|
| code | String | 响应码,`"0"` 表示成功,更多请查看富通接口规范.pdf 常见响应编码表 |
| message | String | 提示消息,如 `"success"` |
| responseId | String | 三方响应的唯一标识ID |
| data | Object | 数据节点,包含 status 和 result |
| data.status | Integer | 查询状态,仅code为 `"0"` 时有值(`1` = 查得,`0` = 未查得) |
| data.result | Object | 结果数据(Map),三方返回的原始 result 对象 |
### 成功响应示例
```json
{
"code": "0",
"message": "success",
"responseId": "0b5a09b6ea7d77dbbbb92e05dc9744ad",
"data": {
"status": 1,
"result": {
"app_behavior": { "..." : "..." },
"loan_behavior": { "..." : "..." },
"repay_behavior": { "..." : "..." },
"time_structure": { "..." : "..." },
"delinq_monitor": { "..." : "..." },
"flow_anomaly": { "..." : "..." }
}
}
}
```
### 未查得响应示例
```json
{
"code": "0",
"message": "success",
"responseId": "0b5a09b6ea7d77dbbbb92e05dc9744ad",
"data": {
"status": 0,
"result": 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",
"id_card": "3201190108990002",
"mobile": "6285887456612"
}'
```