{
  "info": {
    "name": "Vantrace Evaluate API",
    "description": "Signed synchronous AML evaluation. Set baseUrl, apiKey, and hmacSecret before sending. Use should_block as the only settlement gate.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://your-authorised-base-url",
      "type": "string"
    },
    {
      "key": "apiKey",
      "value": "",
      "type": "string"
    },
    {
      "key": "hmacSecret",
      "value": "",
      "type": "secret"
    },
    {
      "key": "signature",
      "value": "",
      "type": "string"
    },
    {
      "key": "timestamp",
      "value": "",
      "type": "string"
    },
    {
      "key": "requestId",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Evaluate transaction",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const body = pm.variables.replaceIn(pm.request.body.raw);",
              "const secret = pm.collectionVariables.get('hmacSecret');",
              "if (!secret) { throw new Error('Set the hmacSecret collection variable before sending.'); }",
              "pm.request.body.update(body);",
              "pm.collectionVariables.set('signature', CryptoJS.HmacSHA256(body, secret).toString(CryptoJS.enc.Hex));",
              "pm.collectionVariables.set('timestamp', new Date().toISOString());",
              "pm.collectionVariables.set('requestId', pm.variables.replaceIn('{{$guid}}'));"
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('Response is JSON', () => pm.response.to.be.json);",
              "pm.test('Decision includes should_block', () => {",
              "  const body = pm.response.json();",
              "  pm.expect(body).to.have.property('should_block').that.is.a('boolean');",
              "});"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          },
          {
            "key": "X-API-Key",
            "value": "{{apiKey}}",
            "type": "text"
          },
          {
            "key": "X-Signature-Version",
            "value": "v2",
            "type": "text"
          },
          {
            "key": "X-Timestamp",
            "value": "{{timestamp}}",
            "type": "text"
          },
          {
            "key": "X-Request-ID",
            "value": "{{requestId}}",
            "type": "text"
          },
          {
            "key": "X-Signature",
            "value": "{{signature}}",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"transaction\": {\n    \"reference_id\": \"BANK-TXN-0001\",\n    \"amount\": 25000.0,\n    \"currency\": \"NGN\",\n    \"trx_type\": \"transfer\",\n    \"channel\": \"mobile_app\",\n    \"txn_direction\": \"outbound\",\n    \"is_cash\": false,\n    \"source_account_id\": 41001,\n    \"evaluated_account_id\": 41001,\n    \"beneficiary_account_id\": 91001\n  },\n  \"customer\": {\n    \"customer_id\": \"CUST-1001\",\n    \"entity_type\": \"individual\",\n    \"kyc_tier\": 2,\n    \"is_pep\": false,\n    \"sanctions_flag\": false,\n    \"adverse_media_flag\": false,\n    \"is_shell_company\": false,\n    \"has_complete_cdd\": true\n  },\n  \"context\": {\n    \"current_balance\": 480000.0\n  }\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/v1/engine/evaluate",
          "host": ["{{baseUrl}}"],
          "path": ["v1", "engine", "evaluate"]
        },
        "description": "The request body is serialized once, signed in the pre-request script, and sent unchanged."
      },
      "response": [
        {
          "name": "Complete non-blocking evaluation",
          "originalRequest": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/engine/evaluate",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "engine", "evaluate"]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "cookie": [],
          "body": "{\n  \"evaluation_status\": \"complete\",\n  \"should_block\": false,\n  \"final_action\": \"none\"\n}"
        }
      ]
    }
  ]
}
