taler-typescript-core

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

commit 5fd8107367dabee17372e25193e90f3484eb9206
parent 3bca5c94b5c61ffa35279548f74d2ce40f9cd926
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 16 Dec 2025 21:14:27 +0100

more work on PDF generation test

Diffstat:
Mpackages/taler-harness/src/integrationtests/test-tops-aml-pdf.ts | 248++++++++-----------------------------------------------------------------------
1 file changed, 23 insertions(+), 225 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 @@ -95,6 +95,9 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { officerAcc, exchangeClient, accountPaytoHash, + fakeChallenger, + challengerPostal, + challengerSms, } = await setupMeasuresTestEnvironment(t); // Test vqf_902_1_customer form - LEGAL_ENTITY variant @@ -155,16 +158,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { CUSTOMER_TYPE_VQF: "OPERATIONAL", }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - console.log(`got ${res.byteLength} bytes`); - const f = t.testDir + `/aml-form-vqf_902_1_customer-legal.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_1_customer form - NATURAL_PERSON variant (without sole proprietor) @@ -187,17 +180,7 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { CORRESPONDENCE_LANGUAGE: "de", CUSTOMER_TYPE_VQF: "NATURAL", }); - await expectInvestigate(); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_1_customer-natural.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_1_customer form - NATURAL_PERSON variant (with sole proprietor) @@ -222,17 +205,7 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { CORRESPONDENCE_LANGUAGE: "fr", CUSTOMER_TYPE_VQF: "OTHER", }); - await expectInvestigate(); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_1_customer-sole-proprietor.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } { @@ -260,15 +233,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { ], }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_1_officer.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_1_officer form with LISTED terrorism check @@ -299,15 +263,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { ], }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_1_officer-listed.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_4 form - without PEP or high risk @@ -336,15 +291,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { RISK_CLASSIFICATION_LEVEL: "NO_HIGH_RISK", }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_4-low-risk.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_4 form - with PEP and high risk @@ -375,17 +321,7 @@ 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", }); - await expectInvestigate(); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_4-high-risk.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_5 form - with SAVINGS origin @@ -418,15 +354,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { "Customer has been transparent about income sources. All documentation verified.", }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_5-savings.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_5 form - with INHERITANCE and OTHER origin @@ -460,15 +387,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { "Estate documentation and business sale agreement on file. All sources verified through notarized documents.", }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_5-inheritance.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_9_customer form @@ -502,15 +420,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { SIGN_DATE: "2025-12-05", }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_9_customer.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_9_officer form @@ -543,20 +452,12 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { ATTACHMENT_SIGNED_DOCUMENT: createPdfAttachment("signed-form-902-9"), }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_9_officer.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_11_customer form - HAS_25_MORE_RIGHTS variant, without third party if (false) { // FIXME: dold + await decideMeasure("form-vqf-902.11"); await submitForm("vqf_902_11_customer", { FORM_ID: "vqf_902_11_customer", FORM_VERSION: 1, @@ -582,20 +483,11 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { SIGN_DATE: "2025-12-04", }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_11_customer-25percent.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_11_customer form - OTHER_WAY variant, with third party - if (false) { - // FIXME: dold + { + await decideMeasure("form-vqf-902.11"); await submitForm("vqf_902_11_customer", { FORM_ID: "vqf_902_11_customer", FORM_VERSION: 1, @@ -621,20 +513,11 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { SIGN_DATE: "2025-12-03", }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_11_customer-other-way.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_11_customer form - DIRECTOR variant - if (false) { - // FIXME: dold + { + await decideMeasure("form-vqf-902.11"); await submitForm("vqf_902_11_customer", { FORM_ID: "vqf_902_11_customer", FORM_VERSION: 1, @@ -660,15 +543,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { SIGN_DATE: "2025-12-02", }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_11_customer-director.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_11_officer form - HAS_25_MORE_RIGHTS variant @@ -697,15 +571,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { ATTACHMENT_SIGNED_DOCUMENT: createPdfAttachment("signed-form-902-11"), }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_11_officer.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_14 form - NO_SUSPICION result @@ -723,15 +588,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { INCRISK_RESULT: "NO_SUSPICION", }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_14-no-suspicion.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_14 form - SUBSTANTIATED_SUSPICION result @@ -749,15 +605,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { INCRISK_RESULT: "SUBSTANTIATED_SUSPICION", }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_14-substantiated.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test vqf_902_14 form - OTHER result with explanation @@ -779,15 +626,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { "Enhanced monitoring period established - 6-month review cycle with quarterly reporting requirements", }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-vqf_902_14-other.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test generic_note form @@ -813,15 +651,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { ], }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-generic_note.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test generic_upload form @@ -834,15 +663,6 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { FILE: createPdfAttachment("business-license-2025"), }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-generic_upload.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } // Test accept-tos form @@ -855,57 +675,35 @@ export async function runTopsAmlPdfTest(t: GlobalTestState) { DOWNLOADED_TERMS_OF_SERVICE: true, }); - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-accept-tos.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); + } + + // Test challenger-sms form + { + await decideMeasure("sms-registration"); + await fakeChallenger(challengerSms, { + CONTACT_PHONE: "+4123456789", + }); } // Test challenger-postal form - if (false) { - // FIXME: Dold: This is not exactly a 'form'. How to submit? + { await decideMeasure("postal-registration"); - await submitForm("challenger-postal", { - FORM_ID: "challenger-postal", - FORM_VERSION: 1, - CONTACT_NAME: "Hans Müller", - ADDRESS_LINES: "Bahnhofstrasse 123\n8001 Zürich", + await fakeChallenger(challengerPostal, { + CONTACT_NAME: "Richard Stallman", + ADDRESS_LINES: "Bundesgasse 1\n1234 Bern", ADDRESS_COUNTRY: "CH", }); - - const res = succeedOrThrow( - await exchangeClient.getAmlAttributesForAccountAsPdf( - officerAcc, - accountPaytoHash, - ), - ); - const f = t.testDir + `/aml-form-challenger-postal.pdf`; - fs.writeFileSync(f, Buffer.from(res)); - console.log(`written to ${f}`); } - // Test challenger-sms form - if (false) { - // FIXME: Dold: This is not exactly a 'form'. How to submit? - await decideMeasure("sms-registration"); - await submitForm("challenger-sms", { - FORM_ID: "challenger-sms", - FORM_VERSION: 1, - CONTACT_PHONE: "+41791234567", - }); - + // Final PDF generation + { const res = succeedOrThrow( await exchangeClient.getAmlAttributesForAccountAsPdf( officerAcc, accountPaytoHash, ), ); - const f = t.testDir + `/aml-form-challenger-sms.pdf`; + const f = t.testDir + `/aml-form-challenger-postal.pdf`; fs.writeFileSync(f, Buffer.from(res)); console.log(`written to ${f}`); }