/api/web/kycServiceเอกสาร KYC Service REST API
จัดทำจาก REST controller จริงภายใน `workspace/service/service/kycService` ครอบคลุม API ฝั่งผู้ใช้ การตรวจจับ liveness และการตรวจสอบฝั่งแอดมิน
ApiResponse { code, message, data }multipart/form-data/admin/kycภาพรวมการเชื่อมต่อจาก controller จริง
หน้านี้อ้างอิงจาก route จริงใน `ApiKycController`, `ApiKycLivenessController` และ `AdminKycController` ไม่ใช่คำอธิบายทั่วไป
สร้างโปรไฟล์ KYC
เริ่มจากเรียก `/submit` เพื่อรับ `profileId` แล้วใช้ค่านี้ต่อในขั้นตอนอัปโหลดเอกสาร ตรวจ liveness และเช็กสถานะ
ส่งข้อมูลเอกสาร
ถ้ามีระบบเก็บไฟล์อยู่แล้วใช้ `/document` ได้ แต่สำหรับการเชื่อมต่อมาตรฐานแนะนำ `/document/upload` เพื่ออัปโหลดภาพและรัน OCR พร้อมกัน
ยืนยันและส่งตรวจ
ใช้ `/document/confirm` ให้ผู้ใช้ตรวจข้อมูลที่ดึงออกมา แล้วใช้ `/document/submit` เพื่อส่งเข้าอนุมัติอัตโนมัติหรือรีวิวด้วยคน
Liveness และสถานะสุดท้าย
ขั้นตอน liveness ใช้ `/liveness/start` และ `/liveness/verify` ส่วนผลรวมทั้งหมดดึงได้จาก `/status/`
แหล่งที่สแกน: /workspace/service/service/kycService/src/main/java/com/sargia/finger/kycService/rest
ใน service ยังมี endpoint แบบ mirror ที่ `/api/web/kycService/list`, `/detail/`, `/status/update` ขณะที่ namespace ฝั่งแอดมินหลักคือ `/admin/kyc`
โครงสร้างตอบกลับร่วม
controller ที่สแกนทั้งหมดตอบกลับด้วย `ApiResponse` และข้อมูลธุรกิจจริงจะอยู่ใน `data`
| ฟิลด์ | ประเภท | ตัวอย่าง |
|---|---|---|
code | number | 0 คือสำเร็จ ค่าอื่นคือผิดพลาดหรือ business exception |
message | string | ข้อความเช่น success, query success, Document uploaded successfully |
data | object | payload จริง เช่น profileId, status, detail หรือ list |
API ฝั่งผู้ใช้
อิงจาก `ApiKycController` ครอบคลุมการสร้างโปรไฟล์ อัปโหลดเอกสาร ยืนยันข้อมูล ส่งตรวจ และเช็กสถานะ
Create profile
/api/web/kycService/submitCreate a KYC profile and return the profileId used by all downstream calls. 建立 KYC 档案并返回后续接口共用的 profileId。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
userId | string | ใช่ | body | user_10001 |
country | string | ใช่ | body | SG |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- Returns `ApiResponse.ok().data("profileId", profileId)` on success.
Upload document metadata
/api/web/kycService/documentSubmit document metadata with image URLs or base64 references. 提交证件元数据,适合已有文件托管链路的接入方。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
profileId | string | ใช่ | body | profile_123456 |
docType | string | ใช่ | body | PASSPORT |
docNumber | string | ไม่ | body | E12345678 |
frontImageUrl | string | ใช่ | body | https://cdn.example/front.jpg |
backImageUrl | string | ไม่ | body | https://cdn.example/back.jpg |
expiryDate | date | ไม่ | body | 2030-12-31 |
issueCountry | string | ไม่ | body | SG |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- The controller stores document metadata through `kycService.uploadDocument(...)`.
Upload and verify document
/api/web/kycService/document/uploadUpload front/back images, run OCR and quality checks, and return extracted identity fields. 上传证件图片并同步返回 OCR 与质量校验结果。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
profileId | string | ใช่ | multipart | profile_123456 |
docType | string | ใช่ | multipart | ID_CARD |
country | string | ใช่ | multipart | SG |
frontImage | file | ใช่ | multipart | id-front.jpg |
backImage | file | ไม่ | multipart | id-back.jpg |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- When OCR succeeds, the response includes extracted identity fields for user confirmation.
- When verification fails, the controller returns `errorCode`, quality scores, and `errors`.
Confirm extracted fields
/api/web/kycService/document/confirmLet the user confirm or edit OCR results before the final review step. 用户确认或修正 OCR 字段,必要时触发人工审核。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
documentId | number | ใช่ | query | 123456789 |
name | string | ไม่ | body | Alex Tan |
idNumber | string | ไม่ | body | S1234567A |
birthDate | date | ไม่ | body | 1990-01-01 |
expiryDate | date | ไม่ | body | 2030-12-31 |
issuer | string | ไม่ | body | ICA Singapore |
nationality | string | ไม่ | body | SGP |
userModified | boolean | ไม่ | body | true |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- If `userModified` is true, the service message indicates the record will enter manual review.
Submit document for review
/api/web/kycService/document/submitFinalize the document step after user confirmation. 完成用户确认后,正式提交证件审核并返回最终状态。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
documentId | number | ใช่ | query | 123456789 |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- The controller maps status 1/2/3 to auto-approved, manual review, and user-modified review.
Get verification status
/api/web/kycService/status/{profileId}Fetch the current KYC status, liveness result, and face-match information by profileId. 查询整个 KYC 档案的当前状态。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
profileId | string | ใช่ | path | profile_123456 |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- Returns `data.status` as a `KycStatusDto` object rather than a flat primitive field.
Liveness callback
/api/web/kycService/callback/livenessServer-to-server callback used to persist liveness results. 这是服务侧回调入口,不是前端页面直接调用的接口。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
profileId | string | ใช่ | body | profile_123456 |
sessionId | string | ไม่ | body | 550e8400-e29b-41d4-a716-446655440000 |
confidence | number | ไม่ | body | 96.2 |
result | string | ไม่ | body | success |
errorMessage | string | ไม่ | body | timeout |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- `LivenessCallback.toEntity()` is currently a placeholder conversion in the scanned service code.
API ตรวจจับ liveness
อิงจาก `ApiKycLivenessController` สำหรับสร้าง session ตรวจวิดีโอ และดูสถานะ session
Start liveness session
/api/web/kycService/liveness/startCreate a five-minute session and return three randomized challenge actions. 创建 5 分钟有效的活体动作会话。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
profileId | string | ใช่ | query | profile_123456 |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- The controller shuffles `LivenessActionEnum` values and returns exactly three actions.
Verify liveness videos
/api/web/kycService/liveness/verifyUpload three challenge videos and return the aggregated liveness result. 上传三个动作视频并返回活体验证结果。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
sessionId | string | ใช่ | multipart | 550e8400-e29b-41d4-a716-446655440000 |
profileId | string | ใช่ | multipart | profile_123456 |
video1 | file | ใช่ | multipart | blink.mp4 |
video2 | file | ใช่ | multipart | smile.mp4 |
video3 | file | ใช่ | multipart | turn-left.mp4 |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- Failure uses `ApiResponse.error().code(20001)` with the liveness result still returned in `data.list`.
Get liveness session
/api/web/kycService/liveness/session/{sessionId}Read the current liveness session from cache and inspect its status. 查询缓存中的活体会话状态。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
sessionId | string | ใช่ | path | 550e8400-e29b-41d4-a716-446655440000 |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- If the session is missing or expired, the controller returns an error message instead of null data.
API ฝั่งแอดมิน
อิงจาก `AdminKycController` สำหรับรายการ รายละเอียด และอัปเดตสถานะการตรวจสอบ
List KYC records
/admin/kyc/listQuery paginated KYC records for operations teams. 后台分页查询 KYC 档案列表并支持按 profileIds 过滤。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
profileIds | array<string> | ไม่ | body | ["profile_123","profile_456"] |
page | number | ไม่ | body | 1 |
limit | number | ไม่ | body | 20 |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- The same list capability is also mirrored in `ApiKycController` at `/api/web/kycService/list`.
Get KYC detail
/admin/kyc/detail/{profileId}Fetch the full review payload for one profile, including document, liveness, and face-match data. 获取单个 KYC 档案的完整审核详情。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
profileId | string | ใช่ | path | profile_123456 |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- A mirrored detail endpoint also exists at `/api/web/kycService/detail/{profileId}`.
Update review status
/admin/kyc/update-statusApprove, reject, or reset the KYC review state from the admin namespace. 在后台审核链路中更新 KYC 状态。
| ฟิลด์ | ประเภท | จำเป็น | ตำแหน่ง | ตัวอย่าง |
|---|---|---|---|---|
profileId | string | ใช่ | body | profile_123456 |
status | string | ใช่ | body | 2 |
remark | string | ไม่ | body | Manual review passed |
ค่าที่ตอบกลับสำคัญ
หมายเหตุ
- Allowed status values in the DTO are `-1`, `0`, and `2`.
- The web-controller mirror path is `/api/web/kycService/status/update`.