Customs declarations
Regimes
Dossier.Regime |
System | Message | XML envelope |
|---|---|---|---|
IM — Import |
IDMS | CC415 | IE415B / IIE415B |
EX — Export |
AES | CC515 | TBD |
The regime is set at upload time and determines the entire downstream processing: AI extraction prompt, transport cost calculation target value, XML generator used, and declaration type options on the Declare page.
Declaration types
IM — Import
| Field | Options |
|---|---|
DeclarationType |
IM |
AdditionalDeclarationType |
A — Standard, D — Simplified, E — Simplified (warehouse), X — Pre-arrival |
UseH2B = false (H1B) |
Standard import, procedure 40 |
UseH2B = true (H2B) |
Customs warehouse entry, procedure 71 — adds Warehouse element to XML |
EX — Export
| Field | Options |
|---|---|
DeclarationType |
EX |
AdditionalDeclarationType |
A — Standard, C — Simplified (authorised location), D — Simplified (standard), F — Pre-lodged |
| Procedure codes | 10 — Standard export, 21 — Re-export from warehouse, 23 — Temporary admission re-export |
Dossier workflow
flowchart TD
A(["Upload PDF / XLSX\n+ select regime IM/EX"])
A --> B["ProcessingWorker\nAI extraction"]
B -->|success| C["Review page\ncorrect extracted data"]
B -->|error| F
C --> D["TransportCosts page\nadd freight / insurance"]
D --> E["Declare page\nreferences & contacts"]
E --> G["Generate XML\nCC415 / CC515"]
G --> H(["Download / submit\nto customs"])
F(["Failed\nsee LastErrorMessage"]) -->|Retry| B
Dossier statuses
stateDiagram-v2
[*] --> Draft : upload
Draft --> Extracted : AI extraction OK
Draft --> Failed : AI / endpoint error
Failed --> Draft : Retry
Extracted --> Approved : Review saved
Approved --> Submitted : XML generated
Submitted --> [*]
| Status | Meaning |
|---|---|
Draft |
Just uploaded, processing not yet complete |
Extracted |
AI extraction complete, awaiting review |
Approved |
Reviewed and approved, ready to declare |
Submitted |
XML generated and submitted |
Failed |
AI extraction or endpoint error — see LastErrorMessage; use Retry button |
Transport cost division
Applies to both IM and EX. Handled on the /Dossiers/{id}/TransportCosts page.
| Regime | Target value | What to enter |
|---|---|---|
| IM | CIF — cost + insurance + freight to EU border | International freight (from origin to BE) |
| EX | FOB — free on board at EU exit point | Internal transport cost to EU border |
Distribution is proportional by line value across all goods items. The incoterm group (E/F, C, DAP) determines whether costs are added or deducted and which formula applies:
- E & F terms (EXW, FOB, FCA…): add AK (sender → EU border), add CA (EU border → destination), subtract FA (declaration cost)
- C terms (CIF, CFR, CPT…): no AK, add CA, subtract FA
- DAP / DDP / DPU: deduct BA (inside-EU portion), add CA, subtract FA
XML generation (IM / CC415)
Two message sub-types driven by CustomsDeclaration.UseH2B:
| CC415_H1B | CC415_H2B | |
|---|---|---|
| Procedure | 40 | 71 |
| Trader | Exporter |
Seller |
| Warehouse element | — | ✅ |
| SupportingDocument 4006 | — | ✅ (AGP licence) |
HS code format
Stored as 10 digits (no dots). Split for XML:
- Characters 1–6 → harmonizedSystemSubheadingCode
- Characters 7–8 → combinedNomenclatureCode
- Characters 9–10 → taricCode
Country resolution
Country names from AI extractions are resolved to ISO2 via the Tarbel GeographicalArea table. Unknown names (e.g. TURKIYE, USA) are resolved via the CountryAliases section in appsettings.json — see configuration.md.
XML generation (EX / CC515)
Not yet implemented. A separate CC515XmlGenerator service is planned — do not extend IE415BXmlGenerator.
Key differences from CC415:
- Root element and envelope differ
- ExportOperation instead of ImportOperation
- Exporter is mandatory with full address
- CountryOfDestination + CountryOfExport instead of CountryOfDispatch + Destination
- No Warehouse element