summaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-denom-unoffered.ts')
-rw-r--r--packages/taler-harness/src/integrationtests/test-denom-unoffered.ts32
1 files changed, 21 insertions, 11 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
index 79269d533..8042c0817 100644
--- a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
+++ b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
@@ -21,25 +21,27 @@ import {
MerchantApiClient,
PreparePayResultType,
TalerErrorCode,
+ TalerMerchantApi,
+ TransactionType,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState } from "../harness/harness.js";
import {
- createSimpleTestkudosEnvironmentV2,
- withdrawViaBankV2,
+ createSimpleTestkudosEnvironmentV3,
+ withdrawViaBankV3,
} from "../harness/helpers.js";
export async function runDenomUnofferedTest(t: GlobalTestState) {
// Set up test environment
- const { walletClient, bank, exchange, merchant } =
- await createSimpleTestkudosEnvironmentV2(t);
+ const { walletClient, bankClient, exchange, merchant } =
+ await createSimpleTestkudosEnvironmentV3(t);
// Withdraw digital cash into the wallet.
- const wres = await withdrawViaBankV2(t, {
+ const wres = await withdrawViaBankV3(t, {
walletClient,
- bank,
+ bankClient,
exchange,
amount: "TESTKUDOS:20",
});
@@ -61,7 +63,7 @@ export async function runDenomUnofferedTest(t: GlobalTestState) {
await merchant.start();
await merchant.pingUntilAvailable();
- const order = {
+ const order: TalerMerchantApi.Order = {
summary: "Buy me!",
amount: "TESTKUDOS:5",
fulfillment_url: "taler://fulfillment-success/thx",
@@ -93,7 +95,7 @@ export async function runDenomUnofferedTest(t: GlobalTestState) {
);
const confirmResp = await walletClient.call(WalletApiOperation.ConfirmPay, {
- proposalId: preparePayResult.proposalId,
+ transactionId: preparePayResult.transactionId,
});
const tx = await walletClient.call(WalletApiOperation.GetTransactionById, {
@@ -138,17 +140,25 @@ export async function runDenomUnofferedTest(t: GlobalTestState) {
});
// Now withdrawal should work again.
- await withdrawViaBankV2(t, {
+ await withdrawViaBankV3(t, {
walletClient,
- bank,
+ bankClient,
exchange,
amount: "TESTKUDOS:20",
});
await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
- const txs = await walletClient.call(WalletApiOperation.GetTransactions, {});
+ const txs = await walletClient.call(WalletApiOperation.GetTransactions, {
+ sort: "stable-ascending",
+ includeRefreshes: true,
+ });
console.log(JSON.stringify(txs, undefined, 2));
+
+ t.assertDeepEqual(txs.transactions[0].type, TransactionType.Withdrawal);
+ t.assertDeepEqual(txs.transactions[1].type, TransactionType.Refresh);
+ t.assertDeepEqual(txs.transactions[2].type, TransactionType.DenomLoss);
+ t.assertDeepEqual(txs.transactions[3].type, TransactionType.Withdrawal);
}
runDenomUnofferedTest.suites = ["wallet"];