Skip to content

slpa: add the Electronic Cargo Declaration Note (ECDN) submission flow - #26

Open
Aravinda-HWK wants to merge 5 commits into
mainfrom
feat/slpa-ecdn-submission
Open

slpa: add the Electronic Cargo Declaration Note (ECDN) submission flow#26
Aravinda-HWK wants to merge 5 commits into
mainfrom
feat/slpa-ecdn-submission

Conversation

@Aravinda-HWK

Copy link
Copy Markdown
Collaborator

Draft: do not merge before OpenNSW/nsw-srilanka#322 is merged and deployed. These artifacts reference the SLPA_ECDN_UPLOAD task type, and an artifact naming a task type the deployment does not have fails at runtime — the activity retries artifact not found indefinitely rather than failing loudly.

Adds the SLPA leg of the export flow: the trader fills the ECDN form, NSW renders it as the XML SLPA's Cargo Management System expects, and uploads it. SLPA is the system of record for the declaration, so the flow ends once the CMS accepts it; a rejection returns the trader to the form with the CMS's own reasons, shown by the cig_rejection-style markdown section.

Shape

slpa-ecdn-submission (macro, a branch of trade_4_trigger_flows)
└── slpa-ecdn-submission-flow (task)
    applicant_submission ──> cms_upload ──> upload_check ──┬── accepted ──> end
                                  ▲                        │
                                  └──── rejected ──────────┘

1-ecdn_submission/ carries the task template, the two subtasks (USER_INPUT, SLPA_ECDN_UPLOAD), the render config, the completion message and the rejection template.

The form

userinput_jsonform.json mirrors SLPA's own ECDN form at mpma.slpa.lk/ecdn field for field, so a trader filling this and a clerk filling theirs produce the same declaration. That includes their code lists verbatim — 35 customs office codes, 6 terminals (JCT/CICT/SAGT/UCT/ECT/CWIT), 24 package types, FCL/LCL — and the repeating container table (type, size, seal, mark, commodity). The 18 fields SLPA marks mandatory are required here; the rest stay optional, as they are there.

Fields SLPA's XML derives rather than collects are not asked for: CusDecSerial is composed from the office, declaration number and year, and the container key from the declaration and date.

Company identity

SLPA identifies the submitting company by the slpacmsuser-key it issues per registered company. That is not configuration here — it rides the consignment:

trade_workflow      traderCompany? → company        (seeded at consignment start)
prepare_split_items company?       → company
HSCODE_SPLIT_BUILDER               → each split item payload carries `company`
slpa_workflow       _iter.input.company.data.slpacmsuser_key? → client_key
1-ecdn_submission   client_key?    → client_key      (becomes the header)

A branch child starts with only its iteration context, so anything an agency flow needs has to be placed in the split item payload. The builder carries the company verbatim, so another agency wanting a different field is a mapping change here rather than a code change.

Also in this PR

The flow is added to the HS-code picker as SLPA Electronic Cargo Declaration Note (SLPA Flow), placed next to Customs since the ECDN quotes the CusDec.

summary_markdown.json is regenerated from the picker's own option list. The two had drifted independently: the summary never learned cda-kernel-asycuda-approval, so that flow rendered as a bare id instead of its name. Generating from the picker keeps them from disagreeing again.

Checks run

  • Every manifest path exists; main's 451 rows are all still present, plus 9 new ones.
  • Every workflow node references the right artifact kind for its level (macro nodes → task_template, micro nodes → subtask_template, SPLIT_TASK → a registered workflow), and no edge points at an undeclared node.
  • Every picker const resolves to a registered workflow — the check that catches a selectable flow that would die at runtime.
  • Every render section names a registered template.
  • Loaded into a running stack: 460 artifacts registered, no errors.

Known gaps

SLPA has not published the XSD, so the document shape rests on one reference file their generator produced. Worth diffing against the schema if they share it.

Their CMS currently fails inserting containers (Unknown column 'ISOType'), which blocks the last step of a real submission — see OpenNSW/nsw-srilanka#322 for the detail. The flow reaches that point correctly.

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: f7a6033e-e547-4260-89b6-b0230bc403c0


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Aravinda-HWK
Aravinda-HWK requested a review from a team August 24, 2026 18:42
@Aravinda-HWK Aravinda-HWK self-assigned this Aug 24, 2026
@Aravinda-HWK
Aravinda-HWK marked this pull request as ready for review August 24, 2026 18:42

@ginaxu1 ginaxu1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest

  1. Harden approval/invoice gateways: make sure decision / payment namespaces always exist, or restructure conditions like SLTB #38 (first-pass edge using only known namespaces + unconditional fallback)
  2. Correct the PR description to reflect the full 4-step flow and list all engine dependencies

Or split into smaller PRs: merge ECDN-only (step 1) once engine #345 is deployed, then follow with service order / approval / payment artifacts as their engine PRs land. That will match what is described in the current PR description

@Aravinda-HWK
Aravinda-HWK marked this pull request as draft August 29, 2026 05:34
@Aravinda-HWK
Aravinda-HWK marked this pull request as ready for review September 1, 2026 18:14
@Aravinda-HWK
Aravinda-HWK force-pushed the feat/slpa-ecdn-submission branch from b5dc94a to 5ae83cb Compare September 1, 2026 18:15
@Aravinda-HWK

Copy link
Copy Markdown
Collaborator Author

Superseded — folded into #41, which now carries the full SLPA ECDN + consolidation + gate pass flow as a single PR against main.

@Aravinda-HWK Aravinda-HWK reopened this Sep 5, 2026
@Aravinda-HWK

Copy link
Copy Markdown
Collaborator Author

Disregard the previous comment — this PR was closed and reopened in error while trying to collapse the stack. GitHub would not allow #41 to be retargeted off the stack, so #26 and #41 stay stacked as before: #26 → main, #41#26.

@sthanikan2000
sthanikan2000 force-pushed the feat/slpa-ecdn-submission branch from 5ae83cb to 158ebfd Compare September 7, 2026 04:53
The trader fills the ECDN form, NSW renders it as the XML SLPA's Cargo
Management System expects, and uploads it. SLPA is the system of record for the
declaration, so the flow ends once the CMS accepts it; a rejection returns the
trader to the form with the CMS's own reasons.

The form mirrors SLPA's own ECDN form at mpma.slpa.lk/ecdn field for field,
including its code lists (35 customs offices, 6 terminals, 24 package types,
FCL/LCL) and the repeating container table. The 18 fields SLPA marks mandatory
are required here; the rest stay optional as they are there.

SLPA identifies the submitting company by a key it issues per registered company,
so the flow reads it from the company profile the workflow carries: the split
that spawns an agency flow puts the company in the branch payload, and the
mapping here picks out the key. Nothing about the key is hardcoded.

Also adds the flow to the HS-code picker, and regenerates the selection summary
from that picker's own option list — the two had drifted, so the CDA ASYCUDA
approval flow was rendering in the summary as a bare id.
@sthanikan2000
sthanikan2000 force-pushed the feat/slpa-ecdn-submission branch from 158ebfd to 905111c Compare September 7, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants