Add service_kyc
All checks were successful
Client CMS Check Build (NixCN CMS) TeamCity build finished
Backend Check Build (NixCN CMS) TeamCity build finished

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-02-01 13:15:17 +08:00
parent a2eb882398
commit 0ac96ab3e6
23 changed files with 1831 additions and 89 deletions

View File

@@ -1144,6 +1144,216 @@ const docTemplate = `{
}
}
},
"/kyc/query": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Checks the current state of a KYC session and updates local database if approved.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"KYC"
],
"summary": "Query KYC Status",
"parameters": [
{
"description": "KYC query data (KycId)",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/service_kyc.KycQueryData"
}
}
],
"responses": {
"200": {
"description": "Query processed (success/pending/failed)",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_kyc.KycQueryResponse"
}
}
}
]
}
},
"400": {
"description": "Invalid UUID or input",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"403": {
"description": "Unauthorized",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
}
},
"/kyc/session": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Initializes a KYC process (CNRid or Passport) and returns the status or redirect URI.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"KYC"
],
"summary": "Create KYC Session",
"parameters": [
{
"description": "KYC session data (Type and Base64 Identity)",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/service_kyc.KycSessionData"
}
}
],
"responses": {
"200": {
"description": "Session created successfully",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_kyc.KycSessionResponse"
}
}
}
]
}
},
"400": {
"description": "Invalid input or decode failed",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"403": {
"description": "Missing User ID",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error / KYC Service Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
}
},
"/user/info": {
"get": {
"security": [
@@ -1739,6 +1949,54 @@ const docTemplate = `{
"properties": {
"event_id": {
"type": "string"
},
"kyc_id": {
"type": "string"
}
}
},
"service_kyc.KycQueryData": {
"type": "object",
"properties": {
"kyc_id": {
"type": "string"
}
}
},
"service_kyc.KycQueryResponse": {
"type": "object",
"properties": {
"status": {
"description": "success | pending | failed",
"type": "string"
}
}
},
"service_kyc.KycSessionData": {
"type": "object",
"properties": {
"identity": {
"description": "base64 json",
"type": "string"
},
"type": {
"description": "cnrid | passport",
"type": "string"
}
}
},
"service_kyc.KycSessionResponse": {
"type": "object",
"properties": {
"kyc_id": {
"type": "string"
},
"redirect_uri": {
"type": "string"
},
"status": {
"description": "success | processing",
"type": "string"
}
}
},

View File

@@ -1142,6 +1142,216 @@
}
}
},
"/kyc/query": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Checks the current state of a KYC session and updates local database if approved.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"KYC"
],
"summary": "Query KYC Status",
"parameters": [
{
"description": "KYC query data (KycId)",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/service_kyc.KycQueryData"
}
}
],
"responses": {
"200": {
"description": "Query processed (success/pending/failed)",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_kyc.KycQueryResponse"
}
}
}
]
}
},
"400": {
"description": "Invalid UUID or input",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"403": {
"description": "Unauthorized",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
}
},
"/kyc/session": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Initializes a KYC process (CNRid or Passport) and returns the status or redirect URI.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"KYC"
],
"summary": "Create KYC Session",
"parameters": [
{
"description": "KYC session data (Type and Base64 Identity)",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/service_kyc.KycSessionData"
}
}
],
"responses": {
"200": {
"description": "Session created successfully",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_kyc.KycSessionResponse"
}
}
}
]
}
},
"400": {
"description": "Invalid input or decode failed",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"403": {
"description": "Missing User ID",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error / KYC Service Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
}
},
"/user/info": {
"get": {
"security": [
@@ -1737,6 +1947,54 @@
"properties": {
"event_id": {
"type": "string"
},
"kyc_id": {
"type": "string"
}
}
},
"service_kyc.KycQueryData": {
"type": "object",
"properties": {
"kyc_id": {
"type": "string"
}
}
},
"service_kyc.KycQueryResponse": {
"type": "object",
"properties": {
"status": {
"description": "success | pending | failed",
"type": "string"
}
}
},
"service_kyc.KycSessionData": {
"type": "object",
"properties": {
"identity": {
"description": "base64 json",
"type": "string"
},
"type": {
"description": "cnrid | passport",
"type": "string"
}
}
},
"service_kyc.KycSessionResponse": {
"type": "object",
"properties": {
"kyc_id": {
"type": "string"
},
"redirect_uri": {
"type": "string"
},
"status": {
"description": "success | processing",
"type": "string"
}
}
},

View File

@@ -104,6 +104,38 @@ definitions:
properties:
event_id:
type: string
kyc_id:
type: string
type: object
service_kyc.KycQueryData:
properties:
kyc_id:
type: string
type: object
service_kyc.KycQueryResponse:
properties:
status:
description: success | pending | failed
type: string
type: object
service_kyc.KycSessionData:
properties:
identity:
description: base64 json
type: string
type:
description: cnrid | passport
type: string
type: object
service_kyc.KycSessionResponse:
properties:
kyc_id:
type: string
redirect_uri:
type: string
status:
description: success | processing
type: string
type: object
service_user.UserInfoData:
properties:
@@ -769,6 +801,120 @@ paths:
summary: List Events
tags:
- Event
/kyc/query:
post:
consumes:
- application/json
description: Checks the current state of a KYC session and updates local database
if approved.
parameters:
- description: KYC query data (KycId)
in: body
name: payload
required: true
schema:
$ref: '#/definitions/service_kyc.KycQueryData'
produces:
- application/json
responses:
"200":
description: Query processed (success/pending/failed)
schema:
allOf:
- $ref: '#/definitions/utils.RespStatus'
- properties:
data:
$ref: '#/definitions/service_kyc.KycQueryResponse'
type: object
"400":
description: Invalid UUID or input
schema:
allOf:
- $ref: '#/definitions/utils.RespStatus'
- properties:
data:
type: object
type: object
"403":
description: Unauthorized
schema:
allOf:
- $ref: '#/definitions/utils.RespStatus'
- properties:
data:
type: object
type: object
"500":
description: Internal Server Error
schema:
allOf:
- $ref: '#/definitions/utils.RespStatus'
- properties:
data:
type: object
type: object
security:
- ApiKeyAuth: []
summary: Query KYC Status
tags:
- KYC
/kyc/session:
post:
consumes:
- application/json
description: Initializes a KYC process (CNRid or Passport) and returns the status
or redirect URI.
parameters:
- description: KYC session data (Type and Base64 Identity)
in: body
name: payload
required: true
schema:
$ref: '#/definitions/service_kyc.KycSessionData'
produces:
- application/json
responses:
"200":
description: Session created successfully
schema:
allOf:
- $ref: '#/definitions/utils.RespStatus'
- properties:
data:
$ref: '#/definitions/service_kyc.KycSessionResponse'
type: object
"400":
description: Invalid input or decode failed
schema:
allOf:
- $ref: '#/definitions/utils.RespStatus'
- properties:
data:
type: object
type: object
"403":
description: Missing User ID
schema:
allOf:
- $ref: '#/definitions/utils.RespStatus'
- properties:
data:
type: object
type: object
"500":
description: Internal Server Error / KYC Service Error
schema:
allOf:
- $ref: '#/definitions/utils.RespStatus'
- properties:
data:
type: object
type: object
security:
- ApiKeyAuth: []
summary: Create KYC Session
tags:
- KYC
/user/info:
get:
consumes: