taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 906f92bbbc2f6d3e8f8d54d5a4a80a7ec4c91919
parent cc78da1ddfd8148d9be314dc7038a887c8974c5f
Author: Florian Dold <florian@dold.me>
Date:   Thu, 13 Nov 2025 12:57:09 +0100

default_wire_transfer_rounding_interval is optional for older proto versions

Diffstat:
Mpackages/taler-util/src/types-taler-merchant.ts | 10++++------
Mpackages/taler-wallet-core/src/common.ts | 14++++++++------
Mpackages/taler-wallet-core/src/pay-merchant.ts | 3+++
Mpackages/taler-wallet-core/src/query.ts | 2+-
4 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/packages/taler-util/src/types-taler-merchant.ts b/packages/taler-util/src/types-taler-merchant.ts @@ -30,9 +30,7 @@ import { import { AccessToken, AccountLimit, - BlindedDonationReceiptKeyPair, DenomKeyType, - DonationRequestData, ExchangeWireAccount, ObjectCodec, PaytoString, @@ -1289,7 +1287,7 @@ export interface MerchantVersionResponse { // adding the wire_transfer_delay on top of the refund // deadline should be rounded up to. // @since **v23** - default_wire_transfer_rounding_interval: RoundingInterval; + default_wire_transfer_rounding_interval?: RoundingInterval; } export enum RoundingInterval { @@ -1991,7 +1989,7 @@ export interface QueryInstancesResponse { // adding the wire_transfer_delay on top of the refund // deadline should be rounded up to. // @since **v23** - default_wire_transfer_rounding_interval: RoundingInterval; + default_wire_transfer_rounding_interval?: RoundingInterval; // Authentication configuration. // Does not contain the token when token auth is configured. @@ -3805,7 +3803,7 @@ export const codecForTalerMerchantConfigResponse = ) .property( "default_wire_transfer_rounding_interval", - codecForRoundingInterval, + codecOptional(codecForRoundingInterval), ) .build("TalerMerchantApi.VersionResponse"); @@ -3975,7 +3973,7 @@ export const codecForQueryInstancesResponse = .property("default_refund_delay", codecForDuration) .property( "default_wire_transfer_rounding_interval", - codecForRoundingInterval, + codecOptional(codecForRoundingInterval), ) .property( "auth", diff --git a/packages/taler-wallet-core/src/common.ts b/packages/taler-wallet-core/src/common.ts @@ -1102,15 +1102,16 @@ export async function getGenericRecordHandle<T>( ctx: TransactionContext, tx: WalletDbReadWriteTransaction<any>, getRec: () => Promise<T | undefined>, - getSt: (r: T) => TransactionState, - getStId: (r: T) => number, + storeRec: (r: T) => Promise<void>, + toSt: (r: T) => TransactionState, + toStId: (r: T) => number, ): Promise<[T | undefined, RecordHandle<T>]> { const rec = await getRec(); let oldTxState: TransactionState; let oldStId: number; if (rec) { - oldTxState = getSt(rec); - oldStId = getStId(rec); + oldTxState = toSt(rec); + oldStId = toStId(rec); } else { oldTxState = { major: TransactionMajorState.None }; oldStId = 0; @@ -1119,8 +1120,9 @@ export async function getGenericRecordHandle<T>( let newTxState: TransactionState; let newStId: number; if (newRec != null) { - newTxState = getSt(newRec); - newStId = getStId(newRec); + newTxState = toSt(newRec); + newStId = toStId(newRec); + await storeRec(newRec); } else if (rec != null) { newTxState = { major: TransactionMajorState.Deleted }; newStId = -1; diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts @@ -582,6 +582,9 @@ export class PayMerchantTransactionContext implements TransactionContext { this, tx as any, async () => tx.purchases.get(this.proposalId), + async (r) => { + await tx.purchases.put(r); + }, (r) => computePayMerchantTransactionState(r), (r) => r.purchaseStatus, ); diff --git a/packages/taler-wallet-core/src/query.ts b/packages/taler-wallet-core/src/query.ts @@ -970,7 +970,7 @@ class InternalTransactionContext { allowWrite: boolean; abortExn: TransactionAbortedError | undefined; notifications: WalletNotification[] = []; - afterCommitHandlers: (() => void)[]; + afterCommitHandlers: (() => void)[] = []; constructor( private readonly triggerSpec: TriggerSpec,