From 609919027c85ac4bf33a176a51b013db85450d7e Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 29 Jan 2024 22:58:15 +0100 Subject: wallet-core: also create deposit in runIntegrationTestV2 --- .../taler-wallet-core/src/operations/deposits.ts | 1 + .../taler-wallet-core/src/operations/testing.ts | 28 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts index 4a6791922..3619ac4f4 100644 --- a/packages/taler-wallet-core/src/operations/deposits.ts +++ b/packages/taler-wallet-core/src/operations/deposits.ts @@ -949,6 +949,7 @@ async function processDepositGroupPendingDeposit( cancellationToken?.throwIfCancelled(); const url = new URL(`batch-deposit`, exchangeUrl); logger.info(`depositing to ${url}`); + logger.trace(`deposit request: ${j2s(batchReq)}`); const httpResp = await ws.http.fetch(url.href, { method: "POST", body: batchReq, diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts index 92ce504fe..4c2cfae2c 100644 --- a/packages/taler-wallet-core/src/operations/testing.ts +++ b/packages/taler-wallet-core/src/operations/testing.ts @@ -25,6 +25,7 @@ */ import { AbsoluteTime, + addPaytoQueryParams, Amounts, AmountString, CheckPaymentResponse, @@ -37,6 +38,7 @@ import { j2s, Logger, NotificationType, + parsePaytoUri, PreparePayResultType, TalerCorebankApiClient, TestPayArgs, @@ -79,6 +81,7 @@ import { initiatePeerPushDebit } from "./pay-peer-push-debit.js"; import { getPendingOperations } from "./pending.js"; import { getTransactionById, getTransactions } from "./transactions.js"; import { acceptWithdrawalFromUri } from "./withdraw.js"; +import { createDepositGroup } from "./deposits.js"; const logger = new Logger("operations/testing.ts"); @@ -92,6 +95,11 @@ export interface WithdrawTestBalanceResult { * Transaction ID of the newly created withdrawal transaction. */ transactionId: string; + + /** + * Account of the user registered for the withdrawal. + */ + accountPaytoUri: string; } export async function withdrawTestBalance( @@ -130,6 +138,7 @@ export async function withdrawTestBalance( return { transactionId: acceptResp.transactionId, + accountPaytoUri: bankUser.accountPaytoUri, }; } @@ -876,6 +885,25 @@ export async function runIntegrationTest2( peerPushInit.transactionId, ); + let depositPayto = withdrawalRes.accountPaytoUri; + + const parsedPayto = parsePaytoUri(depositPayto); + if (!parsedPayto) { + throw Error("invalid payto"); + } + + // Work around libeufin-bank bug where receiver-name is missing + if (!parsedPayto.params["receiver-name"]) { + depositPayto = addPaytoQueryParams(depositPayto, { + "receiver-name": "Test", + }); + } + + await createDepositGroup(ws, { + amount: `${currency}:5` as AmountString, + depositPaytoUri: depositPayto, + }); + logger.trace("integration test: all done!"); } -- cgit v1.2.3