orquestador/examples/flows/credito-v2-licencia.json

773 lines
17 KiB
JSON

{
"schemaVersion": 1,
"flowKey": "CREDITO",
"version": 2,
"initialState": "CREADA",
"initialDataSchema": {
"type": "object",
"properties": {
"client": {
"type": "string",
"minLength": 1
},
"consentimientoId": {
"type": "string",
"minLength": 1
}
},
"required": [
"client",
"consentimientoId"
],
"additionalProperties": false
},
"dataSchema": {
"type": "object",
"properties": {
"client": {
"type": "string",
"minLength": 1
},
"consentimientoId": {
"type": "string",
"minLength": 1
},
"cliente": {
"type": "object",
"properties": {
"found": {
"type": "boolean"
},
"customerId": {
"type": "string",
"minLength": 1
}
},
"required": [
"found"
],
"additionalProperties": false,
"allOf": [
{
"if": {
"properties": {
"found": {
"const": true
}
}
},
"then": {
"required": [
"customerId"
]
}
}
]
},
"documentos": {
"type": "object",
"properties": {
"ine": {
"type": "string",
"format": "uuid"
},
"cuenta": {
"type": "string",
"format": "uuid"
},
"licencia": {
"type": "string",
"format": "uuid"
}
},
"required": [],
"additionalProperties": false
},
"validaciones": {
"type": "object",
"properties": {
"ine": {
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"VALID",
"INVALID"
]
},
"reasonCodes": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
}
},
"required": [
"status",
"reasonCodes"
],
"additionalProperties": false
},
"cuenta": {
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"VALID",
"INVALID"
]
},
"reasonCodes": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
}
},
"required": [
"status",
"reasonCodes"
],
"additionalProperties": false
},
"licencia": {
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"VALID",
"INVALID"
]
},
"reasonCodes": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
}
},
"required": [
"status",
"reasonCodes"
],
"additionalProperties": false
},
"buro": {
"type": "object",
"properties": {
"score": {
"type": "number"
},
"consultationId": {
"type": "string",
"minLength": 1
}
},
"required": [
"score",
"consultationId"
],
"additionalProperties": false
}
},
"required": [],
"additionalProperties": false
}
},
"required": [
"client",
"consentimientoId"
],
"additionalProperties": false
},
"states": [
{
"key": "CREADA",
"terminal": false
},
{
"key": "INE_PENDIENTE",
"terminal": false
},
{
"key": "ESTADO_CUENTA_PENDIENTE",
"terminal": false
},
{
"key": "LICENCIA_PENDIENTE",
"terminal": false
},
{
"key": "BURO_PENDIENTE",
"terminal": false
},
{
"key": "PASO_N",
"terminal": true
},
{
"key": "PASO_M",
"terminal": true
},
{
"key": "REVISION_MANUAL",
"terminal": true
}
],
"events": [
{
"key": "ASIGNAR_CLIENTE",
"inputSchema": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
}
},
{
"key": "REGISTRAR_INE",
"inputSchema": {
"type": "object",
"properties": {
"documentId": {
"type": "string",
"format": "uuid"
}
},
"required": [
"documentId"
],
"additionalProperties": false
}
},
{
"key": "REGISTRAR_ESTADO_CUENTA",
"inputSchema": {
"type": "object",
"properties": {
"documentId": {
"type": "string",
"format": "uuid"
}
},
"required": [
"documentId"
],
"additionalProperties": false
}
},
{
"key": "REGISTRAR_LICENCIA",
"inputSchema": {
"type": "object",
"properties": {
"documentId": {
"type": "string",
"format": "uuid"
}
},
"required": [
"documentId"
],
"additionalProperties": false
}
},
{
"key": "VALIDAR_BURO",
"inputSchema": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
}
}
],
"transitions": [
{
"id": "asignar-cliente",
"from": "CREADA",
"event": "ASIGNAR_CLIENTE",
"allowedRoles": [
"ANALISTA"
],
"actions": [
{
"id": "cliente",
"type": "INVOKE_INTEGRATION",
"integrationKey": "CLIENTES_CONSULTA",
"contractVersion": "1",
"inputs": {
"client": {
"path": "/request/data/client"
}
},
"resultKey": "cliente"
}
],
"decision": "CLIENTE_EXISTE",
"destinations": {
"CLIENTE_ENCONTRADO": "INE_PENDIENTE",
"CLIENTE_NO_ENCONTRADO": "CREADA"
},
"updates": [
{
"target": "/cliente",
"value": {
"path": "/results/cliente"
}
}
]
},
{
"id": "documento-ine",
"from": "INE_PENDIENTE",
"event": "REGISTRAR_INE",
"allowedRoles": [
"ANALISTA"
],
"actions": [
{
"id": "registro",
"type": "REGISTER_DOCUMENT",
"documentType": "INE",
"inputs": {
"documentId": {
"path": "/event/data/documentId"
}
},
"resultKey": "registro"
},
{
"id": "validacion",
"type": "INVOKE_INTEGRATION",
"integrationKey": "DOCUMENTO_VALIDA",
"contractVersion": "1",
"profile": "INE",
"profileVersion": "1",
"inputs": {
"documentId": {
"path": "/results/registro/documentId"
}
},
"resultKey": "validacion"
}
],
"decision": "VALIDAR_INE",
"destinations": {
"DOCUMENTO_VALIDO": "ESTADO_CUENTA_PENDIENTE",
"DOCUMENTO_INVALIDO": "INE_PENDIENTE"
},
"updates": [
{
"target": "/documentos/ine",
"value": {
"path": "/results/registro/documentId"
}
},
{
"target": "/validaciones/ine",
"value": {
"path": "/results/validacion"
}
}
]
},
{
"id": "documento-cuenta",
"from": "ESTADO_CUENTA_PENDIENTE",
"event": "REGISTRAR_ESTADO_CUENTA",
"allowedRoles": [
"ANALISTA"
],
"actions": [
{
"id": "registro",
"type": "REGISTER_DOCUMENT",
"documentType": "ESTADO_CUENTA",
"inputs": {
"documentId": {
"path": "/event/data/documentId"
}
},
"resultKey": "registro"
},
{
"id": "validacion",
"type": "INVOKE_INTEGRATION",
"integrationKey": "DOCUMENTO_VALIDA",
"contractVersion": "1",
"profile": "ESTADO_CUENTA",
"profileVersion": "1",
"inputs": {
"documentId": {
"path": "/results/registro/documentId"
}
},
"resultKey": "validacion"
}
],
"decision": "VALIDAR_ESTADO_CUENTA",
"destinations": {
"DOCUMENTO_VALIDO": "LICENCIA_PENDIENTE",
"DOCUMENTO_INVALIDO": "ESTADO_CUENTA_PENDIENTE"
},
"updates": [
{
"target": "/documentos/cuenta",
"value": {
"path": "/results/registro/documentId"
}
},
{
"target": "/validaciones/cuenta",
"value": {
"path": "/results/validacion"
}
}
]
},
{
"id": "documento-licencia",
"from": "LICENCIA_PENDIENTE",
"event": "REGISTRAR_LICENCIA",
"allowedRoles": [
"ANALISTA"
],
"actions": [
{
"id": "registro",
"type": "REGISTER_DOCUMENT",
"documentType": "LICENCIA_CONDUCIR",
"inputs": {
"documentId": {
"path": "/event/data/documentId"
}
},
"resultKey": "registro"
},
{
"id": "validacion",
"type": "INVOKE_INTEGRATION",
"integrationKey": "DOCUMENTO_VALIDA",
"contractVersion": "1",
"profile": "LICENCIA_CONDUCIR",
"profileVersion": "1",
"inputs": {
"documentId": {
"path": "/results/registro/documentId"
}
},
"resultKey": "validacion"
}
],
"decision": "VALIDAR_LICENCIA_CONDUCIR",
"destinations": {
"DOCUMENTO_VALIDO": "BURO_PENDIENTE",
"DOCUMENTO_INVALIDO": "LICENCIA_PENDIENTE"
},
"updates": [
{
"target": "/documentos/licencia",
"value": {
"path": "/results/registro/documentId"
}
},
{
"target": "/validaciones/licencia",
"value": {
"path": "/results/validacion"
}
}
]
},
{
"id": "consultar-buro",
"from": "BURO_PENDIENTE",
"event": "VALIDAR_BURO",
"allowedRoles": [
"ANALISTA"
],
"actions": [
{
"id": "buro",
"type": "INVOKE_INTEGRATION",
"integrationKey": "BURO_CONSULTA",
"contractVersion": "1",
"inputs": {
"client": {
"path": "/request/data/cliente/customerId"
},
"consentimientoId": {
"path": "/request/data/consentimientoId"
}
},
"resultKey": "buro"
}
],
"decision": "RUTA_SCORING",
"destinations": {
"N": "PASO_N",
"M": "PASO_M",
"MANUAL": "REVISION_MANUAL"
},
"updates": [
{
"target": "/validaciones/buro",
"value": {
"path": "/results/buro"
}
}
]
}
],
"decisions": [
{
"id": "CLIENTE_EXISTE",
"hitPolicy": "UNIQUE",
"rules": [
{
"id": "encontrado",
"when": {
"op": "EQ",
"left": {
"path": "/results/cliente/found"
},
"right": {
"literal": true
}
},
"output": "CLIENTE_ENCONTRADO"
}
],
"defaultOutput": "CLIENTE_NO_ENCONTRADO"
},
{
"id": "VALIDAR_INE",
"hitPolicy": "UNIQUE",
"rules": [
{
"id": "valido",
"when": {
"op": "EQ",
"left": {
"path": "/results/validacion/status"
},
"right": {
"literal": "VALID"
}
},
"output": "DOCUMENTO_VALIDO"
}
],
"defaultOutput": "DOCUMENTO_INVALIDO"
},
{
"id": "VALIDAR_ESTADO_CUENTA",
"hitPolicy": "UNIQUE",
"rules": [
{
"id": "valido",
"when": {
"op": "EQ",
"left": {
"path": "/results/validacion/status"
},
"right": {
"literal": "VALID"
}
},
"output": "DOCUMENTO_VALIDO"
}
],
"defaultOutput": "DOCUMENTO_INVALIDO"
},
{
"id": "VALIDAR_LICENCIA_CONDUCIR",
"hitPolicy": "UNIQUE",
"rules": [
{
"id": "valido",
"when": {
"op": "EQ",
"left": {
"path": "/results/validacion/status"
},
"right": {
"literal": "VALID"
}
},
"output": "DOCUMENTO_VALIDO"
}
],
"defaultOutput": "DOCUMENTO_INVALIDO"
},
{
"id": "RUTA_SCORING",
"hitPolicy": "UNIQUE",
"rules": [
{
"id": "alto",
"when": {
"op": "GT",
"left": {
"path": "/results/buro/score"
},
"right": {
"literal": 70
}
},
"output": "N"
},
{
"id": "medio",
"when": {
"op": "AND",
"args": [
{
"op": "GT",
"left": {
"path": "/results/buro/score"
},
"right": {
"literal": 60
}
},
{
"op": "LTE",
"left": {
"path": "/results/buro/score"
},
"right": {
"literal": 70
}
}
]
},
"output": "M"
}
],
"defaultOutput": "MANUAL"
}
],
"tasks": [
{
"state": "CREADA",
"event": "ASIGNAR_CLIENTE",
"inputSchema": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
},
"ui": {
"component": "FORM",
"title": "Consultar cliente",
"fieldOrder": []
}
},
{
"state": "INE_PENDIENTE",
"event": "REGISTRAR_INE",
"inputSchema": {
"type": "object",
"properties": {
"documentId": {
"type": "string",
"format": "uuid"
}
},
"required": [
"documentId"
],
"additionalProperties": false
},
"ui": {
"component": "DOCUMENT_UPLOAD",
"title": "Identificación INE",
"documentType": "INE",
"acceptedMimeTypes": [
"application/pdf",
"image/jpeg",
"image/png"
],
"maxBytes": 5242880
}
},
{
"state": "ESTADO_CUENTA_PENDIENTE",
"event": "REGISTRAR_ESTADO_CUENTA",
"inputSchema": {
"type": "object",
"properties": {
"documentId": {
"type": "string",
"format": "uuid"
}
},
"required": [
"documentId"
],
"additionalProperties": false
},
"ui": {
"component": "DOCUMENT_UPLOAD",
"title": "Estado de cuenta",
"documentType": "ESTADO_CUENTA",
"acceptedMimeTypes": [
"application/pdf"
],
"maxBytes": 5242880
}
},
{
"state": "LICENCIA_PENDIENTE",
"event": "REGISTRAR_LICENCIA",
"inputSchema": {
"type": "object",
"properties": {
"documentId": {
"type": "string",
"format": "uuid"
}
},
"required": [
"documentId"
],
"additionalProperties": false
},
"ui": {
"component": "DOCUMENT_UPLOAD",
"title": "Licencia de conducir",
"documentType": "LICENCIA_CONDUCIR",
"acceptedMimeTypes": [
"application/pdf",
"image/jpeg",
"image/png"
],
"maxBytes": 5242880
}
},
{
"state": "BURO_PENDIENTE",
"event": "VALIDAR_BURO",
"inputSchema": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
},
"ui": {
"component": "FORM",
"title": "Consultar buró con consentimiento registrado",
"fieldOrder": []
}
}
]
}