diff options
author | Florian Dold <florian@dold.me> | 2023-11-09 13:32:08 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-11-09 14:54:27 +0100 |
commit | 7e3d6938bf5184b88ab4d0b75e4dc3d10af7c60a (patch) | |
tree | 788fc3b96d0aece0810c0654f9e0162eb9c1fe67 /packages/taler-wallet-core/src/operations/testing.ts | |
parent | 1024665001060b8a33378ff45f12426a1b152f25 (diff) | |
download | wallet-core-7e3d6938bf5184b88ab4d0b75e4dc3d10af7c60a.tar.gz wallet-core-7e3d6938bf5184b88ab4d0b75e4dc3d10af7c60a.tar.bz2 wallet-core-7e3d6938bf5184b88ab4d0b75e4dc3d10af7c60a.zip |
wallet-core: fix bogus timestamp logic
Diffstat (limited to 'packages/taler-wallet-core/src/operations/testing.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/testing.ts | 60 |
1 files changed, 23 insertions, 37 deletions
diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts index 3fff9ccaa..62766556c 100644 --- a/packages/taler-wallet-core/src/operations/testing.ts +++ b/packages/taler-wallet-core/src/operations/testing.ts @@ -15,66 +15,66 @@ */ /** + * @file + * Implementation of wallet-core operations that are used for testing, + * but typically not in the production wallet. + */ + +/** * Imports. */ import { AbsoluteTime, - base64FromArrayBuffer, + Amounts, + AmountString, + CheckPaymentResponse, + codecForAny, + codecForCheckPaymentResponse, ConfirmPayResultType, Duration, + IntegrationTestArgs, IntegrationTestV2Args, j2s, Logger, NotificationType, - RegisterAccountRequest, - stringToBytes, + PreparePayResultType, TalerCorebankApiClient, + TestPayArgs, TestPayResult, TransactionMajorState, TransactionMinorState, TransactionState, TransactionType, + URL, WithdrawTestBalanceRequest, } from "@gnu-taler/taler-util"; import { HttpRequestLibrary, readSuccessResponseJsonOrThrow, - checkSuccessResponseOrThrow, } from "@gnu-taler/taler-util/http"; -import { - AmountString, - codecForAny, - CheckPaymentResponse, - codecForCheckPaymentResponse, - IntegrationTestArgs, - Amounts, - TestPayArgs, - URL, - PreparePayResultType, -} from "@gnu-taler/taler-util"; +import { OpenedPromise, openPromise } from "../index.js"; import { InternalWalletState } from "../internal-wallet-state.js"; +import { checkLogicInvariant } from "../util/invariants.js"; +import { getBalances } from "./balance.js"; +import { updateExchangeFromUrl } from "./exchanges.js"; import { confirmPay, preparePayForUri, startRefundQueryForUri, } from "./pay-merchant.js"; -import { getBalances } from "./balance.js"; -import { checkLogicInvariant } from "../util/invariants.js"; -import { acceptWithdrawalFromUri } from "./withdraw.js"; -import { updateExchangeFromUrl } from "./exchanges.js"; import { initiatePeerPullPayment } from "./pay-peer-pull-credit.js"; import { - preparePeerPullDebit, confirmPeerPullDebit, + preparePeerPullDebit, } from "./pay-peer-pull-debit.js"; import { - preparePeerPushCredit, confirmPeerPushCredit, + preparePeerPushCredit, } from "./pay-peer-push-credit.js"; import { initiatePeerPushDebit } from "./pay-peer-push-debit.js"; -import { OpenedPromise, openPromise } from "../index.js"; -import { getTransactionById, getTransactions } from "./transactions.js"; import { getPendingOperations } from "./pending.js"; +import { getTransactionById, getTransactions } from "./transactions.js"; +import { acceptWithdrawalFromUri } from "./withdraw.js"; const logger = new Logger("operations/testing.ts"); @@ -83,20 +83,6 @@ interface MerchantBackendInfo { authToken?: string; } -/** - * Generate a random alphanumeric ID. Does *not* use cryptographically - * secure randomness. - */ -function makeId(length: number): string { - let result = ""; - const characters = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - for (let i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * characters.length)); - } - return result; -} - export async function withdrawTestBalance( ws: InternalWalletState, req: WithdrawTestBalanceRequest, |