diff options
author | Florian Dold <florian@dold.me> | 2023-02-21 21:02:36 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-02-21 21:02:36 +0100 |
commit | b648238c4120ed341c76818b4ffa223d0122af78 (patch) | |
tree | dff1c75182170cfeed76c8d926e919470f2c9d71 /packages/taler-wallet-core/src/operations/transactions.ts | |
parent | a3c7da975b6375f8c57154875642fb29a67e8731 (diff) | |
download | wallet-core-b648238c4120ed341c76818b4ffa223d0122af78.tar.xz |
harness: improve peer-pull integration test, check notificationsv0.9.3-dev.2
Diffstat (limited to 'packages/taler-wallet-core/src/operations/transactions.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/transactions.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index 1c2ce34bb..764115cef 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -64,6 +64,7 @@ import { } from "../db.js"; import { InternalWalletState } from "../internal-wallet-state.js"; import { PendingTaskType } from "../pending-types.js"; +import { assertUnreachable } from "../util/assertUnreachable.js"; import { checkDbInvariant } from "../util/invariants.js"; import { constructTaskIdentifier, TaskIdentifiers } from "../util/retries.js"; import { @@ -1376,6 +1377,35 @@ export type ParsedTransactionIdentifier = | { tag: TransactionType.Tip; walletTipId: string } | { tag: TransactionType.Withdrawal; withdrawalGroupId: string }; +export function constructTransactionIdentifier( + pTxId: ParsedTransactionIdentifier, +): string { + switch (pTxId.tag) { + case TransactionType.Deposit: + return `txn:${pTxId.tag}:${pTxId.depositGroupId}`; + case TransactionType.Payment: + return `txn:${pTxId.tag}:${pTxId.proposalId}`; + case TransactionType.PeerPullCredit: + return `txn:${pTxId.tag}:${pTxId.pursePub}`; + case TransactionType.PeerPullDebit: + return `txn:${pTxId.tag}:${pTxId.peerPullPaymentIncomingId}`; + case TransactionType.PeerPushCredit: + return `txn:${pTxId.tag}:${pTxId.peerPushPaymentIncomingId}`; + case TransactionType.PeerPushDebit: + return `txn:${pTxId.tag}:${pTxId.pursePub}`; + case TransactionType.Refresh: + return `txn:${pTxId.tag}:${pTxId.refreshGroupId}`; + case TransactionType.Refund: + return `txn:${pTxId.tag}:${pTxId.proposalId}:${pTxId.executionTime}`; + case TransactionType.Tip: + return `txn:${pTxId.tag}:${pTxId.walletTipId}`; + case TransactionType.Withdrawal: + return `txn:${pTxId.tag}:${pTxId.withdrawalGroupId}`; + default: + assertUnreachable(pTxId); + } +} + /** * Parse a transaction identifier string into a typed, structured representation. */ |