From d32d2895cedad656d7130522722f40642c439de6 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 24 Aug 2022 11:11:02 +0200 Subject: -get p2p pull integration test to run through --- packages/taler-wallet-core/src/wallet.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'packages/taler-wallet-core/src/wallet.ts') diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 0d5918886..ac81660d2 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -39,6 +39,7 @@ import { codecForAny, codecForApplyRefundFromPurchaseIdRequest, codecForApplyRefundRequest, + codecForCheckPeerPullPaymentRequest, codecForCheckPeerPushPaymentRequest, codecForConfirmPayRequest, codecForCreateDepositGroupRequest, @@ -150,7 +151,9 @@ import { processPurchasePay, } from "./operations/pay.js"; import { + acceptPeerPullPayment, acceptPeerPushPayment, + checkPeerPullPayment, checkPeerPushPayment, initiatePeerRequestForPay, initiatePeerToPeerPush, @@ -728,7 +731,12 @@ async function dispatchRequestInternal( switch (operation) { case "initWallet": { ws.initCalled = true; - await fillDefaults(ws); + if (typeof payload === "object" && (payload as any).skipDefaults) { + logger.info("skipping defaults"); + } else { + logger.info("filling defaults"); + await fillDefaults(ws); + } return {}; } case "withdrawTestkudos": { @@ -1047,6 +1055,15 @@ async function dispatchRequestInternal( const req = codecForInitiatePeerPullPaymentRequest().decode(payload); return await initiatePeerRequestForPay(ws, req); } + case "checkPeerPullPayment": { + const req = codecForCheckPeerPullPaymentRequest().decode(payload); + return await checkPeerPullPayment(ws, req); + } + case "acceptPeerPullPayment": { + const req = codecForAcceptPeerPullPaymentRequest().decode(payload); + await acceptPeerPullPayment(ws, req); + return {}; + } } throw TalerError.fromDetail( TalerErrorCode.WALLET_CORE_API_OPERATION_UNKNOWN, @@ -1239,10 +1256,8 @@ class InternalWalletStateImpl implements InternalWalletState { const key = `${exchangeBaseUrl}:${denomPubHash}`; const cached = this.denomCache[key]; if (cached) { - logger.trace("using cached denom"); return cached; } - logger.trace("looking up denom denom"); const d = await tx.denominations.get([exchangeBaseUrl, denomPubHash]); if (d) { this.denomCache[key] = d; -- cgit v1.2.3