orquestador/examples/postman/Orquestador-NMP.postman_col...

1174 lines
54 KiB
JSON

{
"info": {
"name": "Orquestador NMP — server02",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"description": "Ejecutar solicitudes manualmente por carpetas. No ejecutar toda la colección: publica y activa flujos, crea solicitudes y acepta eventos. Usar entorno de demo y datos sintéticos. Tokens vacíos: configurar en variables de colección. Los tokens específicos vacíos usan accessToken. Ver README.md adjunto. Las pruebas funcionales requieren flags, rol DB restringido, catálogo y proveedores configurados."
},
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{accessToken}}",
"type": "string"
}
]
},
"variable": [
{
"key": "baseUrl",
"value": "http://server02:8787",
"type": "string"
},
{
"key": "accessToken",
"value": "",
"type": "string"
},
{
"key": "editorToken",
"value": "",
"type": "string"
},
{
"key": "publisherToken",
"value": "",
"type": "string"
},
{
"key": "adminToken",
"value": "",
"type": "string"
},
{
"key": "operatorToken",
"value": "",
"type": "string"
},
{
"key": "flowId",
"value": "",
"type": "string"
},
{
"key": "flowRevision",
"value": "0",
"type": "string"
},
{
"key": "typeKey",
"value": "CREDITO",
"type": "string"
},
{
"key": "typeRevision",
"value": "0",
"type": "string"
},
{
"key": "requestId",
"value": "",
"type": "string"
},
{
"key": "requestRevision",
"value": "0",
"type": "string"
},
{
"key": "executionId",
"value": "",
"type": "string"
},
{
"key": "createKey",
"value": "",
"type": "string"
},
{
"key": "eventKey",
"value": "",
"type": "string"
},
{
"key": "eventRevision",
"value": "",
"type": "string"
},
{
"key": "eventBody",
"value": "",
"type": "string"
},
{
"key": "documentId",
"value": "",
"type": "string"
}
],
"item": [
{
"name": "01 — Salud y seguridad",
"item": [
{
"name": "Salud",
"request": {
"method": "GET",
"header": [],
"url": "{{baseUrl}}/actuator/health",
"description": "",
"auth": {
"type": "noauth"
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"pm.test('UP',()=>pm.expect(pm.response.json().status).to.eql('UP'))",
"}"
]
}
}
]
},
{
"name": "Readiness PostgreSQL",
"request": {
"method": "GET",
"header": [],
"url": "{{baseUrl}}/actuator/health/readiness",
"description": "",
"auth": {
"type": "noauth"
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"pm.test('UP',()=>pm.expect(pm.response.json().status).to.eql('UP'))",
"}"
]
}
}
]
},
{
"name": "Liveness",
"request": {
"method": "GET",
"header": [],
"url": "{{baseUrl}}/actuator/health/liveness",
"description": "",
"auth": {
"type": "noauth"
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"",
"}"
]
}
}
]
},
{
"name": "Rechazo sin token",
"request": {
"method": "GET",
"header": [],
"url": "{{baseUrl}}/api/v1/requests",
"description": "",
"auth": {
"type": "noauth"
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 401', () => pm.response.to.have.status(401));",
"if (pm.response.code === 401) {",
"",
"}"
]
}
}
]
}
]
},
{
"name": "02 — Preparar borrador CREDITO v1",
"item": [
{
"name": "Crear borrador (una vez)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/admin/flows",
"description": "Requiere FLOW_ADMIN_ENABLED, FLOW_EDITOR y business_scope permitido. Guarda flowId y flowRevision. Si ya existe, usar el ID conocido.",
"body": {
"mode": "raw",
"raw": "{\n \"schemaVersion\": 1,\n \"flowKey\": \"CREDITO\",\n \"version\": 1,\n \"initialState\": \"CREADA\",\n \"initialDataSchema\": {\n \"type\": \"object\",\n \"properties\": {\n \"client\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"consentimientoId\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"required\": [\n \"client\",\n \"consentimientoId\"\n ],\n \"additionalProperties\": false\n },\n \"dataSchema\": {\n \"type\": \"object\",\n \"properties\": {\n \"client\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"consentimientoId\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"cliente\": {\n \"type\": \"object\",\n \"properties\": {\n \"found\": {\n \"type\": \"boolean\"\n },\n \"customerId\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"required\": [\n \"found\"\n ],\n \"additionalProperties\": false,\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"found\": {\n \"const\": true\n }\n }\n },\n \"then\": {\n \"required\": [\n \"customerId\"\n ]\n }\n }\n ]\n },\n \"documentos\": {\n \"type\": \"object\",\n \"properties\": {\n \"ine\": {\n \"type\": \"string\",\n \"format\": \"uuid\"\n },\n \"cuenta\": {\n \"type\": \"string\",\n \"format\": \"uuid\"\n }\n },\n \"required\": [],\n \"additionalProperties\": false\n },\n \"validaciones\": {\n \"type\": \"object\",\n \"properties\": {\n \"ine\": {\n \"type\": \"object\",\n \"properties\": {\n \"status\": {\n \"type\": \"string\",\n \"enum\": [\n \"VALID\",\n \"INVALID\"\n ]\n },\n \"reasonCodes\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n }\n },\n \"required\": [\n \"status\",\n \"reasonCodes\"\n ],\n \"additionalProperties\": false\n },\n \"cuenta\": {\n \"type\": \"object\",\n \"properties\": {\n \"status\": {\n \"type\": \"string\",\n \"enum\": [\n \"VALID\",\n \"INVALID\"\n ]\n },\n \"reasonCodes\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n }\n },\n \"required\": [\n \"status\",\n \"reasonCodes\"\n ],\n \"additionalProperties\": false\n },\n \"buro\": {\n \"type\": \"object\",\n \"properties\": {\n \"score\": {\n \"type\": \"number\"\n },\n \"consultationId\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"required\": [\n \"score\",\n \"consultationId\"\n ],\n \"additionalProperties\": false\n }\n },\n \"required\": [],\n \"additionalProperties\": false\n }\n },\n \"required\": [\n \"client\",\n \"consentimientoId\"\n ],\n \"additionalProperties\": false\n },\n \"states\": [\n {\n \"key\": \"CREADA\",\n \"terminal\": false\n },\n {\n \"key\": \"INE_PENDIENTE\",\n \"terminal\": false\n },\n {\n \"key\": \"ESTADO_CUENTA_PENDIENTE\",\n \"terminal\": false\n },\n {\n \"key\": \"BURO_PENDIENTE\",\n \"terminal\": false\n },\n {\n \"key\": \"PASO_N\",\n \"terminal\": true\n },\n {\n \"key\": \"PASO_M\",\n \"terminal\": true\n },\n {\n \"key\": \"REVISION_MANUAL\",\n \"terminal\": true\n }\n ],\n \"events\": [\n {\n \"key\": \"ASIGNAR_CLIENTE\",\n \"inputSchema\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": [],\n \"additionalProperties\": false\n }\n },\n {\n \"key\": \"REGISTRAR_INE\",\n \"inputSchema\": {\n \"type\": \"object\",\n \"properties\": {\n \"documentId\": {\n \"type\": \"string\",\n \"format\": \"uuid\"\n }\n },\n \"required\": [\n \"documentId\"\n ],\n \"additionalProperties\": false\n }\n },\n {\n \"key\": \"REGISTRAR_ESTADO_CUENTA\",\n \"inputSchema\": {\n \"type\": \"object\",\n \"properties\": {\n \"documentId\": {\n \"type\": \"string\",\n \"format\": \"uuid\"\n }\n },\n \"required\": [\n \"documentId\"\n ],\n \"additionalProperties\": false\n }\n },\n {\n \"key\": \"VALIDAR_BURO\",\n \"inputSchema\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": [],\n \"additionalProperties\": false\n }\n }\n ],\n \"transitions\": [\n {\n \"id\": \"asignar-cliente\",\n \"from\": \"CREADA\",\n \"event\": \"ASIGNAR_CLIENTE\",\n \"allowedRoles\": [\n \"ANALISTA\"\n ],\n \"actions\": [\n {\n \"id\": \"cliente\",\n \"type\": \"INVOKE_INTEGRATION\",\n \"integrationKey\": \"CLIENTES_CONSULTA\",\n \"contractVersion\": \"1\",\n \"inputs\": {\n \"client\": {\n \"path\": \"/request/data/client\"\n }\n },\n \"resultKey\": \"cliente\"\n }\n ],\n \"decision\": \"CLIENTE_EXISTE\",\n \"destinations\": {\n \"CLIENTE_ENCONTRADO\": \"INE_PENDIENTE\",\n \"CLIENTE_NO_ENCONTRADO\": \"CREADA\"\n },\n \"updates\": [\n {\n \"target\": \"/cliente\",\n \"value\": {\n \"path\": \"/results/cliente\"\n }\n }\n ]\n },\n {\n \"id\": \"documento-ine\",\n \"from\": \"INE_PENDIENTE\",\n \"event\": \"REGISTRAR_INE\",\n \"allowedRoles\": [\n \"ANALISTA\"\n ],\n \"actions\": [\n {\n \"id\": \"registro\",\n \"type\": \"REGISTER_DOCUMENT\",\n \"documentType\": \"INE\",\n \"inputs\": {\n \"documentId\": {\n \"path\": \"/event/data/documentId\"\n }\n },\n \"resultKey\": \"registro\"\n },\n {\n \"id\": \"validacion\",\n \"type\": \"INVOKE_INTEGRATION\",\n \"integrationKey\": \"DOCUMENTO_VALIDA\",\n \"contractVersion\": \"1\",\n \"profile\": \"INE\",\n \"profileVersion\": \"1\",\n \"inputs\": {\n \"documentId\": {\n \"path\": \"/results/registro/documentId\"\n }\n },\n \"resultKey\": \"validacion\"\n }\n ],\n \"decision\": \"VALIDAR_INE\",\n \"destinations\": {\n \"DOCUMENTO_VALIDO\": \"ESTADO_CUENTA_PENDIENTE\",\n \"DOCUMENTO_INVALIDO\": \"INE_PENDIENTE\"\n },\n \"updates\": [\n {\n \"target\": \"/documentos/ine\",\n \"value\": {\n \"path\": \"/results/registro/documentId\"\n }\n },\n {\n \"target\": \"/validaciones/ine\",\n \"value\": {\n \"path\": \"/results/validacion\"\n }\n }\n ]\n },\n {\n \"id\": \"documento-cuenta\",\n \"from\": \"ESTADO_CUENTA_PENDIENTE\",\n \"event\": \"REGISTRAR_ESTADO_CUENTA\",\n \"allowedRoles\": [\n \"ANALISTA\"\n ],\n \"actions\": [\n {\n \"id\": \"registro\",\n \"type\": \"REGISTER_DOCUMENT\",\n \"documentType\": \"ESTADO_CUENTA\",\n \"inputs\": {\n \"documentId\": {\n \"path\": \"/event/data/documentId\"\n }\n },\n \"resultKey\": \"registro\"\n },\n {\n \"id\": \"validacion\",\n \"type\": \"INVOKE_INTEGRATION\",\n \"integrationKey\": \"DOCUMENTO_VALIDA\",\n \"contractVersion\": \"1\",\n \"profile\": \"ESTADO_CUENTA\",\n \"profileVersion\": \"1\",\n \"inputs\": {\n \"documentId\": {\n \"path\": \"/results/registro/documentId\"\n }\n },\n \"resultKey\": \"validacion\"\n }\n ],\n \"decision\": \"VALIDAR_ESTADO_CUENTA\",\n \"destinations\": {\n \"DOCUMENTO_VALIDO\": \"BURO_PENDIENTE\",\n \"DOCUMENTO_INVALIDO\": \"ESTADO_CUENTA_PENDIENTE\"\n },\n \"updates\": [\n {\n \"target\": \"/documentos/cuenta\",\n \"value\": {\n \"path\": \"/results/registro/documentId\"\n }\n },\n {\n \"target\": \"/validaciones/cuenta\",\n \"value\": {\n \"path\": \"/results/validacion\"\n }\n }\n ]\n },\n {\n \"id\": \"consultar-buro\",\n \"from\": \"BURO_PENDIENTE\",\n \"event\": \"VALIDAR_BURO\",\n \"allowedRoles\": [\n \"ANALISTA\"\n ],\n \"actions\": [\n {\n \"id\": \"buro\",\n \"type\": \"INVOKE_INTEGRATION\",\n \"integrationKey\": \"BURO_CONSULTA\",\n \"contractVersion\": \"1\",\n \"inputs\": {\n \"client\": {\n \"path\": \"/request/data/cliente/customerId\"\n },\n \"consentimientoId\": {\n \"path\": \"/request/data/consentimientoId\"\n }\n },\n \"resultKey\": \"buro\"\n }\n ],\n \"decision\": \"RUTA_SCORING\",\n \"destinations\": {\n \"N\": \"PASO_N\",\n \"M\": \"PASO_M\",\n \"MANUAL\": \"REVISION_MANUAL\"\n },\n \"updates\": [\n {\n \"target\": \"/validaciones/buro\",\n \"value\": {\n \"path\": \"/results/buro\"\n }\n }\n ]\n }\n ],\n \"decisions\": [\n {\n \"id\": \"CLIENTE_EXISTE\",\n \"hitPolicy\": \"UNIQUE\",\n \"rules\": [\n {\n \"id\": \"encontrado\",\n \"when\": {\n \"op\": \"EQ\",\n \"left\": {\n \"path\": \"/results/cliente/found\"\n },\n \"right\": {\n \"literal\": true\n }\n },\n \"output\": \"CLIENTE_ENCONTRADO\"\n }\n ],\n \"defaultOutput\": \"CLIENTE_NO_ENCONTRADO\"\n },\n {\n \"id\": \"VALIDAR_INE\",\n \"hitPolicy\": \"UNIQUE\",\n \"rules\": [\n {\n \"id\": \"valido\",\n \"when\": {\n \"op\": \"EQ\",\n \"left\": {\n \"path\": \"/results/validacion/status\"\n },\n \"right\": {\n \"literal\": \"VALID\"\n }\n },\n \"output\": \"DOCUMENTO_VALIDO\"\n }\n ],\n \"defaultOutput\": \"DOCUMENTO_INVALIDO\"\n },\n {\n \"id\": \"VALIDAR_ESTADO_CUENTA\",\n \"hitPolicy\": \"UNIQUE\",\n \"rules\": [\n {\n \"id\": \"valido\",\n \"when\": {\n \"op\": \"EQ\",\n \"left\": {\n \"path\": \"/results/validacion/status\"\n },\n \"right\": {\n \"literal\": \"VALID\"\n }\n },\n \"output\": \"DOCUMENTO_VALIDO\"\n }\n ],\n \"defaultOutput\": \"DOCUMENTO_INVALIDO\"\n },\n {\n \"id\": \"RUTA_SCORING\",\n \"hitPolicy\": \"UNIQUE\",\n \"rules\": [\n {\n \"id\": \"alto\",\n \"when\": {\n \"op\": \"GT\",\n \"left\": {\n \"path\": \"/results/buro/score\"\n },\n \"right\": {\n \"literal\": 70\n }\n },\n \"output\": \"N\"\n },\n {\n \"id\": \"medio\",\n \"when\": {\n \"op\": \"AND\",\n \"args\": [\n {\n \"op\": \"GT\",\n \"left\": {\n \"path\": \"/results/buro/score\"\n },\n \"right\": {\n \"literal\": 60\n }\n },\n {\n \"op\": \"LTE\",\n \"left\": {\n \"path\": \"/results/buro/score\"\n },\n \"right\": {\n \"literal\": 70\n }\n }\n ]\n },\n \"output\": \"M\"\n }\n ],\n \"defaultOutput\": \"MANUAL\"\n }\n ],\n \"tasks\": [\n {\n \"state\": \"CREADA\",\n \"event\": \"ASIGNAR_CLIENTE\",\n \"inputSchema\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": [],\n \"additionalProperties\": false\n },\n \"ui\": {\n \"component\": \"FORM\",\n \"title\": \"Consultar cliente\",\n \"fieldOrder\": []\n }\n },\n {\n \"state\": \"INE_PENDIENTE\",\n \"event\": \"REGISTRAR_INE\",\n \"inputSchema\": {\n \"type\": \"object\",\n \"properties\": {\n \"documentId\": {\n \"type\": \"string\",\n \"format\": \"uuid\"\n }\n },\n \"required\": [\n \"documentId\"\n ],\n \"additionalProperties\": false\n },\n \"ui\": {\n \"component\": \"DOCUMENT_UPLOAD\",\n \"title\": \"Identificación INE\",\n \"documentType\": \"INE\",\n \"acceptedMimeTypes\": [\n \"application/pdf\",\n \"image/jpeg\",\n \"image/png\"\n ],\n \"maxBytes\": 5242880\n }\n },\n {\n \"state\": \"ESTADO_CUENTA_PENDIENTE\",\n \"event\": \"REGISTRAR_ESTADO_CUENTA\",\n \"inputSchema\": {\n \"type\": \"object\",\n \"properties\": {\n \"documentId\": {\n \"type\": \"string\",\n \"format\": \"uuid\"\n }\n },\n \"required\": [\n \"documentId\"\n ],\n \"additionalProperties\": false\n },\n \"ui\": {\n \"component\": \"DOCUMENT_UPLOAD\",\n \"title\": \"Estado de cuenta\",\n \"documentType\": \"ESTADO_CUENTA\",\n \"acceptedMimeTypes\": [\n \"application/pdf\"\n ],\n \"maxBytes\": 5242880\n }\n },\n {\n \"state\": \"BURO_PENDIENTE\",\n \"event\": \"VALIDAR_BURO\",\n \"inputSchema\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": [],\n \"additionalProperties\": false\n },\n \"ui\": {\n \"component\": \"FORM\",\n \"title\": \"Consultar buró con consentimiento registrado\",\n \"fieldOrder\": []\n }\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{selectedToken}}",
"type": "string"
}
]
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.variables.set('selectedToken', pm.variables.get('editorToken') || pm.variables.get('accessToken'));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 201', () => pm.response.to.have.status(201));",
"if (pm.response.code === 201) {",
"const b=pm.response.json(); pm.collectionVariables.set('flowId',b.id); pm.collectionVariables.set('flowRevision',String(b.revision));",
"}"
]
}
}
]
},
{
"name": "Validar borrador",
"request": {
"method": "POST",
"header": [],
"url": "{{baseUrl}}/api/v1/admin/flows/{{flowId}}/validate",
"description": "Revisar el informe completo antes de publicar; HTTP 200 no implica validación sin errores.",
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{selectedToken}}",
"type": "string"
}
]
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.variables.set('selectedToken', pm.variables.get('editorToken') || pm.variables.get('accessToken'));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"",
"}"
]
}
}
]
}
]
},
{
"name": "03 — Simular scoring sin proveedores",
"item": [
{
"name": "Score 71 — PASO_N",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/admin/flows/{{flowId}}/simulate",
"description": "Simulación pura: no invoca proveedores ni crea solicitudes. Necesita catálogo de ejemplos y flowId del crédito v1.",
"body": {
"mode": "raw",
"raw": "{\n \"state\": \"BURO_PENDIENTE\",\n \"requestData\": {\n \"client\": \"synthetic-client\",\n \"consentimientoId\": \"synthetic-consent\",\n \"cliente\": {\n \"found\": true,\n \"customerId\": \"synthetic-customer\"\n }\n },\n \"event\": {\n \"event\": \"VALIDAR_BURO\",\n \"data\": {}\n },\n \"actor\": {\n \"subject\": \"synthetic-analyst\",\n \"businessScope\": \"demo\",\n \"roles\": [\n \"ANALISTA\"\n ]\n },\n \"results\": {\n \"buro\": {\n \"score\": 71,\n \"consultationId\": \"synthetic-consultation\"\n }\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{selectedToken}}",
"type": "string"
}
]
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.variables.set('selectedToken', pm.variables.get('editorToken') || pm.variables.get('accessToken'));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"pm.test('Estado esperado',()=>pm.expect(pm.response.json().toState).to.eql('PASO_N'));",
"}"
]
}
}
]
},
{
"name": "Score 70 — PASO_M",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/admin/flows/{{flowId}}/simulate",
"description": "Simulación pura: no invoca proveedores ni crea solicitudes. Necesita catálogo de ejemplos y flowId del crédito v1.",
"body": {
"mode": "raw",
"raw": "{\n \"state\": \"BURO_PENDIENTE\",\n \"requestData\": {\n \"client\": \"synthetic-client\",\n \"consentimientoId\": \"synthetic-consent\",\n \"cliente\": {\n \"found\": true,\n \"customerId\": \"synthetic-customer\"\n }\n },\n \"event\": {\n \"event\": \"VALIDAR_BURO\",\n \"data\": {}\n },\n \"actor\": {\n \"subject\": \"synthetic-analyst\",\n \"businessScope\": \"demo\",\n \"roles\": [\n \"ANALISTA\"\n ]\n },\n \"results\": {\n \"buro\": {\n \"score\": 70,\n \"consultationId\": \"synthetic-consultation\"\n }\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{selectedToken}}",
"type": "string"
}
]
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.variables.set('selectedToken', pm.variables.get('editorToken') || pm.variables.get('accessToken'));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"pm.test('Estado esperado',()=>pm.expect(pm.response.json().toState).to.eql('PASO_M'));",
"}"
]
}
}
]
},
{
"name": "Score 61 — PASO_M",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/admin/flows/{{flowId}}/simulate",
"description": "Simulación pura: no invoca proveedores ni crea solicitudes. Necesita catálogo de ejemplos y flowId del crédito v1.",
"body": {
"mode": "raw",
"raw": "{\n \"state\": \"BURO_PENDIENTE\",\n \"requestData\": {\n \"client\": \"synthetic-client\",\n \"consentimientoId\": \"synthetic-consent\",\n \"cliente\": {\n \"found\": true,\n \"customerId\": \"synthetic-customer\"\n }\n },\n \"event\": {\n \"event\": \"VALIDAR_BURO\",\n \"data\": {}\n },\n \"actor\": {\n \"subject\": \"synthetic-analyst\",\n \"businessScope\": \"demo\",\n \"roles\": [\n \"ANALISTA\"\n ]\n },\n \"results\": {\n \"buro\": {\n \"score\": 61,\n \"consultationId\": \"synthetic-consultation\"\n }\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{selectedToken}}",
"type": "string"
}
]
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.variables.set('selectedToken', pm.variables.get('editorToken') || pm.variables.get('accessToken'));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"pm.test('Estado esperado',()=>pm.expect(pm.response.json().toState).to.eql('PASO_M'));",
"}"
]
}
}
]
},
{
"name": "Score 60 — REVISION_MANUAL",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/admin/flows/{{flowId}}/simulate",
"description": "Simulación pura: no invoca proveedores ni crea solicitudes. Necesita catálogo de ejemplos y flowId del crédito v1.",
"body": {
"mode": "raw",
"raw": "{\n \"state\": \"BURO_PENDIENTE\",\n \"requestData\": {\n \"client\": \"synthetic-client\",\n \"consentimientoId\": \"synthetic-consent\",\n \"cliente\": {\n \"found\": true,\n \"customerId\": \"synthetic-customer\"\n }\n },\n \"event\": {\n \"event\": \"VALIDAR_BURO\",\n \"data\": {}\n },\n \"actor\": {\n \"subject\": \"synthetic-analyst\",\n \"businessScope\": \"demo\",\n \"roles\": [\n \"ANALISTA\"\n ]\n },\n \"results\": {\n \"buro\": {\n \"score\": 60,\n \"consultationId\": \"synthetic-consultation\"\n }\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{selectedToken}}",
"type": "string"
}
]
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.variables.set('selectedToken', pm.variables.get('editorToken') || pm.variables.get('accessToken'));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"pm.test('Estado esperado',()=>pm.expect(pm.response.json().toState).to.eql('REVISION_MANUAL'));",
"}"
]
}
}
]
}
]
},
{
"name": "04 — Publicar y activar (modifica catálogo)",
"item": [
{
"name": "Publicar flujo validado",
"request": {
"method": "POST",
"header": [
{
"key": "If-Match",
"value": "\"{{flowRevision}}\""
}
],
"url": "{{baseUrl}}/api/v1/admin/flows/{{flowId}}/publish",
"description": "",
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{selectedToken}}",
"type": "string"
}
]
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.variables.set('selectedToken', pm.variables.get('publisherToken') || pm.variables.get('accessToken'));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"const b=pm.response.json(); pm.collectionVariables.set('flowId',b.id); pm.collectionVariables.set('flowRevision',String(b.revision));",
"}"
]
}
}
]
},
{
"name": "Activar para CREDITO",
"request": {
"method": "PUT",
"header": [
{
"key": "If-Match",
"value": "\"{{typeRevision}}\""
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/admin/request-types/{{typeKey}}/active-flow",
"description": "El tipo debe existir en PostgreSQL. typeRevision=0 solo para un tipo nuevo; introducir la revisión vigente. No hay endpoint GET de tipos.",
"body": {
"mode": "raw",
"raw": "{\n \"flowId\": \"{{flowId}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{selectedToken}}",
"type": "string"
}
]
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.variables.set('selectedToken', pm.variables.get('adminToken') || pm.variables.get('accessToken'));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"pm.collectionVariables.set('typeRevision',String(pm.response.json().revision));",
"}"
]
}
}
]
}
]
},
{
"name": "05 — Solicitudes",
"item": [
{
"name": "Crear NUEVA solicitud",
"request": {
"method": "POST",
"header": [
{
"key": "Idempotency-Key",
"value": "{{createKey}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/requests",
"description": "",
"body": {
"mode": "raw",
"raw": "{\n \"typeKey\": \"{{typeKey}}\",\n \"data\": {\n \"client\": \"synthetic-client\",\n \"consentimientoId\": \"synthetic-consent\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.collectionVariables.set('createKey',pm.variables.replaceIn('{{$guid}}'));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 201', () => pm.response.to.have.status(201));",
"if (pm.response.code === 201) {",
"const b=pm.response.json(); pm.collectionVariables.set('requestId',b.id); pm.collectionVariables.set('requestRevision',String(b.revision));",
"}"
]
}
}
]
},
{
"name": "Repetir creación con misma clave y cuerpo",
"request": {
"method": "POST",
"header": [
{
"key": "Idempotency-Key",
"value": "{{createKey}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/requests",
"description": "Ejecutar después de crear. No cambiar cuerpo, typeKey ni usuario.",
"body": {
"mode": "raw",
"raw": "{\n \"typeKey\": \"{{typeKey}}\",\n \"data\": {\n \"client\": \"synthetic-client\",\n \"consentimientoId\": \"synthetic-consent\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 201', () => pm.response.to.have.status(201));",
"if (pm.response.code === 201) {",
"pm.test('Misma solicitud',()=>pm.expect(pm.response.json().id).to.eql(pm.collectionVariables.get('requestId')));",
"}"
]
}
}
]
},
{
"name": "Consultar solicitud y actualizar revisión",
"request": {
"method": "GET",
"header": [],
"url": "{{baseUrl}}/api/v1/requests/{{requestId}}",
"description": ""
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"const b=pm.response.json(); pm.collectionVariables.set('requestId',b.id); pm.collectionVariables.set('requestRevision',String(b.revision));",
"}"
]
}
}
]
},
{
"name": "Consultar eventos disponibles",
"request": {
"method": "GET",
"header": [],
"url": "{{baseUrl}}/api/v1/requests/{{requestId}}/available-events",
"description": ""
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"pm.collectionVariables.set('requestRevision',String(pm.response.json().revision));",
"}"
]
}
}
]
},
{
"name": "Historial",
"request": {
"method": "GET",
"header": [],
"url": "{{baseUrl}}/api/v1/requests/{{requestId}}/history?limit=50",
"description": ""
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"",
"}"
]
}
}
]
}
]
},
{
"name": "06 — Eventos reales (solo con proveedores de demo)",
"item": [
{
"name": "ASIGNAR_CLIENTE",
"request": {
"method": "POST",
"header": [
{
"key": "If-Match",
"value": "\"{{eventRevision}}\""
},
{
"key": "Idempotency-Key",
"value": "{{eventKey}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/requests/{{requestId}}/events",
"description": "Solo enviar si aparece en available-events. Después consultar ejecución y refrescar solicitud/revisión. Requiere worker y proveedores mock configurados; documentId debe pertenecer a esta solicitud. No usar buró real para demo.",
"body": {
"mode": "raw",
"raw": "{\n \"event\": \"ASIGNAR_CLIENTE\",\n \"data\": {}\n}",
"options": {
"raw": {
"language": "json"
}
}
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.collectionVariables.set('eventKey',pm.variables.replaceIn('{{$guid}}'));",
"pm.collectionVariables.set('eventRevision',pm.variables.get('requestRevision'));",
"pm.collectionVariables.set('eventBody',pm.variables.replaceIn(pm.request.body.raw));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 202', () => pm.response.to.have.status(202));",
"if (pm.response.code === 202) {",
"pm.collectionVariables.set('executionId',pm.response.json().executionId);",
"}"
]
}
}
]
},
{
"name": "REGISTRAR_INE",
"request": {
"method": "POST",
"header": [
{
"key": "If-Match",
"value": "\"{{eventRevision}}\""
},
{
"key": "Idempotency-Key",
"value": "{{eventKey}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/requests/{{requestId}}/events",
"description": "Solo enviar si aparece en available-events. Después consultar ejecución y refrescar solicitud/revisión. Requiere worker y proveedores mock configurados; documentId debe pertenecer a esta solicitud. No usar buró real para demo.",
"body": {
"mode": "raw",
"raw": "{\n \"event\": \"REGISTRAR_INE\",\n \"data\": {\n \"documentId\": \"{{documentId}}\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.collectionVariables.set('eventKey',pm.variables.replaceIn('{{$guid}}'));",
"pm.collectionVariables.set('eventRevision',pm.variables.get('requestRevision'));",
"pm.collectionVariables.set('eventBody',pm.variables.replaceIn(pm.request.body.raw));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 202', () => pm.response.to.have.status(202));",
"if (pm.response.code === 202) {",
"pm.collectionVariables.set('executionId',pm.response.json().executionId);",
"}"
]
}
}
]
},
{
"name": "REGISTRAR_ESTADO_CUENTA",
"request": {
"method": "POST",
"header": [
{
"key": "If-Match",
"value": "\"{{eventRevision}}\""
},
{
"key": "Idempotency-Key",
"value": "{{eventKey}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/requests/{{requestId}}/events",
"description": "Solo enviar si aparece en available-events. Después consultar ejecución y refrescar solicitud/revisión. Requiere worker y proveedores mock configurados; documentId debe pertenecer a esta solicitud. No usar buró real para demo.",
"body": {
"mode": "raw",
"raw": "{\n \"event\": \"REGISTRAR_ESTADO_CUENTA\",\n \"data\": {\n \"documentId\": \"{{documentId}}\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.collectionVariables.set('eventKey',pm.variables.replaceIn('{{$guid}}'));",
"pm.collectionVariables.set('eventRevision',pm.variables.get('requestRevision'));",
"pm.collectionVariables.set('eventBody',pm.variables.replaceIn(pm.request.body.raw));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 202', () => pm.response.to.have.status(202));",
"if (pm.response.code === 202) {",
"pm.collectionVariables.set('executionId',pm.response.json().executionId);",
"}"
]
}
}
]
},
{
"name": "VALIDAR_BURO",
"request": {
"method": "POST",
"header": [
{
"key": "If-Match",
"value": "\"{{eventRevision}}\""
},
{
"key": "Idempotency-Key",
"value": "{{eventKey}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/requests/{{requestId}}/events",
"description": "Solo enviar si aparece en available-events. Después consultar ejecución y refrescar solicitud/revisión. Requiere worker y proveedores mock configurados; documentId debe pertenecer a esta solicitud. No usar buró real para demo.",
"body": {
"mode": "raw",
"raw": "{\n \"event\": \"VALIDAR_BURO\",\n \"data\": {}\n}",
"options": {
"raw": {
"language": "json"
}
}
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.collectionVariables.set('eventKey',pm.variables.replaceIn('{{$guid}}'));",
"pm.collectionVariables.set('eventRevision',pm.variables.get('requestRevision'));",
"pm.collectionVariables.set('eventBody',pm.variables.replaceIn(pm.request.body.raw));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 202', () => pm.response.to.have.status(202));",
"if (pm.response.code === 202) {",
"pm.collectionVariables.set('executionId',pm.response.json().executionId);",
"}"
]
}
}
]
},
{
"name": "Repetir ÚLTIMO evento (idempotencia)",
"request": {
"method": "POST",
"header": [
{
"key": "If-Match",
"value": "\"{{eventRevision}}\""
},
{
"key": "Idempotency-Key",
"value": "{{eventKey}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"url": "{{baseUrl}}/api/v1/requests/{{requestId}}/events",
"description": "",
"body": {
"mode": "raw",
"raw": "{{eventBody}}",
"options": {
"raw": {
"language": "json"
}
}
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 202', () => pm.response.to.have.status(202));",
"if (pm.response.code === 202) {",
"pm.test('Misma ejecución',()=>pm.expect(pm.response.json().executionId).to.eql(pm.collectionVariables.get('executionId')));",
"}"
]
}
}
]
},
{
"name": "Consultar ejecución (repetir hasta terminal)",
"request": {
"method": "GET",
"header": [],
"url": "{{baseUrl}}/api/v1/executions/{{executionId}}",
"description": "202 solo acredita aceptación. SUCCEEDED confirma terminación correcta; RETRY_WAIT/FAILED/RECONCILIATION_REQUIRED requieren revisar causa. No reenvía ni sondea automáticamente."
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"",
"}"
]
}
}
]
}
]
},
{
"name": "07 — Operación",
"item": [
{
"name": "Métricas",
"request": {
"method": "GET",
"header": [],
"url": "{{baseUrl}}/actuator/metrics",
"description": "Requiere EXECUTION_OPERATOR y business_scope administrativo autorizado.",
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{selectedToken}}",
"type": "string"
}
]
}
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"pm.variables.set('selectedToken', pm.variables.get('operatorToken') || pm.variables.get('accessToken'));"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('HTTP 200', () => pm.response.to.have.status(200));",
"if (pm.response.code === 200) {",
"",
"}"
]
}
}
]
}
]
}
]
}