taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit f21286b6e7a73465267934641efdfcdef58ca1cd
parent bc5a87bc01f87095b2c37298a8804f12fbde5349
Author: Florian Dold <florian@dold.me>
Date:   Wed,  4 Feb 2026 14:50:35 +0100

harness: generate empty PDF

Diffstat:
Mpackages/taler-harness/src/integrationtests/test-tops-aml-pdf.ts | 46++++++++++++++++++++--------------------------
1 file changed, 20 insertions(+), 26 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-tops-aml-pdf.ts b/packages/taler-harness/src/integrationtests/test-tops-aml-pdf.ts @@ -31,13 +31,15 @@ interface FileField { MIME_TYPE: string; } - /** * Helper function to create a mock PDF file attachment. */ function createPdfAttachment(name: string): FileField { // Escape parentheses and backslashes for PDF literal strings - const contentEscaped = name.replace(/\\/g, "\\\\").replace(/\(/g, "\\(").replace(/\)/g, "\\)"); + const contentEscaped = name + .replace(/\\/g, "\\\\") + .replace(/\(/g, "\\(") + .replace(/\)/g, "\\)"); const contentStream = `BT /F1 12 Tf 10 20 Td (${contentEscaped}) Tj ET`; @@ -100,6 +102,20 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { challengerSms, } = await setupMeasuresTestEnvironment(t); + // Final PDF generation + { + const res = succeedOrThrow( + await exchangeClient.getAmlAttributesForAccountAsPdf( + officerAcc, + accountPaytoHash, + { limit: 100, order: "asc" }, + ), + ); + const f = t.testDir + `/aml-file-initial.pdf`; + fs.writeFileSync(f, Buffer.from(res)); + console.log(`written to ${f}`); + } + // Test vqf_902_1_customer form - LEGAL_ENTITY variant { await decideMeasure("kyx"); @@ -158,7 +174,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { CORRESPONDENCE_LANGUAGE: "en", CUSTOMER_TYPE_VQF: "OPERATIONAL", }); - } // Test vqf_902_1_customer form - NATURAL_PERSON variant (without sole proprietor) @@ -182,7 +197,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { CORRESPONDENCE_LANGUAGE: "de", CUSTOMER_TYPE_VQF: "NATURAL", }); - } // Test vqf_902_1_customer form - NATURAL_PERSON variant (with sole proprietor) @@ -208,7 +222,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { CORRESPONDENCE_LANGUAGE: "fr", CUSTOMER_TYPE_VQF: "OTHER", }); - } { @@ -235,7 +248,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { }, ], }); - } // Test vqf_902_1_officer form with LISTED terrorism check @@ -248,8 +260,7 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { ACCEPTANCE_FURTHER_INFO: "Authenticated copy received via postal service", EMBARGO_TERRORISM_CHECK_RESULT: "LISTED", EMBARGO_TERRORISM_CHECK_DATE: "2025-12-02", - EMBARGO_TERRORISM_INFO: - "Entry 4252 might match", + EMBARGO_TERRORISM_INFO: "Entry 4252 might match", SUPPLEMENTAL_FILES_LIST: [ { FILE: createPdfAttachment("sanctions-report"), @@ -265,7 +276,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { }, ], }); - } // Test vqf_902_4 form - without PEP or high risk @@ -294,7 +304,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { "Customer is well-known local business with transparent operations", RISK_CLASSIFICATION_LEVEL: "NO_HIGH_RISK", }); - } // Test vqf_902_4 form - with PEP and high risk @@ -327,7 +336,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { "Customer is foreign PEP with connections to high-risk jurisdictions. Enhanced due diligence applied.", RISK_CLASSIFICATION_LEVEL: "HIGH_RISK", }); - } // Test vqf_902_5 form - with SAVINGS origin @@ -360,7 +368,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { BIZREL_FURTHER_INFO: "Customer has been transparent about income sources. All documentation verified.", }); - } // Test vqf_902_5 form - with INHERITANCE and OTHER origin @@ -394,7 +401,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { BIZREL_FURTHER_INFO: "Estate documentation and business sale agreement on file. All sources verified through notarized documents.", }); - } // Test vqf_902_9_customer form @@ -427,7 +433,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { SIGNATURE: "Michael Anderson", SIGN_DATE: "2025-12-05", }); - } // Test vqf_902_9_officer form @@ -459,7 +464,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { ], ATTACHMENT_SIGNED_DOCUMENT: createPdfAttachment("signed-form-902-9"), }); - } // Test vqf_902_11_customer form - HAS_25_MORE_RIGHTS variant, without third party @@ -489,7 +493,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { SIGNATURE: "William Brown", SIGN_DATE: "2025-12-04", }); - } // Test vqf_902_11_customer form - OTHER_WAY variant, with third party @@ -519,7 +522,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { SIGNATURE: "Sophia Martinez", SIGN_DATE: "2025-12-03", }); - } // Test vqf_902_11_customer form - DIRECTOR variant @@ -549,7 +551,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { SIGNATURE: "Alexander Mueller", SIGN_DATE: "2025-12-02", }); - } // Test vqf_902_11_officer form - HAS_25_MORE_RIGHTS variant @@ -577,7 +578,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { THIRD_PARTY_OWNERSHIP: true, ATTACHMENT_SIGNED_DOCUMENT: createPdfAttachment("signed-form-902-11"), }); - } // Test vqf_902_14 form - NO_SUSPICION result @@ -595,7 +595,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { "Property sales agreement (notarized), Bank transfer confirmation, Tax declaration", INCRISK_RESULT: "NO_SUSPICION", }); - } // Test vqf_902_14 form - SUBSTANTIATED_SUSPICION result @@ -612,7 +611,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { "Transaction logs, Customer interviews, Public records search, Third-party database checks", INCRISK_RESULT: "REASONABLE_SUSPICION", }); - } // Test vqf_902_14 form - OTHER result with explanation @@ -633,7 +631,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { INCRISK_RESULT_OTHER: "Enhanced monitoring period established - 6-month review cycle with quarterly reporting requirements", }); - } // Test generic_note form @@ -658,7 +655,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { }, ], }); - } // Test generic_upload form @@ -670,7 +666,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { "Customer requested to upload current business license and updated company registry extract as part of periodic review.", FILE: createPdfAttachment("business-license-2025"), }); - } // Test accept-tos form @@ -682,7 +677,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { ACCEPTED_TERMS_OF_SERVICE: "v1", DOWNLOADED_TERMS_OF_SERVICE: true, }); - } // Test challenger-sms form @@ -709,7 +703,7 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { await exchangeClient.getAmlAttributesForAccountAsPdf( officerAcc, accountPaytoHash, - { limit: 100, order: "asc" } + { limit: 100, order: "asc" }, ), ); const f = t.testDir + `/aml-file.pdf`;