diff options
author | Sebastian <sebasjm@gmail.com> | 2024-03-04 14:37:04 -0300 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-03-05 00:16:07 +0100 |
commit | 8a111862400915627227fa432fab017833ec93a7 (patch) | |
tree | d58f516034fbac3fea82dcec065844c2b9607c6d | |
parent | 3b8124b971cfed81a7976cd9c52b4d2b0e9a8482 (diff) | |
download | wallet-core-8a111862400915627227fa432fab017833ec93a7.tar.gz wallet-core-8a111862400915627227fa432fab017833ec93a7.tar.bz2 wallet-core-8a111862400915627227fa432fab017833ec93a7.zip |
assert that the order is paid in the first wallet after the other wallet has paid
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-payment-share.ts | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-payment-share.ts b/packages/taler-harness/src/integrationtests/test-payment-share.ts index d832a7e50..ec7391586 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-share.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-share.ts @@ -20,6 +20,7 @@ import { ConfirmPayResultType, MerchantApiClient, + NotificationType, PreparePayResultType, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; @@ -166,6 +167,11 @@ export async function runPaymentShareTest(t: GlobalTestState) { t.assertAmountEquals(second.balances[0].available, "TESTKUDOS:14.23"); } + t.logStep("wait-for-payment"); + firstWallet.waitForNotificationCond(n => + n.type === NotificationType.TransactionStateTransition && + n.transactionId === claimFirstWallet.transactionId + ) // Claim the order with the first wallet const claimFirstWalletAgain = await firstWallet.call( WalletApiOperation.PreparePayForUri, @@ -175,6 +181,7 @@ export async function runPaymentShareTest(t: GlobalTestState) { t.assertTrue( claimFirstWalletAgain.status === PreparePayResultType.AlreadyConfirmed, ); + t.assertTrue( claimFirstWalletAgain.paid ); t.logStep("w1-prepared-again"); @@ -182,7 +189,7 @@ export async function runPaymentShareTest(t: GlobalTestState) { transactionId: claimFirstWallet.transactionId, }); - t.assertTrue(r1.type === ConfirmPayResultType.Done); + t.assertTrue(r1.type === ConfirmPayResultType.Pending); t.logStep("w1-confirmed-shared"); @@ -255,6 +262,12 @@ export async function runPaymentShareTest(t: GlobalTestState) { t.assertAmountEquals(bal1.balances[0].available, "TESTKUDOS:16.18"); t.assertAmountEquals(bal2.balances[0].available, "TESTKUDOS:14.23"); + t.logStep("wait-for-payment"); + secondWallet.waitForNotificationCond(n => + n.type === NotificationType.TransactionStateTransition && + n.transactionId === claimSecondWallet.transactionId + ) + // Claim the order with the first wallet const claimSecondWalletAgain = await secondWallet.call( WalletApiOperation.PreparePayForUri, @@ -264,6 +277,10 @@ export async function runPaymentShareTest(t: GlobalTestState) { t.assertTrue( claimSecondWalletAgain.status === PreparePayResultType.AlreadyConfirmed, ); + t.assertTrue( + claimSecondWalletAgain.paid, + ); + } t.logStep("second-case-done"); |