PR C: wire real NotaryRegistry on Chain 138 (arch step 4) (#7)
Some checks failed
CI / Frontend Lint (push) Failing after 6s
CI / Frontend Type Check (push) Failing after 6s
CI / Frontend Build (push) Failing after 6s
CI / Frontend E2E Tests (push) Failing after 8s
CI / Contracts Compile (push) Has been cancelled
CI / Contracts Test (push) Has been cancelled
CI / Orchestrator Build (push) Has been cancelled
Security Scan / OWASP ZAP Scan (push) Has been cancelled
Security Scan / Dependency Vulnerability Scan (push) Has been cancelled
Some checks failed
CI / Frontend Lint (push) Failing after 6s
CI / Frontend Type Check (push) Failing after 6s
CI / Frontend Build (push) Failing after 6s
CI / Frontend E2E Tests (push) Failing after 8s
CI / Contracts Compile (push) Has been cancelled
CI / Contracts Test (push) Has been cancelled
CI / Orchestrator Build (push) Has been cancelled
Security Scan / OWASP ZAP Scan (push) Has been cancelled
Security Scan / Dependency Vulnerability Scan (push) Has been cancelled
This commit was merged in pull request #7.
This commit is contained in:
@@ -70,6 +70,52 @@ function validateStep(step: PlanStep, index: number): string[] {
|
||||
errors.push(`Step ${index + 1}: Invalid pay step (asset/amount/IBAN missing)`);
|
||||
}
|
||||
break;
|
||||
case "issueInstrument": {
|
||||
const inst = step.instrument;
|
||||
if (!inst) {
|
||||
errors.push(`Step ${index + 1}: issueInstrument step missing instrument terms`);
|
||||
break;
|
||||
}
|
||||
const required: Array<keyof typeof inst> = [
|
||||
"applicant",
|
||||
"issuingBankBIC",
|
||||
"beneficiaryBankBIC",
|
||||
"beneficiaryName",
|
||||
"currency",
|
||||
"tenor",
|
||||
"expiryDate",
|
||||
"placeOfPresentation",
|
||||
"governingLaw",
|
||||
"templateRef",
|
||||
"templateHash",
|
||||
];
|
||||
for (const key of required) {
|
||||
if (!inst[key] || String(inst[key]).trim() === "") {
|
||||
errors.push(`Step ${index + 1}: instrument.${String(key)} is required`);
|
||||
}
|
||||
}
|
||||
if (!(inst.amount > 0)) {
|
||||
errors.push(`Step ${index + 1}: instrument.amount must be > 0`);
|
||||
}
|
||||
if (inst.currency && !/^[A-Z]{3}$/.test(inst.currency)) {
|
||||
errors.push(`Step ${index + 1}: instrument.currency must be ISO 4217 (e.g. USD)`);
|
||||
}
|
||||
// BIC is 8 or 11 chars: 4 bank + 2 country + 2 location [+ 3 branch]
|
||||
const bicRe = /^[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$/;
|
||||
if (inst.issuingBankBIC && !bicRe.test(inst.issuingBankBIC)) {
|
||||
errors.push(`Step ${index + 1}: instrument.issuingBankBIC is not a valid BIC`);
|
||||
}
|
||||
if (inst.beneficiaryBankBIC && !bicRe.test(inst.beneficiaryBankBIC)) {
|
||||
errors.push(`Step ${index + 1}: instrument.beneficiaryBankBIC is not a valid BIC`);
|
||||
}
|
||||
if (inst.expiryDate && !/^\d{4}-\d{2}-\d{2}$/.test(inst.expiryDate)) {
|
||||
errors.push(`Step ${index + 1}: instrument.expiryDate must be YYYY-MM-DD`);
|
||||
}
|
||||
if (inst.templateHash && !/^[0-9a-fA-F]{64}$/.test(inst.templateHash)) {
|
||||
errors.push(`Step ${index + 1}: instrument.templateHash must be 64 hex chars (sha256)`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
|
||||
Reference in New Issue
Block a user