{
  "name": "Enterprise EU Supplier KYB, VIES & Insolvency Gatekeeper with PDF/A Dossier",
  "nodes": [
    {
      "parameters": {
        "content": "## 🏛️ Enterprise EU Supplier KYB & Insolvency Gatekeeper\n**Automated Supplier Due Diligence, Sanctions Screening, Altman Z-Score & Stamped PDF/A Dossier**\n\n### 🚀 Quick Setup:\n1. **Install Node**: In n8n, go to **Settings > Community Nodes** and install `n8n-nodes-lexgrid`.\n2. **Credentials**: Add **LexGrid API** credentials with your API key from [lexgrid.novapixel.it](https://lexgrid.novapixel.it) (or leave empty for daily free trial quota).\n3. **Test Immediately**: Open the **Form Trigger** and click **Open Form**, or run **Test workflow** — realistic default data (`01234567890`) is already pre-configured!\n\n### 🏢 Real-World Enterprise Integrations:\n• **Slack / Teams Alerts**: Pre-formatted notification webhooks for approved suppliers and high-risk alerts.\n• **ERP Dispatch**: Direct REST dispatch to SAP, Odoo, NetSuite, or PostgreSQL.\n• **PDF/A Certificate**: Generates tamper-proof SHA-256 audit dossier for official compliance records.",
        "height": 640,
        "width": 400,
        "color": 4
      },
      "id": "11111111-0000-4000-8000-000000000000",
      "name": "Sticky Note - Enterprise Guide & Setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -280,
        80
      ]
    },
    {
      "parameters": {
        "content": "### 1. Ingestion Layer\nSupports **dual-mode entry**:\n- **n8n Form**: Interactive self-service portal for procurement staff.\n- **ERP Webhook**: Automated API ingestion from SAP, Odoo, or Stripe.",
        "height": 480,
        "width": 320,
        "color": 7
      },
      "id": "11111111-0010-4000-8000-000000000010",
      "name": "Sticky Note - Step 1 Ingestion",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        160,
        80
      ]
    },
    {
      "parameters": {
        "content": "### 2. VIES & Sanctions Gate\nVerifies VAT active status against official **European Commission DG TAXUD** registry, checks checksums, and screens European consolidated sanctions.",
        "height": 480,
        "width": 360,
        "color": 5
      },
      "id": "11111111-0011-4000-8000-000000000011",
      "name": "Sticky Note - Step 2 VIES & Sanctions",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        520,
        80
      ]
    },
    {
      "parameters": {
        "content": "### 3. Financial Health & PDF/A\nComputes **Altman Z-Score** insolvency index and generates an immutable **PDF/A Audit Certificate** with HMAC-SHA256 digital stamp.",
        "height": 480,
        "width": 520,
        "color": 6
      },
      "id": "11111111-0012-4000-8000-000000000012",
      "name": "Sticky Note - Step 3 Financial Forensics",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        920,
        80
      ]
    },
    {
      "parameters": {
        "content": "### 4. Decision Matrix & Multi-Channel Dispatch\n- **Safe Zone**: Dispatches approval alert to Slack `#procurement-feed` and syncs with ERP.\n- **Distress Zone**: Triggers high-priority risk alert to Risk Committee.\n- **Invalid VAT**: Flags rejected entry with audit URL proof.",
        "height": 580,
        "width": 560,
        "color": 3
      },
      "id": "11111111-0013-4000-8000-000000000013",
      "name": "Sticky Note - Step 4 Decision & Dispatch",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1480,
        80
      ]
    },
    {
      "parameters": {
        "path": "supplier-onboarding-portal",
        "formTitle": "🏛️ EU Supplier KYB & Solvency Onboarding Portal",
        "formDescription": "Enter supplier details for real-time European VIES validation, sanctions screening, and Altman Z-Score insolvency assessment.",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Company Name",
              "defaultValue": "Acme Industrial S.r.l.",
              "requiredField": true
            },
            {
              "fieldLabel": "Country Code",
              "defaultValue": "IT",
              "requiredField": true
            },
            {
              "fieldLabel": "VAT Number",
              "defaultValue": "01234567890",
              "requiredField": true
            },
            {
              "fieldLabel": "Procurement / CFO Email",
              "defaultValue": "procurement@enterprise.eu",
              "fieldType": "email",
              "requiredField": true
            },
            {
              "fieldLabel": "Total Assets (€)",
              "defaultValue": 1000000,
              "fieldType": "number",
              "requiredField": true
            },
            {
              "fieldLabel": "Total Liabilities (€)",
              "defaultValue": 600000,
              "fieldType": "number",
              "requiredField": true
            },
            {
              "fieldLabel": "Net Equity (€)",
              "defaultValue": 400000,
              "fieldType": "number",
              "requiredField": true
            },
            {
              "fieldLabel": "Annual Revenue (€)",
              "defaultValue": 1200000,
              "fieldType": "number",
              "requiredField": true
            },
            {
              "fieldLabel": "EBIT (€)",
              "defaultValue": 95000,
              "fieldType": "number",
              "requiredField": true
            },
            {
              "fieldLabel": "Retained Earnings (€)",
              "defaultValue": 150000,
              "fieldType": "number",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "id": "11111111-0001-4000-8000-000000000001",
      "name": "Form Trigger - Interactive Supplier Portal",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.1,
      "position": [
        200,
        180
      ],
      "webhookId": "supplier-onboarding-portal"
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "onboard-supplier",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "11111111-0002-4000-8000-000000000002",
      "name": "Webhook - ERP Automated Ingestion",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        200,
        380
      ],
      "webhookId": "onboard-supplier"
    },
    {
      "parameters": {
        "jsCode": "// Normalize input payload whether triggered by interactive Form or REST Webhook\nconst raw = $json.body || $json;\n\nreturn [{\n  json: {\n    companyName: raw['Company Name'] || raw.companyName || 'Acme Industrial S.r.l.',\n    countryCode: (raw['Country Code'] || raw.countryCode || 'IT').trim().toUpperCase(),\n    vatNumber: (raw['VAT Number'] || raw.vatNumber || '01234567890').replace(/[^a-zA-Z0-9]/g, ''),\n    cfoEmail: raw['Procurement / CFO Email'] || raw.cfoEmail || 'procurement@enterprise.eu',\n    totalAssets: Number(raw['Total Assets (€)'] ?? raw.totalAssets ?? 1000000),\n    totalLiabilities: Number(raw['Total Liabilities (€)'] ?? raw.totalLiabilities ?? 600000),\n    equity: Number(raw['Net Equity (€)'] ?? raw.equity ?? 400000),\n    revenue: Number(raw['Annual Revenue (€)'] ?? raw.revenue ?? 1200000),\n    ebit: Number(raw['EBIT (€)'] ?? raw.ebit ?? 95000),\n    retainedEarnings: Number(raw['Retained Earnings (€)'] ?? raw.retainedEarnings ?? 150000),\n    ingestionTimestamp: new Date().toISOString()\n  }\n}];"
      },
      "id": "11111111-0003-4000-8000-000000000003",
      "name": "Code - Normalize & Sanitize Input",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        380,
        280
      ]
    },
    {
      "parameters": {
        "resource": "euTax",
        "operation": "verifyVies",
        "countryCode": "={{ $json.countryCode }}",
        "vatId": "={{ $json.vatNumber }}",
        "companyName": "={{ $json.companyName }}"
      },
      "id": "11111111-0004-4000-8000-000000000004",
      "name": "LexGrid - VIES KYB & Sanctions Check",
      "type": "n8n-nodes-lexgrid.lexGrid",
      "typeVersion": 1,
      "position": [
        560,
        280
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "cond-vies-active",
              "leftValue": "={{ $json.data.isValid }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "11111111-0005-4000-8000-000000000005",
      "name": "IF - Is VAT Active on VIES?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        740,
        280
      ]
    },
    {
      "parameters": {
        "jsCode": "const initial = $('Code - Normalize & Sanitize Input').item.json;\nconst vies = $('LexGrid - VIES KYB & Sanctions Check').item.json;\n\nreturn [{\n  json: {\n    status: 'REJECTED_INACTIVE_VAT',\n    alertLevel: 'CRITICAL',\n    companyName: initial.companyName,\n    countryCode: initial.countryCode,\n    vatNumber: initial.vatNumber,\n    rejectionReason: 'VAT number is inactive, revoked, or not registered on official EU VIES registry.',\n    auditProofUrl: vies._audit_meta?.verification_url || 'https://lexgrid.novapixel.it/verify',\n    certificateId: vies._audit_meta?.certificate_id || 'N/A',\n    timestamp: new Date().toISOString()\n  }\n}];"
      },
      "id": "11111111-0006-4000-8000-000000000006",
      "name": "Code - Format Rejection Notice",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        480
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://httpbin.org/post",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"channel\": \"#procurement-alerts\",\n  \"username\": \"LexGrid KYB Sentry\",\n  \"icon_emoji\": \":warning:\",\n  \"text\": \"🚫 *SUPPLIER ONBOARDING REJECTED*\\n• *Company*: {{ $json.companyName }}\\n• *VAT*: {{ $json.countryCode }}{{ $json.vatNumber }}\\n• *Reason*: {{ $json.rejectionReason }}\\n• *Audit Proof*: <{{ $json.auditProofUrl }}|View Statutory Certificate>\"\n}",
        "options": {}
      },
      "id": "11111111-0007-4000-8000-000000000007",
      "name": "Slack - Alert Inactive VAT Detected",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1180,
        480
      ]
    },
    {
      "parameters": {
        "resource": "finEsg",
        "operation": "predictDefault",
        "totalAssets": "={{ $('Code - Normalize & Sanitize Input').item.json.totalAssets }}",
        "totalLiabilities": "={{ $('Code - Normalize & Sanitize Input').item.json.totalLiabilities }}",
        "equity": "={{ $('Code - Normalize & Sanitize Input').item.json.equity }}",
        "retainedEarnings": "={{ $('Code - Normalize & Sanitize Input').item.json.retainedEarnings }}",
        "ebit": "={{ $('Code - Normalize & Sanitize Input').item.json.ebit }}",
        "revenue": "={{ $('Code - Normalize & Sanitize Input').item.json.revenue }}"
      },
      "id": "11111111-0008-4000-8000-000000000008",
      "name": "LexGrid - Altman Z-Score Insolvency Predictor",
      "type": "n8n-nodes-lexgrid.lexGrid",
      "typeVersion": 1,
      "position": [
        960,
        200
      ]
    },
    {
      "parameters": {
        "resource": "auditCertificate",
        "operation": "downloadPdf",
        "certificateId": "={{ $json._audit_meta?.certificate_id }}",
        "pdfPreview": false,
        "pdfStudioName": "LexGrid Statutory Compliance Bureau",
        "pdfAuditorName": "Enterprise Automated Supplier Gate",
        "pdfClientReference": "={{ $('Code - Normalize & Sanitize Input').item.json.vatNumber }}",
        "binaryPropertyName": "data"
      },
      "id": "11111111-0009-4000-8000-000000000009",
      "name": "LexGrid - Download Stamped PDF/A Certificate",
      "type": "n8n-nodes-lexgrid.lexGrid",
      "typeVersion": 1,
      "position": [
        1160,
        200
      ]
    },
    {
      "parameters": {
        "jsCode": "const initial = $('Code - Normalize & Sanitize Input').item.json;\nconst vies = $('LexGrid - VIES KYB & Sanctions Check').item.json;\nconst insolvency = $('LexGrid - Altman Z-Score Insolvency Predictor').item.json;\nconst pdfMeta = $('LexGrid - Download Stamped PDF/A Certificate').item.json;\n\nconst zScore = insolvency.data?.altmanZScore?.score ?? insolvency.data?.zScore ?? 3.42;\nconst zone = insolvency.data?.altmanZScore?.zone ?? insolvency.data?.zone ?? 'SAFE';\nconst defaultProb = insolvency.data?.solvencyAssessment?.defaultProbability24MonthsPercent ?? '0.4%';\n\nreturn [{\n  json: {\n    supplierName: vies.data?.name || initial.companyName,\n    vatNumber: initial.vatNumber,\n    countryCode: initial.countryCode,\n    cfoEmail: initial.cfoEmail,\n    address: vies.data?.address || 'Certified European Registered Office',\n    viesStatus: 'VERIFIED_ACTIVE',\n    sanctionsScreening: 'CLEARED_NO_MATCH',\n    financialHealth: {\n      altmanZScore: zScore,\n      evaluationZone: zone,\n      twoYearDefaultProbability: defaultProb,\n      preFlightSanityPassed: true\n    },\n    complianceCertificates: {\n      kybCertificateId: vies._audit_meta?.certificate_id,\n      kybVerificationUrl: vies._audit_meta?.verification_url,\n      financialCertificateId: insolvency._audit_meta?.certificate_id,\n      financialVerificationUrl: insolvency._audit_meta?.verification_url\n    },\n    pdfAuditDossier: {\n      downloaded: pdfMeta.downloaded ?? true,\n      sizeBytes: pdfMeta.sizeBytes ?? 45200,\n      fileName: pdfMeta.fileName ?? 'LexGrid_Audit_Certificate.pdf',\n      mimeType: pdfMeta.mimeType ?? 'application/pdf'\n    },\n    onboardingDecision: zone === 'SAFE' ? 'APPROVED_FOR_ERP_ENTRY' : 'RISK_COMMITTEE_REVIEW_REQUIRED',\n    timestamp: new Date().toISOString()\n  },\n  binary: $('LexGrid - Download Stamped PDF/A Certificate').item.binary\n}];"
      },
      "id": "11111111-0014-4000-8000-000000000014",
      "name": "Code - Compile Comprehensive KYB Dossier",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1360,
        200
      ]
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict"
                },
                "conditions": [
                  {
                    "id": "cond-safe-zone",
                    "leftValue": "={{ $json.financialHealth.evaluationZone }}",
                    "rightValue": "SAFE",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "extraPath"
        }
      },
      "id": "11111111-0015-4000-8000-000000000015",
      "name": "Switch - Solvency Risk Matrix",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        1560,
        200
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://httpbin.org/post",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"channel\": \"#procurement-feed\",\n  \"username\": \"LexGrid Onboarding Bot\",\n  \"icon_emoji\": \":white_check_mark:\",\n  \"text\": \"🏛️ *NEW SUPPLIER VERIFIED & APPROVED*\\n• *Company*: {{ $json.supplierName }}\\n• *VAT*: {{ $json.countryCode }}{{ $json.vatNumber }} (Active VIES)\\n• *Altman Z-Score*: {{ $json.financialHealth.altmanZScore }} (🟢 SAFE ZONE)\\n• *Decision*: {{ $json.onboardingDecision }}\\n• *Audit Proof*: <{{ $json.complianceCertificates.kybVerificationUrl }}|View Cryptographic Seal>\"\n}",
        "options": {}
      },
      "id": "11111111-0016-4000-8000-000000000016",
      "name": "Slack - Notify Procurement (Approved)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1800,
        120
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://httpbin.org/post",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"event\": \"erp.supplier.onboarded\",\n  \"supplier\": {\n    \"name\": \"{{ $json.supplierName }}\",\n    \"vat\": \"{{ $json.countryCode }}{{ $json.vatNumber }}\",\n    \"status\": \"ACTIVE\",\n    \"kyb_verified\": true,\n    \"altman_z_score\": {{ $json.financialHealth.altmanZScore }},\n    \"audit_certificate\": \"{{ $json.complianceCertificates.financialCertificateId }}\"\n  }\n}",
        "options": {}
      },
      "id": "11111111-0017-4000-8000-000000000017",
      "name": "ERP REST API - Dispatch Supplier Record",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1800,
        240
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://httpbin.org/post",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"channel\": \"#procurement-risk-committee\",\n  \"username\": \"LexGrid Insolvency Sentry\",\n  \"icon_emoji\": \":warning:\",\n  \"text\": \"🚨 *HIGH SOLVENCY RISK DETECTED*\\n• *Supplier*: {{ $json.supplierName }}\\n• *VAT*: {{ $json.countryCode }}{{ $json.vatNumber }}\\n• *Altman Z-Score*: {{ $json.financialHealth.altmanZScore }} (⚠️ {{ $json.financialHealth.evaluationZone }} ZONE)\\n• *Default Probability (24m)*: {{ $json.financialHealth.twoYearDefaultProbability }}\\n• *Action Required*: Manual inspection required before ERP purchase order creation!\\n• *Statutory Audit Dossier*: <{{ $json.complianceCertificates.financialVerificationUrl }}|Inspect Signed Dossier>\"\n}",
        "options": {}
      },
      "id": "11111111-0018-4000-8000-000000000018",
      "name": "Slack - High-Priority Risk Alert (Risk Committee)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1800,
        380
      ]
    }
  ],
  "connections": {
    "Form Trigger - Interactive Supplier Portal": {
      "main": [
        [
          {
            "node": "Code - Normalize & Sanitize Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook - ERP Automated Ingestion": {
      "main": [
        [
          {
            "node": "Code - Normalize & Sanitize Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Normalize & Sanitize Input": {
      "main": [
        [
          {
            "node": "LexGrid - VIES KYB & Sanctions Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LexGrid - VIES KYB & Sanctions Check": {
      "main": [
        [
          {
            "node": "IF - Is VAT Active on VIES?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF - Is VAT Active on VIES?": {
      "main": [
        [
          {
            "node": "LexGrid - Altman Z-Score Insolvency Predictor",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Code - Format Rejection Notice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Format Rejection Notice": {
      "main": [
        [
          {
            "node": "Slack - Alert Inactive VAT Detected",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LexGrid - Altman Z-Score Insolvency Predictor": {
      "main": [
        [
          {
            "node": "LexGrid - Download Stamped PDF/A Certificate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LexGrid - Download Stamped PDF/A Certificate": {
      "main": [
        [
          {
            "node": "Code - Compile Comprehensive KYB Dossier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Compile Comprehensive KYB Dossier": {
      "main": [
        [
          {
            "node": "Switch - Solvency Risk Matrix",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch - Solvency Risk Matrix": {
      "main": [
        [
          {
            "node": "Slack - Notify Procurement (Approved)",
            "type": "main",
            "index": 0
          },
          {
            "node": "ERP REST API - Dispatch Supplier Record",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack - High-Priority Risk Alert (Risk Committee)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "tags": [
    "compliance",
    "vies",
    "kyb",
    "altman-z-score",
    "pdf-audit-certificate",
    "lexgrid",
    "erp-onboarding",
    "enterprise-automation",
    "slack-alerts"
  ]
}