taler-typescript-core

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

commit b3194005f98f16f7c22b1f013b61daffd78c6b39
parent a67c46f36cb60fcd175273db39a38cd93cfa89e2
Author: Florian Dold <florian@dold.me>
Date:   Thu, 16 Nov 2023 13:47:21 +0100

-remove remaining usage of deprecated field

Diffstat:
Mpackages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts | 17++++++++++-------
Mpackages/taler-harness/src/integrationtests/test-peer-repair.ts | 13+++++++------
Mpackages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts | 18+++++++++++-------
Mpackages/taler-wallet-core/src/operations/testing.ts | 14+++++++++++++-
4 files changed, 41 insertions(+), 21 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts @@ -25,7 +25,7 @@ import { TalerUriAction, TransactionMajorState, TransactionMinorState, - stringifyTalerUri, + TransactionType, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; @@ -101,16 +101,19 @@ export async function runAgeRestrictionsPeerTest(t: GlobalTestState) { await peerPushReadyCond; - const talerUri = stringifyTalerUri({ - type: TalerUriAction.PayPush, - exchangeBaseUrl: initResp.exchangeBaseUrl, - contractPriv: initResp.contractPriv, - }) + const txDetails = await wallet1.call( + WalletApiOperation.GetTransactionById, + { + transactionId: initResp.transactionId, + }, + ); + t.assertDeepEqual(txDetails.type, TransactionType.PeerPushDebit); + t.assertTrue(!!txDetails.talerUri); const checkResp = await wallet2.call( WalletApiOperation.PreparePeerPushCredit, { - talerUri, + talerUri: txDetails.talerUri, }, ); diff --git a/packages/taler-harness/src/integrationtests/test-peer-repair.ts b/packages/taler-harness/src/integrationtests/test-peer-repair.ts @@ -25,6 +25,7 @@ import { TalerUriAction, TransactionMajorState, TransactionMinorState, + TransactionType, WalletNotification, stringifyTalerUri, } from "@gnu-taler/taler-util"; @@ -111,16 +112,16 @@ export async function runPeerRepairTest(t: GlobalTestState) { await peerPushDebitReady1Cond; - const talerUri = stringifyTalerUri({ - type: TalerUriAction.PayPush, - exchangeBaseUrl: resp1.exchangeBaseUrl, - contractPriv: resp1.contractPriv, - }) + const txDetails = await wallet1.call(WalletApiOperation.GetTransactionById, { + transactionId: resp1.transactionId, + }); + t.assertDeepEqual(txDetails.type, TransactionType.PeerPushDebit); + t.assertTrue(!!txDetails.talerUri); const resp2 = await wallet2.client.call( WalletApiOperation.PreparePeerPushCredit, { - talerUri, + talerUri: txDetails.talerUri, }, ); diff --git a/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts b/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts @@ -25,6 +25,7 @@ import { TalerUriAction, TransactionMajorState, TransactionMinorState, + TransactionType, WalletNotification, j2s, stringifyTalerUri, @@ -117,16 +118,19 @@ export async function runPeerToPeerPushTest(t: GlobalTestState) { await peerPushReadyCond; - const talerUri = stringifyTalerUri({ - type: TalerUriAction.PayPush, - exchangeBaseUrl: resp.exchangeBaseUrl, - contractPriv: resp.contractPriv, - }) + const txDetails = await w1.walletClient.call( + WalletApiOperation.GetTransactionById, + { + transactionId: resp.transactionId, + }, + ); + t.assertDeepEqual(txDetails.type, TransactionType.PeerPushDebit); + t.assertTrue(!!txDetails.talerUri); -const checkResp = await w2.walletClient.call( + const checkResp = await w2.walletClient.call( WalletApiOperation.PreparePeerPushCredit, { - talerUri, + talerUri: txDetails.talerUri, }, ); diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts @@ -686,8 +686,20 @@ export async function runIntegrationTest2( contractPriv: peerPushInit.contractPriv, }) + const txDetails = await getTransactionById(ws, { + transactionId: peerPushInit.transactionId, + }); + + if (txDetails.type !== TransactionType.PeerPushDebit) { + throw Error("internal invariant failed"); + } + + if (!txDetails.talerUri) { + throw Error("internal invariant failed"); + } + const peerPushCredit = await preparePeerPushCredit(ws, { - talerUri, + talerUri: txDetails.talerUri, }); await confirmPeerPushCredit(ws, {