diff options
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r-- | packages/taler-wallet-core/src/operations/pay-peer.ts | 17 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/transactions.ts | 30 |
2 files changed, 43 insertions, 4 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-peer.ts b/packages/taler-wallet-core/src/operations/pay-peer.ts index 8bde47df4..541e96280 100644 --- a/packages/taler-wallet-core/src/operations/pay-peer.ts +++ b/packages/taler-wallet-core/src/operations/pay-peer.ts @@ -72,6 +72,7 @@ import { codecOptional, codecForTimestamp, CancellationToken, + NotificationType, } from "@gnu-taler/taler-util"; import { SpendCoinDetails } from "../crypto/cryptoImplementation.js"; import { @@ -119,7 +120,10 @@ import { processWithdrawalGroup, } from "./withdraw.js"; import { PendingTaskType } from "../pending-types.js"; -import { stopLongpolling } from "./transactions.js"; +import { + constructTransactionIdentifier, + stopLongpolling, +} from "./transactions.js"; const logger = new Logger("operations/peer-to-peer.ts"); @@ -1507,6 +1511,14 @@ export async function processPeerPullCredit( await tx.peerPullPaymentInitiations.put(pi2); }); + ws.notify({ + type: NotificationType.PeerPullCreditReady, + transactionId: constructTransactionIdentifier({ + tag: TransactionType.PeerPullCredit, + pursePub: pullIni.pursePub, + }), + }); + return { type: OperationAttemptResultType.Finished, result: undefined, @@ -1626,9 +1638,6 @@ export async function initiatePeerPullPayment( const pursePair = await ws.cryptoApi.createEddsaKeypair({}); const mergePair = await ws.cryptoApi.createEddsaKeypair({}); - const instructedAmount = Amounts.parseOrThrow( - req.partialContractTerms.amount, - ); const contractTerms = req.partialContractTerms; const hContractTerms = ContractTermsUtil.hashContractTerms(contractTerms); 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. */ |