aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-core/src/db.ts1
-rw-r--r--packages/taler-wallet-core/src/internal-wallet-state.ts8
-rw-r--r--packages/taler-wallet-core/src/operations/common.ts3
-rw-r--r--packages/taler-wallet-core/src/operations/refresh.ts3
-rw-r--r--packages/taler-wallet-core/src/operations/transactions.ts7
5 files changed, 20 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 8aff18c6d..8bb8d519f 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -865,6 +865,7 @@ export enum TransactionStatus {
* Additional information about the reason of a refresh.
*/
export interface RefreshReasonDetails {
+ originatingTransactionId?: string;
proposalId?: string;
}
diff --git a/packages/taler-wallet-core/src/internal-wallet-state.ts b/packages/taler-wallet-core/src/internal-wallet-state.ts
index 879d18a48..d180861f8 100644
--- a/packages/taler-wallet-core/src/internal-wallet-state.ts
+++ b/packages/taler-wallet-core/src/internal-wallet-state.ts
@@ -43,7 +43,12 @@ import {
} from "@gnu-taler/taler-util";
import { CryptoDispatcher } from "./crypto/workers/crypto-dispatcher.js";
import { TalerCryptoInterface } from "./crypto/cryptoImplementation.js";
-import { ExchangeDetailsRecord, ExchangeRecord, WalletStoresV1 } from "./db.js";
+import {
+ ExchangeDetailsRecord,
+ ExchangeRecord,
+ RefreshReasonDetails,
+ WalletStoresV1,
+} from "./db.js";
import { PendingOperationsResponse } from "./pending-types.js";
import { AsyncOpMemoMap, AsyncOpMemoSingle } from "./util/asyncMemo.js";
import { HttpRequestLibrary } from "./util/http.js";
@@ -89,6 +94,7 @@ export interface RefreshOperations {
currency: string,
oldCoinPubs: CoinRefreshRequest[],
reason: RefreshReason,
+ reasonDetails?: RefreshReasonDetails,
): Promise<RefreshGroupId>;
}
diff --git a/packages/taler-wallet-core/src/operations/common.ts b/packages/taler-wallet-core/src/operations/common.ts
index 31c1bebb2..3ea02012b 100644
--- a/packages/taler-wallet-core/src/operations/common.ts
+++ b/packages/taler-wallet-core/src/operations/common.ts
@@ -188,6 +188,9 @@ export async function spendCoins(
Amounts.currencyOf(csi.contributions[0]),
refreshCoinPubs,
RefreshReason.PayMerchant,
+ {
+ originatingTransactionId: csi.allocationId,
+ },
);
}
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts
index 638dec8a6..5b7bf8d83 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -60,6 +60,7 @@ import {
RefreshCoinStatus,
RefreshGroupRecord,
RefreshOperationStatus,
+ RefreshReasonDetails,
WalletStoresV1,
} from "../db.js";
import { TalerError } from "../errors.js";
@@ -853,6 +854,7 @@ export async function createRefreshGroup(
currency: string,
oldCoinPubs: CoinRefreshRequest[],
reason: RefreshReason,
+ reasonDetails?: RefreshReasonDetails,
): Promise<RefreshGroupId> {
const refreshGroupId = encodeCrock(getRandomBytes(32));
@@ -940,6 +942,7 @@ export async function createRefreshGroup(
statusPerCoin: oldCoinPubs.map(() => RefreshCoinStatus.Pending),
oldCoinPubs: oldCoinPubs.map((x) => x.coinPub),
lastErrorPerCoin: {},
+ reasonDetails,
reason,
refreshGroupId,
refreshSessionPerCoin: oldCoinPubs.map(() => undefined),
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts
index 12037fe0e..5b6b5adc3 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -600,7 +600,10 @@ function buildTransactionForRefresh(
refreshGroupRecord.currency,
refreshGroupRecord.inputPerCoin,
).amount;
- const outputAmount = Amounts.sumOrZero(refreshGroupRecord.currency, refreshGroupRecord.estimatedOutputPerCoin).amount;
+ const outputAmount = Amounts.sumOrZero(
+ refreshGroupRecord.currency,
+ refreshGroupRecord.estimatedOutputPerCoin,
+ ).amount;
return {
type: TransactionType.Refresh,
refreshReason: refreshGroupRecord.reason,
@@ -612,6 +615,8 @@ function buildTransactionForRefresh(
),
refreshInputAmount: Amounts.stringify(inputAmount),
refreshOutputAmount: Amounts.stringify(outputAmount),
+ originatingTransactionId:
+ refreshGroupRecord.reasonDetails?.originatingTransactionId,
extendedStatus:
refreshGroupRecord.operationStatus === RefreshOperationStatus.Finished ||
refreshGroupRecord.operationStatus ===