diff options
author | Florian Dold <florian@dold.me> | 2023-06-20 11:40:06 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-06-20 11:40:06 +0200 |
commit | 9c708251f92e6691ebba80fa8d129c6c04cec618 (patch) | |
tree | edf46c7b3f9386697a4ea697c2d66f66323a6d3e /packages/taler-harness/src/integrationtests | |
parent | 54f0c82999833132baf83995526025ac56d6fe06 (diff) | |
download | wallet-core-9c708251f92e6691ebba80fa8d129c6c04cec618.tar.xz |
wallet-core: emit DD37 self-transition notifications with errors
Diffstat (limited to 'packages/taler-harness/src/integrationtests')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts index c98c18db5..d0515d64f 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts @@ -24,7 +24,14 @@ import { BankApi, BankAccessApi, } from "@gnu-taler/taler-wallet-core"; -import { j2s, NotificationType, TransactionType, WithdrawalType } from "@gnu-taler/taler-util"; +import { + j2s, + NotificationType, + TransactionMajorState, + TransactionMinorState, + TransactionType, + WithdrawalType, +} from "@gnu-taler/taler-util"; /** * Run test for basic, bank-integrated withdrawal. @@ -55,9 +62,22 @@ export async function runWithdrawalBankIntegratedTest(t: GlobalTestState) { // Withdraw + const r2 = await walletClient.client.call( + WalletApiOperation.AcceptBankIntegratedWithdrawal, + { + exchangeBaseUrl: exchange.baseUrl, + talerWithdrawUri: wop.taler_withdraw_uri, + }, + ); + const withdrawalBankConfirmedCond = walletClient.waitForNotificationCond( (x) => { - return x.type === NotificationType.WithdrawalGroupBankConfirmed; + return ( + x.type === NotificationType.TransactionStateTransition && + x.transactionId === r2.transactionId && + x.newTxState.major === TransactionMajorState.Pending && + x.newTxState.minor === TransactionMinorState.ExchangeWaitReserve + ); }, ); @@ -67,15 +87,12 @@ export async function runWithdrawalBankIntegratedTest(t: GlobalTestState) { const withdrawalReserveReadyCond = walletClient.waitForNotificationCond( (x) => { - return x.type === NotificationType.WithdrawalGroupReserveReady; - }, - ); - - const r2 = await walletClient.client.call( - WalletApiOperation.AcceptBankIntegratedWithdrawal, - { - exchangeBaseUrl: exchange.baseUrl, - talerWithdrawUri: wop.taler_withdraw_uri, + return ( + x.type === NotificationType.TransactionStateTransition && + x.transactionId === r2.transactionId && + x.newTxState.major === TransactionMajorState.Pending && + x.newTxState.minor === TransactionMinorState.WithdrawCoins + ); }, ); @@ -99,7 +116,9 @@ export async function runWithdrawalBankIntegratedTest(t: GlobalTestState) { console.log("transactions before confirmation:", j2s(txn)); const tx0 = txn.transactions[0]; t.assertTrue(tx0.type === TransactionType.Withdrawal); - t.assertTrue(tx0.withdrawalDetails.type === WithdrawalType.TalerBankIntegrationApi); + t.assertTrue( + tx0.withdrawalDetails.type === WithdrawalType.TalerBankIntegrationApi, + ); t.assertTrue(tx0.withdrawalDetails.confirmed === false); t.assertTrue(tx0.withdrawalDetails.reserveIsReady === false); } @@ -120,7 +139,9 @@ export async function runWithdrawalBankIntegratedTest(t: GlobalTestState) { console.log("transactions after confirmation:", j2s(txn)); const tx0 = txn.transactions[0]; t.assertTrue(tx0.type === TransactionType.Withdrawal); - t.assertTrue(tx0.withdrawalDetails.type === WithdrawalType.TalerBankIntegrationApi); + t.assertTrue( + tx0.withdrawalDetails.type === WithdrawalType.TalerBankIntegrationApi, + ); t.assertTrue(tx0.withdrawalDetails.confirmed === true); t.assertTrue(tx0.withdrawalDetails.reserveIsReady === false); } @@ -138,7 +159,9 @@ export async function runWithdrawalBankIntegratedTest(t: GlobalTestState) { console.log("transactions after reserve ready:", j2s(txn)); const tx0 = txn.transactions[0]; t.assertTrue(tx0.type === TransactionType.Withdrawal); - t.assertTrue(tx0.withdrawalDetails.type === WithdrawalType.TalerBankIntegrationApi); + t.assertTrue( + tx0.withdrawalDetails.type === WithdrawalType.TalerBankIntegrationApi, + ); t.assertTrue(tx0.withdrawalDetails.confirmed === true); t.assertTrue(tx0.withdrawalDetails.reserveIsReady === true); } |