diff options
author | Sebastian <sebasjm@gmail.com> | 2023-12-10 19:03:20 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-12-10 19:03:20 -0300 |
commit | ed05a19bb477f331f3b0933cd1daf7b3eed4bce2 (patch) | |
tree | fcfd11554c48bf23024da18b258a09daa559331d /packages/taler-harness | |
parent | 22c5b472b839f48a045270961c748b8bcef3355f (diff) | |
download | wallet-core-ed05a19bb477f331f3b0933cd1daf7b3eed4bce2.tar.xz |
fix: remove refundAmountAwaiting when refund is accepted
Diffstat (limited to 'packages/taler-harness')
-rw-r--r-- | packages/taler-harness/src/harness/harness.ts | 26 | ||||
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-refund.ts | 20 |
2 files changed, 29 insertions, 17 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index 242bf2207..a6ed59032 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -371,7 +371,7 @@ export class GlobalTestState { }); proc.on("exit", (code, signal) => { if (code == 0 && signal == null) { - logger.info(`process ${logName} exited with success`); + logger.trace(`process ${logName} exited with success`); } else { logger.warn(`process ${logName} exited ${j2s({ code, signal })}`); } @@ -582,7 +582,7 @@ class BankServiceBase { protected globalTestState: GlobalTestState, protected bankConfig: BankConfig, protected configFile: string, - ) {} + ) { } } export interface HarnessExchangeBankAccount { @@ -602,8 +602,7 @@ export interface HarnessExchangeBankAccount { */ export class FakebankService extends BankServiceBase - implements BankServiceHandle -{ + implements BankServiceHandle { proc: ProcessWrapper | undefined; http = createPlatformHttpLib({ enableThrottling: false }); @@ -733,8 +732,7 @@ export class FakebankService */ export class LibeufinBankService extends BankServiceBase - implements BankServiceHandle -{ + implements BankServiceHandle { proc: ProcessWrapper | undefined; http = createPlatformHttpLib({ enableThrottling: false }); @@ -1186,7 +1184,7 @@ export class ExchangeService implements ExchangeServiceInterface { private exchangeConfig: ExchangeConfig, private configFilename: string, private keyPair: EddsaKeyPair, - ) {} + ) { } get name() { return this.exchangeConfig.name; @@ -1542,7 +1540,7 @@ export class MerchantService implements MerchantServiceInterface { private globalState: GlobalTestState, private merchantConfig: MerchantConfig, private configFilename: string, - ) {} + ) { } private currentTimetravelOffsetMs: number | undefined; @@ -1880,7 +1878,7 @@ export class WalletService { constructor( private globalState: GlobalTestState, private opts: WalletServiceOptions, - ) {} + ) { } get socketPath() { const unixPath = path.join( @@ -1989,7 +1987,7 @@ export class WalletClient { return client.call(operation, payload); } - constructor(private args: WalletClientArgs) {} + constructor(private args: WalletClientArgs) { } async connect(): Promise<void> { const waiter = this.waiter; @@ -2056,11 +2054,9 @@ export class WalletCli { ? `--crypto-worker=${cliOpts.cryptoWorkerType}` : ""; const logName = `wallet-${self.name}`; - const command = `taler-wallet-cli ${ - self.timetravelArg ?? "" - } ${cryptoWorkerArg} --no-throttle -LTRACE --skip-defaults --wallet-db '${ - self.dbfile - }' api '${op}' ${shellWrap(JSON.stringify(payload))}`; + const command = `taler-wallet-cli ${self.timetravelArg ?? "" + } ${cryptoWorkerArg} --no-throttle -LTRACE --skip-defaults --wallet-db '${self.dbfile + }' api '${op}' ${shellWrap(JSON.stringify(payload))}`; const resp = await sh(self.globalTestState, logName, command); logger.info("--- wallet core response ---"); logger.info(resp); diff --git a/packages/taler-harness/src/integrationtests/test-refund.ts b/packages/taler-harness/src/integrationtests/test-refund.ts index aeeb91f38..0d95ea035 100644 --- a/packages/taler-harness/src/integrationtests/test-refund.ts +++ b/packages/taler-harness/src/integrationtests/test-refund.ts @@ -23,6 +23,7 @@ import { MerchantApiClient, NotificationType, TransactionMajorState, + TransactionType, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; @@ -58,7 +59,6 @@ export async function runRefundTest(t: GlobalTestState) { await withdrawalRes.withdrawalFinishedCond; // Set up order. - const orderResp = await merchantClient.createOrder({ order: { summary: "Buy me!", @@ -94,6 +94,15 @@ export async function runRefundTest(t: GlobalTestState) { t.assertTrue(orderStatus.order_status === "paid"); + + { + const tx = await wallet.client.call(WalletApiOperation.GetTransactionById, { + transactionId: r1.transactionId, + }); + + t.assertTrue(tx.type === TransactionType.Payment && tx.refundPending === undefined) + } + const ref = await merchantClient.giveRefund({ amount: "TESTKUDOS:5", instance: "default", @@ -113,7 +122,6 @@ export async function runRefundTest(t: GlobalTestState) { const r = await wallet.client.call(WalletApiOperation.StartRefundQuery, { transactionId: r1.transactionId, }); - console.log(r); await refundFinishedCond; } @@ -127,6 +135,14 @@ export async function runRefundTest(t: GlobalTestState) { console.log(JSON.stringify(r2, undefined, 2)); } + { + const tx = await wallet.client.call(WalletApiOperation.GetTransactionById, { + transactionId: r1.transactionId, + }); + + t.assertTrue(tx.type === TransactionType.Payment && tx.refundPending === undefined) + } + // FIXME: Test is incomplete without this! // { // const refundQueriedCond = wallet.waitForNotificationCond( |