-include more info in refresh tx
This commit is contained in:
parent
bb8bf3cb55
commit
12fc0b3f2a
@ -865,6 +865,7 @@ export enum TransactionStatus {
|
||||
* Additional information about the reason of a refresh.
|
||||
*/
|
||||
export interface RefreshReasonDetails {
|
||||
originatingTransactionId?: string;
|
||||
proposalId?: string;
|
||||
}
|
||||
|
||||
|
@ -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>;
|
||||
}
|
||||
|
||||
|
@ -188,6 +188,9 @@ export async function spendCoins(
|
||||
Amounts.currencyOf(csi.contributions[0]),
|
||||
refreshCoinPubs,
|
||||
RefreshReason.PayMerchant,
|
||||
{
|
||||
originatingTransactionId: csi.allocationId,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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),
|
||||
|
@ -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 ===
|
||||
|
Loading…
Reference in New Issue
Block a user