diff options
author | Florian Dold <florian@dold.me> | 2024-02-07 13:49:05 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-02-07 13:49:05 +0100 |
commit | 56f4b81f9cc1ebf93aaf5b686003530bc9af24e3 (patch) | |
tree | d84963c018bf1b66e6997a015e8b93635165ce5c /packages/taler-harness/src/integrationtests | |
parent | ff13acded0f68c66577eab96afb7f5242197b540 (diff) | |
download | wallet-core-56f4b81f9cc1ebf93aaf5b686003530bc9af24e3.tar.xz |
remove rewards
Some remains are kept to not break old wallets
Diffstat (limited to 'packages/taler-harness/src/integrationtests')
3 files changed, 10 insertions, 202 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts index bd4318498..8ca00359c 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts @@ -216,44 +216,6 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { justification: "why not?", next_url: "https://example.com/after-tip", }); - - const { walletClient: walletClientTipping } = - await createWalletDaemonWithClient(t, { - name: "age-tipping", - }); - - const ptr = await walletClientTipping.call( - WalletApiOperation.PrepareReward, - { - talerRewardUri: tip.taler_reward_uri, - }, - ); - - await walletClientTipping.call(WalletApiOperation.AcceptReward, { - walletRewardId: ptr.walletRewardId, - }); - - await walletClientTipping.call( - WalletApiOperation.TestingWaitTransactionsFinal, - {}, - ); - - const order = { - summary: "Buy me!", - amount: "TESTKUDOS:4", - fulfillment_url: "taler://fulfillment-success/thx", - minimum_age: 9, - }; - - await makeTestPaymentV2(t, { - walletClient: walletClientTipping, - merchant, - order, - }); - await walletClientTipping.call( - WalletApiOperation.TestingWaitTransactionsFinal, - {}, - ); } } diff --git a/packages/taler-harness/src/integrationtests/test-tipping.ts b/packages/taler-harness/src/integrationtests/test-tipping.ts deleted file mode 100644 index 543e7a68b..000000000 --- a/packages/taler-harness/src/integrationtests/test-tipping.ts +++ /dev/null @@ -1,151 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2020 Taler Systems S.A. - - GNU Taler is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - -/** - * Imports. - */ -import { - TalerCorebankApiClient, - MerchantApiClient, - TransactionMajorState, - WireGatewayApiClient, - AmountString, - TransactionIdStr, -} from "@gnu-taler/taler-util"; -import { - WalletApiOperation, -} from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState, getWireMethodForTest } from "../harness/harness.js"; -import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; - -/** - * Run test for basic, bank-integrated withdrawal. - */ -export async function runTippingTest(t: GlobalTestState) { - // Set up test environment - - const { walletClient, bank, exchange, merchant, exchangeBankAccount } = - await createSimpleTestkudosEnvironmentV2(t); - - const bankAccessApiClient = new TalerCorebankApiClient( - bank.corebankApiBaseUrl, - ); - const mbu = await bankAccessApiClient.createRandomBankUser(); - - const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); - - const tipReserveResp = await merchantClient.createTippingReserve({ - exchange_url: exchange.baseUrl, - initial_balance: "TESTKUDOS:10" as AmountString, - wire_method: getWireMethodForTest(), - }); - - console.log("tipReserveResp:", tipReserveResp); - - t.assertDeepEqual( - tipReserveResp.accounts[0].payto_uri, - exchangeBankAccount.accountPaytoUri, - ); - - const wireGatewayApiClient = new WireGatewayApiClient( - exchangeBankAccount.wireGatewayApiBaseUrl, - { - auth: { - username: exchangeBankAccount.accountName, - password: exchangeBankAccount.accountPassword, - }, - }, - ); - - await wireGatewayApiClient.adminAddIncoming({ - amount: "TESTKUDOS:10", - debitAccountPayto: mbu.accountPaytoUri, - reservePub: tipReserveResp.reserve_pub, - }); - - await exchange.runWirewatchOnce(); - - await merchant.stop(); - await merchant.start(); - await merchant.pingUntilAvailable(); - - const r = await merchantClient.queryTippingReserves(); - console.log("tipping reserves:", JSON.stringify(r, undefined, 2)); - - t.assertTrue(r.reserves.length === 1); - t.assertDeepEqual( - r.reserves[0].exchange_initial_amount, - r.reserves[0].merchant_initial_amount, - ); - - const tip = await merchantClient.giveTip({ - amount: "TESTKUDOS:5" as AmountString, - justification: "why not?", - next_url: "https://example.com/after-tip", - }); - - console.log("created tip", tip); - - const doTip = async (): Promise<void> => { - const ptr = await walletClient.call(WalletApiOperation.PrepareReward, { - talerRewardUri: tip.taler_reward_uri, - }); - - console.log(ptr); - - t.assertAmountEquals(ptr.rewardAmountRaw, "TESTKUDOS:5"); - t.assertAmountEquals(ptr.rewardAmountEffective, "TESTKUDOS:4.85"); - - await walletClient.call(WalletApiOperation.AcceptReward, { - transactionId: ptr.transactionId, - }); - - await walletClient.call( - WalletApiOperation.TestingWaitTransactionsFinal, - {}, - ); - - const bal = await walletClient.call(WalletApiOperation.GetBalances, {}); - - console.log(bal); - - t.assertAmountEquals(bal.balances[0].available, "TESTKUDOS:4.85"); - - const txns = await walletClient.call( - WalletApiOperation.GetTransactions, - {}, - ); - - console.log("Transactions:", JSON.stringify(txns, undefined, 2)); - - t.assertDeepEqual(txns.transactions[0].type, "reward"); - t.assertDeepEqual( - txns.transactions[0].txState.major, - TransactionMajorState.Done, - ); - t.assertAmountEquals( - txns.transactions[0].amountEffective, - "TESTKUDOS:4.85", - ); - t.assertAmountEquals(txns.transactions[0].amountRaw, "TESTKUDOS:5.0"); - }; - - // Check twice so make sure tip handling is idempotent - await doTip(); - await doTip(); -} - -runTippingTest.suites = ["wallet", "wallet-tipping"]; diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts b/packages/taler-harness/src/integrationtests/testrunner.ts index 81047e267..624b230d3 100644 --- a/packages/taler-harness/src/integrationtests/testrunner.ts +++ b/packages/taler-harness/src/integrationtests/testrunner.ts @@ -28,12 +28,14 @@ import { shouldLingerInTest, } from "../harness/harness.js"; import { getSharedTestDir } from "../harness/helpers.js"; +import { runAgeRestrictionsDepositTest } from "./test-age-restrictions-deposit.js"; import { runAgeRestrictionsMerchantTest } from "./test-age-restrictions-merchant.js"; import { runAgeRestrictionsMixedMerchantTest } from "./test-age-restrictions-mixed-merchant.js"; import { runAgeRestrictionsPeerTest } from "./test-age-restrictions-peer.js"; import { runBankApiTest } from "./test-bank-api.js"; import { runClaimLoopTest } from "./test-claim-loop.js"; import { runClauseSchnorrTest } from "./test-clause-schnorr.js"; +import { runCurrencyScopeTest } from "./test-currency-scope.js"; import { runDenomUnofferedTest } from "./test-denom-unoffered.js"; import { runDepositTest } from "./test-deposit.js"; import { runExchangeDepositTest } from "./test-exchange-deposit.js"; @@ -43,6 +45,7 @@ import { runExchangeTimetravelTest } from "./test-exchange-timetravel.js"; import { runFeeRegressionTest } from "./test-fee-regression.js"; import { runForcedSelectionTest } from "./test-forced-selection.js"; import { runKycTest } from "./test-kyc.js"; +import { runLibeufinBankTest } from "./test-libeufin-bank.js"; import { runMerchantExchangeConfusionTest } from "./test-merchant-exchange-confusion.js"; import { runMerchantInstancesDeleteTest } from "./test-merchant-instances-delete.js"; import { runMerchantInstancesUrlsTest } from "./test-merchant-instances-urls.js"; @@ -50,9 +53,12 @@ import { runMerchantInstancesTest } from "./test-merchant-instances.js"; import { runMerchantLongpollingTest } from "./test-merchant-longpolling.js"; import { runMerchantRefundApiTest } from "./test-merchant-refund-api.js"; import { runMerchantSpecPublicOrdersTest } from "./test-merchant-spec-public-orders.js"; +import { runMultiExchangeTest } from "./test-multiexchange.js"; +import { runOtpTest } from "./test-otp.js"; import { runPayPaidTest } from "./test-pay-paid.js"; import { runPaymentAbortTest } from "./test-payment-abort.js"; import { runPaymentClaimTest } from "./test-payment-claim.js"; +import { runPaymentDeletedTest } from "./test-payment-deleted.js"; import { runPaymentExpiredTest } from "./test-payment-expired.js"; import { runPaymentFaultTest } from "./test-payment-fault.js"; import { runPaymentForgettableTest } from "./test-payment-forgettable.js"; @@ -76,32 +82,24 @@ import { runSimplePaymentTest } from "./test-simple-payment.js"; import { runStoredBackupsTest } from "./test-stored-backups.js"; import { runTimetravelAutorefreshTest } from "./test-timetravel-autorefresh.js"; import { runTimetravelWithdrawTest } from "./test-timetravel-withdraw.js"; -import { runTippingTest } from "./test-tipping.js"; import { runTermOfServiceFormatTest } from "./test-tos-format.js"; import { runWalletBackupBasicTest } from "./test-wallet-backup-basic.js"; import { runWalletBackupDoublespendTest } from "./test-wallet-backup-doublespend.js"; import { runWalletBalanceTest } from "./test-wallet-balance.js"; import { runWalletCryptoWorkerTest } from "./test-wallet-cryptoworker.js"; import { runWalletDblessTest } from "./test-wallet-dbless.js"; +import { runWalletDd48Test } from "./test-wallet-dd48.js"; +import { runWalletGenDbTest } from "./test-wallet-gendb.js"; import { runWalletNotificationsTest } from "./test-wallet-notifications.js"; +import { runWalletRefreshTest } from "./test-wallet-refresh.js"; import { runWallettestingTest } from "./test-wallettesting.js"; import { runWithdrawalAbortBankTest } from "./test-withdrawal-abort-bank.js"; import { runWithdrawalBankIntegratedTest } from "./test-withdrawal-bank-integrated.js"; +import { runWithdrawalConversionTest } from "./test-withdrawal-conversion.js"; import { runWithdrawalFakebankTest } from "./test-withdrawal-fakebank.js"; import { runWithdrawalFeesTest } from "./test-withdrawal-fees.js"; import { runWithdrawalHugeTest } from "./test-withdrawal-huge.js"; import { runWithdrawalManualTest } from "./test-withdrawal-manual.js"; -import { runWalletGenDbTest } from "./test-wallet-gendb.js"; -import { runLibeufinBankTest } from "./test-libeufin-bank.js"; -import { runCurrencyScopeTest } from "./test-currency-scope.js"; -import { runAgeRestrictionsDepositTest } from "./test-age-restrictions-deposit.js"; -import { runWithdrawalConversionTest } from "./test-withdrawal-conversion.js"; -import { runPaymentDeletedTest } from "./test-payment-deleted.js"; -import { runWithdrawalNotifyBeforeTxTest } from "./test-withdrawal-notify-before-tx.js"; -import { runWalletDd48Test } from "./test-wallet-dd48.js"; -import { runMultiExchangeTest } from "./test-multiexchange.js"; -import { runWalletRefreshTest } from "./test-wallet-refresh.js"; -import { runOtpTest } from "./test-otp.js"; /** * Test runner. @@ -169,7 +167,6 @@ const allTests: TestMainFunction[] = [ runWithdrawalManualTest, runTimetravelAutorefreshTest, runTimetravelWithdrawTest, - runTippingTest, runWalletBackupBasicTest, runWalletBackupDoublespendTest, runWalletNotificationsTest, |