taler-typescript-core

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

commit ec8013f623ed33eb8962a1d3739d78f0d7c4f784
parent e19213ce3863e1ff4e9dfb2e98cf7257dc97cd68
Author: Florian Dold <florian@dold.me>
Date:   Wed, 16 Apr 2025 14:00:20 +0200

harness: fix tests involving forms

Diffstat:
Mpackages/taler-harness/src/integrationtests/test-kyc-form-withdrawal.ts | 7+++++--
Mpackages/taler-harness/src/integrationtests/test-kyc-merchant-deposit-rewrite.ts | 10++--------
Mpackages/taler-harness/src/integrationtests/test-kyc-new-measure.ts | 7+++++--
Mpackages/taler-harness/src/integrationtests/test-kyc-two-forms.ts | 51+++------------------------------------------------
4 files changed, 15 insertions(+), 60 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-kyc-form-withdrawal.ts b/packages/taler-harness/src/integrationtests/test-kyc-form-withdrawal.ts @@ -137,9 +137,12 @@ export async function runKycFormWithdrawalTest(t: GlobalTestState) { { method: "POST", headers: { - "Content-Type": "application/x-www-form-urlencoded", + "Content-Type": "application/json", + }, + body: { + full_name: "Alice Abc", + birthdate: "2000-01-01", }, - body: "full_name=Alice+Abc&birthdate=2000-01-01", }, ); diff --git a/packages/taler-harness/src/integrationtests/test-kyc-merchant-deposit-rewrite.ts b/packages/taler-harness/src/integrationtests/test-kyc-merchant-deposit-rewrite.ts @@ -153,19 +153,13 @@ export async function runKycMerchantDepositRewriteTest(t: GlobalTestState) { logger.info("We need to wire some money to ", exchangeWireTarget); - // // Order creation should fail at this point! - const order = { - summary: "Test", - amount: "TESTKUDOS:5", - fulfillment_url: "taler://fulfillment-success/thx", - } satisfies TalerMerchantApi.Order; - succeedOrThrow( await bankApi.createAccount(undefined, { name: "merchant-default", password: "merchant-default", username: "merchant-default", - payto_uri: merchantBankAccount, //this bank user needs to have the same payto that the exchange is asking from + // this bank user needs to have the same payto that the exchange is asking from + payto_uri: merchantBankAccount, }), ); logger.info("Bank account created"); diff --git a/packages/taler-harness/src/integrationtests/test-kyc-new-measure.ts b/packages/taler-harness/src/integrationtests/test-kyc-new-measure.ts @@ -164,9 +164,12 @@ export async function runKycNewMeasureTest(t: GlobalTestState) { { method: "POST", headers: { - "Content-Type": "application/x-www-form-urlencoded", + "Content-Type": "application/json", + }, + body: { + full_name: "Alice Abc", + birthdate: "2020-01-01", }, - body: "full_name=Alice+Abc&birthdate=2000-01-01", }, ); diff --git a/packages/taler-harness/src/integrationtests/test-kyc-two-forms.ts b/packages/taler-harness/src/integrationtests/test-kyc-two-forms.ts @@ -152,34 +152,6 @@ export async function runKycTwoFormsTest(t: GlobalTestState) { let accessToken: string; let latestFormId: string; - // { - // logger.info("step 1) Withdraw to trigger AML and 2) get access token") - // const wres = await withdrawViaBankV3(t, { - // amount: "TESTKUDOS:20", - // bankClient, - // exchange, - // walletClient, - // }); - - // await walletClient.call(WalletApiOperation.TestingWaitTransactionState, { - // transactionId: wres.transactionId as TransactionIdStr, - // txState: { - // major: TransactionMajorState.Pending, - // minor: TransactionMinorState.KycRequired, - // }, - // }); - - // const txDetails = await walletClient.call( - // WalletApiOperation.GetTransactionById, - // { - // transactionId: wres.transactionId, - // }, - // ); - - // accessToken = txDetails.kycAccessToken; - // kycPaytoHash = txDetails.kycPaytoHash; - // firstTransaction = wres.transactionId; - // } const account = await createNewWalletKycAccount(new Uint8Array()); { logger.info("step 1) Check balance to trigger AML"); @@ -235,23 +207,6 @@ export async function runKycTwoFormsTest(t: GlobalTestState) { accessToken = clientInfo?.access_token; } - // { - // // step 2) Check KYC info - // const infoResp = await harnessHttpLib.fetch( - // new URL(`kyc-info/${accessToken}`, exchange.baseUrl).href, - // ); - - // const clientInfo = await readResponseJsonOrThrow( - // infoResp, - // codecOptional(codecForKycProcessClientInformation()), - // ); - - // console.log(j2s(clientInfo)); - // t.assertDeepEqual(infoResp.status, 200); - // t.assertDeepEqual(clientInfo?.requirements.length, 1); - // t.assertDeepEqual(clientInfo?.requirements[0].form, "firstForm"); - // } - { logger.info("step 3) Check KYC info, should be waiting for the first form"); const infoResp = await harnessHttpLib.fetch( @@ -277,9 +232,9 @@ export async function runKycTwoFormsTest(t: GlobalTestState) { { method: "POST", headers: { - "Content-Type": "application/x-www-form-urlencoded", + "Content-Type": "application/json", }, - body: "NAME=who", + body: { NAME: "who" }, }, ); @@ -319,7 +274,7 @@ export async function runKycTwoFormsTest(t: GlobalTestState) { logger.info( "step 6) Check KYC info again after some time, should see the second form", ); - //doing a second request shouldn't fail + // doing a second request shouldn't fail const infoResp = await harnessHttpLib.fetch( new URL(`kyc-info/${accessToken}?timeout_ms=1000`, exchange.baseUrl).href, );