aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/integrationtests/test-payment-multiple.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-payment-multiple.ts')
-rw-r--r--packages/taler-harness/src/integrationtests/test-payment-multiple.ts48
1 files changed, 30 insertions, 18 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-payment-multiple.ts b/packages/taler-harness/src/integrationtests/test-payment-multiple.ts
index 25e19ae8e..4ef5e3bff 100644
--- a/packages/taler-harness/src/integrationtests/test-payment-multiple.ts
+++ b/packages/taler-harness/src/integrationtests/test-payment-multiple.ts
@@ -17,19 +17,21 @@
/**
* Imports.
*/
+import { MerchantApiClient } from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { coin_ct10, coin_u1 } from "../harness/denomStructures.js";
import {
- GlobalTestState,
- setupDb,
BankService,
ExchangeService,
+ GlobalTestState,
MerchantService,
- WalletCli,
- MerchantPrivateApi,
getPayto,
+ setupDb,
} from "../harness/harness.js";
-import { withdrawViaBank } from "../harness/helpers.js";
-import { coin_ct10, coin_u1 } from "../harness/denomStructures.js";
-import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import {
+ createWalletDaemonWithClient,
+ withdrawViaBankV2,
+} from "../harness/helpers.js";
async function setupTest(t: GlobalTestState): Promise<{
merchant: MerchantService;
@@ -82,13 +84,13 @@ async function setupTest(t: GlobalTestState): Promise<{
await merchant.start();
await merchant.pingUntilAvailable();
- await merchant.addInstance({
+ await merchant.addInstanceWithWireAccount({
id: "default",
name: "Default Instance",
paytoUris: [getPayto("merchant-default")],
});
- await merchant.addInstance({
+ await merchant.addInstanceWithWireAccount({
id: "minst1",
name: "minst1",
paytoUris: [getPayto("minst1")],
@@ -113,15 +115,26 @@ export async function runPaymentMultipleTest(t: GlobalTestState) {
const { merchant, bank, exchange } = await setupTest(t);
- const wallet = new WalletCli(t);
+ const { walletClient } = await createWalletDaemonWithClient(t, {
+ name: "default",
+ });
+
+ const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl());
// Withdraw digital cash into the wallet.
- await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:100" });
+ const wres = await withdrawViaBankV2(t, {
+ walletClient,
+ bank,
+ exchange,
+ amount: "TESTKUDOS:100",
+ });
+
+ await wres.withdrawalFinishedCond;
// Set up order.
- const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", {
+ const orderResp = await merchantClient.createOrder({
order: {
summary: "Buy me!",
amount: "TESTKUDOS:80",
@@ -129,7 +142,7 @@ export async function runPaymentMultipleTest(t: GlobalTestState) {
},
});
- let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, {
+ let orderStatus = await merchantClient.queryPrivateOrderStatus({
orderId: orderResp.order_id,
});
@@ -137,18 +150,17 @@ export async function runPaymentMultipleTest(t: GlobalTestState) {
// Make wallet pay for the order
- const r1 = await wallet.client.call(WalletApiOperation.PreparePayForUri, {
+ const r1 = await walletClient.call(WalletApiOperation.PreparePayForUri, {
talerPayUri: orderStatus.taler_pay_uri,
});
- await wallet.client.call(WalletApiOperation.ConfirmPay, {
- // FIXME: should be validated, don't cast!
- proposalId: r1.proposalId,
+ await walletClient.call(WalletApiOperation.ConfirmPay, {
+ transactionId: r1.transactionId,
});
// Check if payment was successful.
- orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, {
+ orderStatus = await merchantClient.queryPrivateOrderStatus({
orderId: orderResp.order_id,
});