diff options
Diffstat (limited to 'packages/taler-wallet-core/src/operations/testing.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/testing.ts | 28 |
1 files changed, 28 insertions, 0 deletions
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!"); } |