specgrid-eu-compliance 1.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SpecGrid
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: specgrid-eu-compliance
3
+ Version: 1.6.0
4
+ Summary: Zero-dependency Python 3 client for the SpecGrid EU e-Invoicing & Regulatory Compliance API (AEAT VeriFactu, Peppol EN 16931, Facturae, SEPA EPC QR, EU GPSR, IBAN/NIF).
5
+ License: MIT
6
+ Keywords: verifactu,peppol,facturae,sepa-qr,einvoicing,gpsr,iban
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: license-file
11
+
12
+ # SpecGrid EU e-Invoicing & Compliance SDK + MCP Server (MCP · Node/TS · Python · PHP · n8n · Make.com)
13
+
14
+ [![SDK & Templates CI](https://github.com/SpecGrid-tools/specgrid-eu-compliance-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/SpecGrid-tools/specgrid-eu-compliance-sdk/actions/workflows/ci.yml)
15
+ [![License: MIT](https://img.shields.io/badge/License-MIT-emerald.svg)](./LICENSE)
16
+ [![OpenAPI 3.0.3](https://img.shields.io/badge/OpenAPI-3.0.3-blue.svg)](https://eu.specgrid-api.workers.dev/openapi.json)
17
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen.svg)](#)
18
+
19
+ Zero-dependency official client SDKs, **Postman Collection v2.1**, and ready-to-import **n8n & Make.com automation templates** for the **[SpecGrid EU Compliance API](https://eu.specgrid-api.workers.dev)** (running on Cloudflare Workers with zero payload retention):
20
+
21
+ - **Spanish AEAT VeriFactu (RD 1007/2023 & Orden HAC/1177/2024):** Exact 8-field canonical `SHA-256` `Huella` chaining, multi-record tamper verification, `ValidarQR` URLs (prod & sandbox), printable Tributary QR SVG, and `<sf:RegistroAlta>` XML generation.
22
+ - **Peppol BIS Billing 3.0 (EN 16931 UBL 2.1 / XRechnung) & Spanish Facturae 3.2.2:** JSON-to-UBL XML generation + cent-level mathematical & structural validation (`BR-CO-10..16`, XXE-hardened).
23
+ - **SEPA EPC069-12 v002 Payment QR (GiroCode):** Scan-to-pay European credit transfer QR payloads & ECL-M SVGs with automatic ISO 13616 IBAN Mod-97 verification.
24
+ - **EU-27 VAT, ISO 13616 Mod-97 IBAN & Spanish NIF/NIE/CIF Checksum Validation.**
25
+ - **EU GPSR (Regulation 2023/988) Compliance Pack:** Manufacturer & EU-27 Responsible Person validation + tracking-free safety QR SVG generator.
26
+
27
+ ---
28
+
29
+ ## Try Free or Subscribe (Global MoR · Automated EU VAT Invoice)
30
+
31
+ | Channel | Tier | Quota | Link |
32
+ | :--- | :--- | :--- | :--- |
33
+ | **Interactive Web Sandbox** | Free Browser Playground | Instant live JSON + SVG preview | [eu.specgrid-api.workers.dev](https://eu.specgrid-api.workers.dev) |
34
+ | **RapidAPI Hub** | Basic `$0` / Pro `$15` / Ultra `$39` | `50` / `5,000` / `50,000` calls/mo | [RapidAPI Hub Listing](https://rapidapi.com/specgrid-specgrid-default/api/specgrid-eu-e-invoicing-verifactu-sepa-qr) |
35
+ | **Direct API Key (Polar.sh)** | Starter `$15/mo` · Growth `$39/mo` | Instant `SPECGRID-...` Bearer Key | [Direct Polar Checkout](https://eu.specgrid-api.workers.dev/#pricing) |
36
+
37
+ ---
38
+
39
+ ## AI Agent Integration — MCP Server (Cursor · Claude Desktop · Windsurf · Antigravity)
40
+
41
+ Give any LLM coding agent deterministic EU compliance tools (zero hash/math/XML hallucinations) using either **Remote Streamable HTTP** or our **Zero-Dependency Local Stdio Bridge**:
42
+
43
+ ### Option A: Remote Streamable HTTP (Recommended — Zero Install)
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "specgrid-eu-compliance": {
48
+ "url": "https://eu.specgrid-api.workers.dev/mcp",
49
+ "headers": {
50
+ "Authorization": "Bearer SPECGRID-YOUR-POLAR-KEY"
51
+ }
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ ### Option B: Local Zero-Dependency Stdio MCP Bridge (`mcp/specgrid-mcp-server.mjs`)
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "specgrid-eu-compliance": {
62
+ "command": "node",
63
+ "args": ["/path/to/specgrid-eu-compliance-sdk/mcp/specgrid-mcp-server.mjs"],
64
+ "env": {
65
+ "SPECGRID_API_KEY": "SPECGRID-YOUR-POLAR-KEY"
66
+ }
67
+ }
68
+ }
69
+ }
70
+ ```
71
+ Exposes all 7 deterministic MCP tools: `verifactu_fingerprint`, `verifactu_verify_chain`, `einvoice_validate`, `einvoice_generate`, `sepa_epc_qr`, `tax_id_validate`, and `gpsr_compliance_pack`.
72
+
73
+ ---
74
+
75
+ ## Quickstart — TypeScript / Node 20+ (`0` Dependencies)
76
+
77
+ ```ts
78
+ import { SpecGridClient } from './src/index.ts';
79
+
80
+ // Option A: Direct Polar.sh Key (Authorization: Bearer ...)
81
+ const client = new SpecGridClient({ apiKey: process.env.SPECGRID_API_KEY });
82
+
83
+ // Option B: RapidAPI Hub Key
84
+ // const client = new SpecGridClient({ rapidApiKey: process.env.RAPIDAPI_KEY });
85
+
86
+ const verifactu = await client.generateElectronicInvoice({
87
+ format: 'verifactu_registro_alta',
88
+ invoiceNumber: 'INV-2026/0105',
89
+ issueDate: '2026-11-29',
90
+ supplier: { name: 'SpecGrid Systems SL', taxId: 'B85905495', countryCode: 'ES' },
91
+ customer: { name: 'Nordic Automation GmbH', taxId: 'DE123456789', countryCode: 'DE' },
92
+ lines: [{ description: 'Engineering Services', quantity: 2, unitPrice: 50, vatRate: 21 }]
93
+ });
94
+
95
+ console.log('AEAT SHA-256 Huella:', verifactu.fingerprintSha256);
96
+ console.log('AEAT ValidarQR URL:', verifactu.qrValidationUrl);
97
+ ```
98
+
99
+ See runnable examples in [`examples/verifactu-quickstart.mjs`](./examples/verifactu-quickstart.mjs) and [`examples/peppol-ubl-quickstart.mjs`](./examples/peppol-ubl-quickstart.mjs).
100
+
101
+ ## Quickstart — Python 3 (`0` Dependencies)
102
+
103
+ ```python
104
+ import os
105
+ from python.specgrid_client import SpecGridClient
106
+
107
+ client = SpecGridClient(api_key=os.environ["SPECGRID_API_KEY"])
108
+ sepa = client.generate_sepa_qr(
109
+ beneficiaryName="SpecGrid Systems SL",
110
+ iban="ES9121000418450200051332",
111
+ amountEur=121.00,
112
+ remittanceText="Invoice INV-2026/0105"
113
+ )
114
+ print(sepa["payload"])
115
+ ```
116
+
117
+ ## Quickstart — PHP 8+ / Laravel / WooCommerce (`0` Dependencies)
118
+
119
+ ```php
120
+ <?php
121
+ require_once __DIR__ . '/php/SpecGridClient.php';
122
+
123
+ $client = new \SpecGrid\SpecGridClient(apiKey: getenv('SPECGRID_API_KEY'));
124
+ $vf = $client->generateElectronicInvoice([
125
+ 'format' => 'verifactu_registro_alta',
126
+ 'invoiceNumber' => 'INV-2026/0105',
127
+ 'issueDate' => '2026-11-29',
128
+ 'supplier' => ['name' => 'SpecGrid Systems SL', 'taxId' => 'B85905495', 'countryCode' => 'ES'],
129
+ 'customer' => ['name' => 'Cliente SA', 'taxId' => 'A12345674', 'countryCode' => 'ES'],
130
+ 'lines' => [['description' => 'Suscripcion SaaS', 'quantity' => 1, 'unitPrice' => 100.0, 'vatRate' => 21]],
131
+ ]);
132
+
133
+ echo $vf['fingerprintSha256'] . PHP_EOL;
134
+ echo $vf['qrValidationUrl'] . PHP_EOL;
135
+ ```
136
+
137
+ ## No-Code Templates & API Tools (1-Click Import)
138
+
139
+ - **n8n Workflow:** Import [`n8n/verifactu-sepa-invoice-workflow.json`](./n8n/verifactu-sepa-invoice-workflow.json) via **Workflows → Import from File** and replace `SPECGRID-REPLACE-WITH-YOUR-POLAR-KEY` with your live `SPECGRID-...` key (or `X-RapidAPI-Key`).
140
+ - **Make.com Scenario Blueprint:** Import [`make/verifactu-sepa-make-blueprint.json`](./make/verifactu-sepa-make-blueprint.json) into a new Make scenario to chain Webhook → VeriFactu XML + SHA-256 → SEPA EPC QR → JSON Response.
141
+ - **Postman / Insomnia / Bruno / Hoppscotch:** Import [`postman/specgrid-eu-compliance.postman_collection.json`](./postman/specgrid-eu-compliance.postman_collection.json) (all 8 endpoints pre-populated with verified payloads) or load the CORS-enabled OpenAPI 3.0.3 schema directly from `https://eu.specgrid-api.workers.dev/openapi.json`.
142
+ - **AI / LLM Documentation:** Machine-readable specs available at `https://eu.specgrid-api.workers.dev/llms.txt` and `/llms-full.txt`.
143
+
144
+ ---
145
+
146
+ ## Security & Technical Scope
147
+ SpecGrid processes invoice XMLs, tax identifiers, and IBANs synchronously in memory with **zero payload retention**. SpecGrid provides deterministic software validation and cryptographic/QR formatting tools based on published technical specifications and is not a law firm, tax advisor, or certified Peppol Access Point.
148
+
149
+ ## License
150
+ MIT License — Copyright (c) 2026 SpecGrid.
@@ -0,0 +1,139 @@
1
+ # SpecGrid EU e-Invoicing & Compliance SDK + MCP Server (MCP · Node/TS · Python · PHP · n8n · Make.com)
2
+
3
+ [![SDK & Templates CI](https://github.com/SpecGrid-tools/specgrid-eu-compliance-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/SpecGrid-tools/specgrid-eu-compliance-sdk/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-emerald.svg)](./LICENSE)
5
+ [![OpenAPI 3.0.3](https://img.shields.io/badge/OpenAPI-3.0.3-blue.svg)](https://eu.specgrid-api.workers.dev/openapi.json)
6
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen.svg)](#)
7
+
8
+ Zero-dependency official client SDKs, **Postman Collection v2.1**, and ready-to-import **n8n & Make.com automation templates** for the **[SpecGrid EU Compliance API](https://eu.specgrid-api.workers.dev)** (running on Cloudflare Workers with zero payload retention):
9
+
10
+ - **Spanish AEAT VeriFactu (RD 1007/2023 & Orden HAC/1177/2024):** Exact 8-field canonical `SHA-256` `Huella` chaining, multi-record tamper verification, `ValidarQR` URLs (prod & sandbox), printable Tributary QR SVG, and `<sf:RegistroAlta>` XML generation.
11
+ - **Peppol BIS Billing 3.0 (EN 16931 UBL 2.1 / XRechnung) & Spanish Facturae 3.2.2:** JSON-to-UBL XML generation + cent-level mathematical & structural validation (`BR-CO-10..16`, XXE-hardened).
12
+ - **SEPA EPC069-12 v002 Payment QR (GiroCode):** Scan-to-pay European credit transfer QR payloads & ECL-M SVGs with automatic ISO 13616 IBAN Mod-97 verification.
13
+ - **EU-27 VAT, ISO 13616 Mod-97 IBAN & Spanish NIF/NIE/CIF Checksum Validation.**
14
+ - **EU GPSR (Regulation 2023/988) Compliance Pack:** Manufacturer & EU-27 Responsible Person validation + tracking-free safety QR SVG generator.
15
+
16
+ ---
17
+
18
+ ## Try Free or Subscribe (Global MoR · Automated EU VAT Invoice)
19
+
20
+ | Channel | Tier | Quota | Link |
21
+ | :--- | :--- | :--- | :--- |
22
+ | **Interactive Web Sandbox** | Free Browser Playground | Instant live JSON + SVG preview | [eu.specgrid-api.workers.dev](https://eu.specgrid-api.workers.dev) |
23
+ | **RapidAPI Hub** | Basic `$0` / Pro `$15` / Ultra `$39` | `50` / `5,000` / `50,000` calls/mo | [RapidAPI Hub Listing](https://rapidapi.com/specgrid-specgrid-default/api/specgrid-eu-e-invoicing-verifactu-sepa-qr) |
24
+ | **Direct API Key (Polar.sh)** | Starter `$15/mo` · Growth `$39/mo` | Instant `SPECGRID-...` Bearer Key | [Direct Polar Checkout](https://eu.specgrid-api.workers.dev/#pricing) |
25
+
26
+ ---
27
+
28
+ ## AI Agent Integration — MCP Server (Cursor · Claude Desktop · Windsurf · Antigravity)
29
+
30
+ Give any LLM coding agent deterministic EU compliance tools (zero hash/math/XML hallucinations) using either **Remote Streamable HTTP** or our **Zero-Dependency Local Stdio Bridge**:
31
+
32
+ ### Option A: Remote Streamable HTTP (Recommended — Zero Install)
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "specgrid-eu-compliance": {
37
+ "url": "https://eu.specgrid-api.workers.dev/mcp",
38
+ "headers": {
39
+ "Authorization": "Bearer SPECGRID-YOUR-POLAR-KEY"
40
+ }
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ ### Option B: Local Zero-Dependency Stdio MCP Bridge (`mcp/specgrid-mcp-server.mjs`)
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "specgrid-eu-compliance": {
51
+ "command": "node",
52
+ "args": ["/path/to/specgrid-eu-compliance-sdk/mcp/specgrid-mcp-server.mjs"],
53
+ "env": {
54
+ "SPECGRID_API_KEY": "SPECGRID-YOUR-POLAR-KEY"
55
+ }
56
+ }
57
+ }
58
+ }
59
+ ```
60
+ Exposes all 7 deterministic MCP tools: `verifactu_fingerprint`, `verifactu_verify_chain`, `einvoice_validate`, `einvoice_generate`, `sepa_epc_qr`, `tax_id_validate`, and `gpsr_compliance_pack`.
61
+
62
+ ---
63
+
64
+ ## Quickstart — TypeScript / Node 20+ (`0` Dependencies)
65
+
66
+ ```ts
67
+ import { SpecGridClient } from './src/index.ts';
68
+
69
+ // Option A: Direct Polar.sh Key (Authorization: Bearer ...)
70
+ const client = new SpecGridClient({ apiKey: process.env.SPECGRID_API_KEY });
71
+
72
+ // Option B: RapidAPI Hub Key
73
+ // const client = new SpecGridClient({ rapidApiKey: process.env.RAPIDAPI_KEY });
74
+
75
+ const verifactu = await client.generateElectronicInvoice({
76
+ format: 'verifactu_registro_alta',
77
+ invoiceNumber: 'INV-2026/0105',
78
+ issueDate: '2026-11-29',
79
+ supplier: { name: 'SpecGrid Systems SL', taxId: 'B85905495', countryCode: 'ES' },
80
+ customer: { name: 'Nordic Automation GmbH', taxId: 'DE123456789', countryCode: 'DE' },
81
+ lines: [{ description: 'Engineering Services', quantity: 2, unitPrice: 50, vatRate: 21 }]
82
+ });
83
+
84
+ console.log('AEAT SHA-256 Huella:', verifactu.fingerprintSha256);
85
+ console.log('AEAT ValidarQR URL:', verifactu.qrValidationUrl);
86
+ ```
87
+
88
+ See runnable examples in [`examples/verifactu-quickstart.mjs`](./examples/verifactu-quickstart.mjs) and [`examples/peppol-ubl-quickstart.mjs`](./examples/peppol-ubl-quickstart.mjs).
89
+
90
+ ## Quickstart — Python 3 (`0` Dependencies)
91
+
92
+ ```python
93
+ import os
94
+ from python.specgrid_client import SpecGridClient
95
+
96
+ client = SpecGridClient(api_key=os.environ["SPECGRID_API_KEY"])
97
+ sepa = client.generate_sepa_qr(
98
+ beneficiaryName="SpecGrid Systems SL",
99
+ iban="ES9121000418450200051332",
100
+ amountEur=121.00,
101
+ remittanceText="Invoice INV-2026/0105"
102
+ )
103
+ print(sepa["payload"])
104
+ ```
105
+
106
+ ## Quickstart — PHP 8+ / Laravel / WooCommerce (`0` Dependencies)
107
+
108
+ ```php
109
+ <?php
110
+ require_once __DIR__ . '/php/SpecGridClient.php';
111
+
112
+ $client = new \SpecGrid\SpecGridClient(apiKey: getenv('SPECGRID_API_KEY'));
113
+ $vf = $client->generateElectronicInvoice([
114
+ 'format' => 'verifactu_registro_alta',
115
+ 'invoiceNumber' => 'INV-2026/0105',
116
+ 'issueDate' => '2026-11-29',
117
+ 'supplier' => ['name' => 'SpecGrid Systems SL', 'taxId' => 'B85905495', 'countryCode' => 'ES'],
118
+ 'customer' => ['name' => 'Cliente SA', 'taxId' => 'A12345674', 'countryCode' => 'ES'],
119
+ 'lines' => [['description' => 'Suscripcion SaaS', 'quantity' => 1, 'unitPrice' => 100.0, 'vatRate' => 21]],
120
+ ]);
121
+
122
+ echo $vf['fingerprintSha256'] . PHP_EOL;
123
+ echo $vf['qrValidationUrl'] . PHP_EOL;
124
+ ```
125
+
126
+ ## No-Code Templates & API Tools (1-Click Import)
127
+
128
+ - **n8n Workflow:** Import [`n8n/verifactu-sepa-invoice-workflow.json`](./n8n/verifactu-sepa-invoice-workflow.json) via **Workflows → Import from File** and replace `SPECGRID-REPLACE-WITH-YOUR-POLAR-KEY` with your live `SPECGRID-...` key (or `X-RapidAPI-Key`).
129
+ - **Make.com Scenario Blueprint:** Import [`make/verifactu-sepa-make-blueprint.json`](./make/verifactu-sepa-make-blueprint.json) into a new Make scenario to chain Webhook → VeriFactu XML + SHA-256 → SEPA EPC QR → JSON Response.
130
+ - **Postman / Insomnia / Bruno / Hoppscotch:** Import [`postman/specgrid-eu-compliance.postman_collection.json`](./postman/specgrid-eu-compliance.postman_collection.json) (all 8 endpoints pre-populated with verified payloads) or load the CORS-enabled OpenAPI 3.0.3 schema directly from `https://eu.specgrid-api.workers.dev/openapi.json`.
131
+ - **AI / LLM Documentation:** Machine-readable specs available at `https://eu.specgrid-api.workers.dev/llms.txt` and `/llms-full.txt`.
132
+
133
+ ---
134
+
135
+ ## Security & Technical Scope
136
+ SpecGrid processes invoice XMLs, tax identifiers, and IBANs synchronously in memory with **zero payload retention**. SpecGrid provides deterministic software validation and cryptographic/QR formatting tools based on published technical specifications and is not a law firm, tax advisor, or certified Peppol Access Point.
137
+
138
+ ## License
139
+ MIT License — Copyright (c) 2026 SpecGrid.
@@ -0,0 +1,15 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "specgrid-eu-compliance"
7
+ version = "1.6.0"
8
+ description = "Zero-dependency Python 3 client for the SpecGrid EU e-Invoicing & Regulatory Compliance API (AEAT VeriFactu, Peppol EN 16931, Facturae, SEPA EPC QR, EU GPSR, IBAN/NIF)."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { text = "MIT" }
12
+ keywords = ["verifactu", "peppol", "facturae", "sepa-qr", "einvoicing", "gpsr", "iban"]
13
+
14
+ [tool.setuptools]
15
+ py-modules = ["specgrid_client"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,72 @@
1
+ """
2
+ SpecGrid EU Compliance & e-Invoicing Python 3 Zero-Dependency Client (v1.1.0).
3
+ Portal: https://eu.specgrid-api.workers.dev
4
+ RapidAPI Hub: https://rapidapi.com/specgrid-specgrid-default/api/specgrid-eu-e-invoicing-verifactu-sepa-qr
5
+ """
6
+ from __future__ import annotations
7
+
8
+ import json
9
+ import urllib.request
10
+ from typing import Any, Dict, List, Optional
11
+
12
+
13
+ class SpecGridClient:
14
+ def __init__(
15
+ self,
16
+ api_key: Optional[str] = None,
17
+ rapidapi_key: Optional[str] = None,
18
+ rapidapi_host: str = "specgrid-eu-e-invoicing-verifactu-sepa-qr.p.rapidapi.com",
19
+ base_url: str = "https://eu.specgrid-api.workers.dev",
20
+ ) -> None:
21
+ self.headers: Dict[str, str] = {"Content-Type": "application/json"}
22
+ if rapidapi_key:
23
+ self.base_url = f"https://{rapidapi_host}"
24
+ self.headers["X-RapidAPI-Key"] = rapidapi_key
25
+ self.headers["X-RapidAPI-Host"] = rapidapi_host
26
+ else:
27
+ self.base_url = base_url.rstrip("/")
28
+ if api_key:
29
+ self.headers["Authorization"] = f"Bearer {api_key}"
30
+
31
+ def _post(self, path: str, payload: Dict[str, Any]) -> Dict[str, Any]:
32
+ req = urllib.request.Request(
33
+ f"{self.base_url}{path}",
34
+ data=json.dumps(payload).encode("utf-8"),
35
+ headers=self.headers,
36
+ method="POST",
37
+ )
38
+ with urllib.request.urlopen(req, timeout=15) as resp:
39
+ return json.loads(resp.read().decode("utf-8"))
40
+
41
+ def verifactu_fingerprint(self, **kwargs: Any) -> Dict[str, Any]:
42
+ return self._post("/api/v1/verifactu/fingerprint", kwargs)
43
+
44
+ def verify_verifactu_chain(self, records: List[Dict[str, Any]]) -> Dict[str, Any]:
45
+ return self._post("/api/v1/verifactu/verify-chain", {"records": records})
46
+
47
+ def validate_einvoice(self, xml: str) -> Dict[str, Any]:
48
+ return self._post("/api/v1/einvoice/validate", {"xml": xml})
49
+
50
+ def generate_einvoice(self, **kwargs: Any) -> Dict[str, Any]:
51
+ return self._post("/api/v1/einvoice/generate", kwargs)
52
+
53
+ def generate_sepa_qr(self, **kwargs: Any) -> Dict[str, Any]:
54
+ return self._post("/api/v1/sepa/epc-qr", kwargs)
55
+
56
+ def validate_tax_id(
57
+ self,
58
+ spanish_tax_id: Optional[str] = None,
59
+ eu_vat: Optional[str] = None,
60
+ iban: Optional[str] = None,
61
+ ) -> Dict[str, Any]:
62
+ body: Dict[str, Any] = {}
63
+ if spanish_tax_id:
64
+ body["spanishTaxId"] = spanish_tax_id
65
+ if eu_vat:
66
+ body["euVat"] = eu_vat
67
+ if iban:
68
+ body["iban"] = iban
69
+ return self._post("/api/v1/tax-id/validate", body)
70
+
71
+ def generate_gpsr_pack(self, **kwargs: Any) -> Dict[str, Any]:
72
+ return self._post("/api/v1/gpsr/compliance-pack", kwargs)
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: specgrid-eu-compliance
3
+ Version: 1.6.0
4
+ Summary: Zero-dependency Python 3 client for the SpecGrid EU e-Invoicing & Regulatory Compliance API (AEAT VeriFactu, Peppol EN 16931, Facturae, SEPA EPC QR, EU GPSR, IBAN/NIF).
5
+ License: MIT
6
+ Keywords: verifactu,peppol,facturae,sepa-qr,einvoicing,gpsr,iban
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: license-file
11
+
12
+ # SpecGrid EU e-Invoicing & Compliance SDK + MCP Server (MCP · Node/TS · Python · PHP · n8n · Make.com)
13
+
14
+ [![SDK & Templates CI](https://github.com/SpecGrid-tools/specgrid-eu-compliance-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/SpecGrid-tools/specgrid-eu-compliance-sdk/actions/workflows/ci.yml)
15
+ [![License: MIT](https://img.shields.io/badge/License-MIT-emerald.svg)](./LICENSE)
16
+ [![OpenAPI 3.0.3](https://img.shields.io/badge/OpenAPI-3.0.3-blue.svg)](https://eu.specgrid-api.workers.dev/openapi.json)
17
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen.svg)](#)
18
+
19
+ Zero-dependency official client SDKs, **Postman Collection v2.1**, and ready-to-import **n8n & Make.com automation templates** for the **[SpecGrid EU Compliance API](https://eu.specgrid-api.workers.dev)** (running on Cloudflare Workers with zero payload retention):
20
+
21
+ - **Spanish AEAT VeriFactu (RD 1007/2023 & Orden HAC/1177/2024):** Exact 8-field canonical `SHA-256` `Huella` chaining, multi-record tamper verification, `ValidarQR` URLs (prod & sandbox), printable Tributary QR SVG, and `<sf:RegistroAlta>` XML generation.
22
+ - **Peppol BIS Billing 3.0 (EN 16931 UBL 2.1 / XRechnung) & Spanish Facturae 3.2.2:** JSON-to-UBL XML generation + cent-level mathematical & structural validation (`BR-CO-10..16`, XXE-hardened).
23
+ - **SEPA EPC069-12 v002 Payment QR (GiroCode):** Scan-to-pay European credit transfer QR payloads & ECL-M SVGs with automatic ISO 13616 IBAN Mod-97 verification.
24
+ - **EU-27 VAT, ISO 13616 Mod-97 IBAN & Spanish NIF/NIE/CIF Checksum Validation.**
25
+ - **EU GPSR (Regulation 2023/988) Compliance Pack:** Manufacturer & EU-27 Responsible Person validation + tracking-free safety QR SVG generator.
26
+
27
+ ---
28
+
29
+ ## Try Free or Subscribe (Global MoR · Automated EU VAT Invoice)
30
+
31
+ | Channel | Tier | Quota | Link |
32
+ | :--- | :--- | :--- | :--- |
33
+ | **Interactive Web Sandbox** | Free Browser Playground | Instant live JSON + SVG preview | [eu.specgrid-api.workers.dev](https://eu.specgrid-api.workers.dev) |
34
+ | **RapidAPI Hub** | Basic `$0` / Pro `$15` / Ultra `$39` | `50` / `5,000` / `50,000` calls/mo | [RapidAPI Hub Listing](https://rapidapi.com/specgrid-specgrid-default/api/specgrid-eu-e-invoicing-verifactu-sepa-qr) |
35
+ | **Direct API Key (Polar.sh)** | Starter `$15/mo` · Growth `$39/mo` | Instant `SPECGRID-...` Bearer Key | [Direct Polar Checkout](https://eu.specgrid-api.workers.dev/#pricing) |
36
+
37
+ ---
38
+
39
+ ## AI Agent Integration — MCP Server (Cursor · Claude Desktop · Windsurf · Antigravity)
40
+
41
+ Give any LLM coding agent deterministic EU compliance tools (zero hash/math/XML hallucinations) using either **Remote Streamable HTTP** or our **Zero-Dependency Local Stdio Bridge**:
42
+
43
+ ### Option A: Remote Streamable HTTP (Recommended — Zero Install)
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "specgrid-eu-compliance": {
48
+ "url": "https://eu.specgrid-api.workers.dev/mcp",
49
+ "headers": {
50
+ "Authorization": "Bearer SPECGRID-YOUR-POLAR-KEY"
51
+ }
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ ### Option B: Local Zero-Dependency Stdio MCP Bridge (`mcp/specgrid-mcp-server.mjs`)
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "specgrid-eu-compliance": {
62
+ "command": "node",
63
+ "args": ["/path/to/specgrid-eu-compliance-sdk/mcp/specgrid-mcp-server.mjs"],
64
+ "env": {
65
+ "SPECGRID_API_KEY": "SPECGRID-YOUR-POLAR-KEY"
66
+ }
67
+ }
68
+ }
69
+ }
70
+ ```
71
+ Exposes all 7 deterministic MCP tools: `verifactu_fingerprint`, `verifactu_verify_chain`, `einvoice_validate`, `einvoice_generate`, `sepa_epc_qr`, `tax_id_validate`, and `gpsr_compliance_pack`.
72
+
73
+ ---
74
+
75
+ ## Quickstart — TypeScript / Node 20+ (`0` Dependencies)
76
+
77
+ ```ts
78
+ import { SpecGridClient } from './src/index.ts';
79
+
80
+ // Option A: Direct Polar.sh Key (Authorization: Bearer ...)
81
+ const client = new SpecGridClient({ apiKey: process.env.SPECGRID_API_KEY });
82
+
83
+ // Option B: RapidAPI Hub Key
84
+ // const client = new SpecGridClient({ rapidApiKey: process.env.RAPIDAPI_KEY });
85
+
86
+ const verifactu = await client.generateElectronicInvoice({
87
+ format: 'verifactu_registro_alta',
88
+ invoiceNumber: 'INV-2026/0105',
89
+ issueDate: '2026-11-29',
90
+ supplier: { name: 'SpecGrid Systems SL', taxId: 'B85905495', countryCode: 'ES' },
91
+ customer: { name: 'Nordic Automation GmbH', taxId: 'DE123456789', countryCode: 'DE' },
92
+ lines: [{ description: 'Engineering Services', quantity: 2, unitPrice: 50, vatRate: 21 }]
93
+ });
94
+
95
+ console.log('AEAT SHA-256 Huella:', verifactu.fingerprintSha256);
96
+ console.log('AEAT ValidarQR URL:', verifactu.qrValidationUrl);
97
+ ```
98
+
99
+ See runnable examples in [`examples/verifactu-quickstart.mjs`](./examples/verifactu-quickstart.mjs) and [`examples/peppol-ubl-quickstart.mjs`](./examples/peppol-ubl-quickstart.mjs).
100
+
101
+ ## Quickstart — Python 3 (`0` Dependencies)
102
+
103
+ ```python
104
+ import os
105
+ from python.specgrid_client import SpecGridClient
106
+
107
+ client = SpecGridClient(api_key=os.environ["SPECGRID_API_KEY"])
108
+ sepa = client.generate_sepa_qr(
109
+ beneficiaryName="SpecGrid Systems SL",
110
+ iban="ES9121000418450200051332",
111
+ amountEur=121.00,
112
+ remittanceText="Invoice INV-2026/0105"
113
+ )
114
+ print(sepa["payload"])
115
+ ```
116
+
117
+ ## Quickstart — PHP 8+ / Laravel / WooCommerce (`0` Dependencies)
118
+
119
+ ```php
120
+ <?php
121
+ require_once __DIR__ . '/php/SpecGridClient.php';
122
+
123
+ $client = new \SpecGrid\SpecGridClient(apiKey: getenv('SPECGRID_API_KEY'));
124
+ $vf = $client->generateElectronicInvoice([
125
+ 'format' => 'verifactu_registro_alta',
126
+ 'invoiceNumber' => 'INV-2026/0105',
127
+ 'issueDate' => '2026-11-29',
128
+ 'supplier' => ['name' => 'SpecGrid Systems SL', 'taxId' => 'B85905495', 'countryCode' => 'ES'],
129
+ 'customer' => ['name' => 'Cliente SA', 'taxId' => 'A12345674', 'countryCode' => 'ES'],
130
+ 'lines' => [['description' => 'Suscripcion SaaS', 'quantity' => 1, 'unitPrice' => 100.0, 'vatRate' => 21]],
131
+ ]);
132
+
133
+ echo $vf['fingerprintSha256'] . PHP_EOL;
134
+ echo $vf['qrValidationUrl'] . PHP_EOL;
135
+ ```
136
+
137
+ ## No-Code Templates & API Tools (1-Click Import)
138
+
139
+ - **n8n Workflow:** Import [`n8n/verifactu-sepa-invoice-workflow.json`](./n8n/verifactu-sepa-invoice-workflow.json) via **Workflows → Import from File** and replace `SPECGRID-REPLACE-WITH-YOUR-POLAR-KEY` with your live `SPECGRID-...` key (or `X-RapidAPI-Key`).
140
+ - **Make.com Scenario Blueprint:** Import [`make/verifactu-sepa-make-blueprint.json`](./make/verifactu-sepa-make-blueprint.json) into a new Make scenario to chain Webhook → VeriFactu XML + SHA-256 → SEPA EPC QR → JSON Response.
141
+ - **Postman / Insomnia / Bruno / Hoppscotch:** Import [`postman/specgrid-eu-compliance.postman_collection.json`](./postman/specgrid-eu-compliance.postman_collection.json) (all 8 endpoints pre-populated with verified payloads) or load the CORS-enabled OpenAPI 3.0.3 schema directly from `https://eu.specgrid-api.workers.dev/openapi.json`.
142
+ - **AI / LLM Documentation:** Machine-readable specs available at `https://eu.specgrid-api.workers.dev/llms.txt` and `/llms-full.txt`.
143
+
144
+ ---
145
+
146
+ ## Security & Technical Scope
147
+ SpecGrid processes invoice XMLs, tax identifiers, and IBANs synchronously in memory with **zero payload retention**. SpecGrid provides deterministic software validation and cryptographic/QR formatting tools based on published technical specifications and is not a law firm, tax advisor, or certified Peppol Access Point.
148
+
149
+ ## License
150
+ MIT License — Copyright (c) 2026 SpecGrid.
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ specgrid_client.py
5
+ specgrid_eu_compliance.egg-info/PKG-INFO
6
+ specgrid_eu_compliance.egg-info/SOURCES.txt
7
+ specgrid_eu_compliance.egg-info/dependency_links.txt
8
+ specgrid_eu_compliance.egg-info/top_level.txt