commit 724743166b689cdd299f644fc6fcd8d2dd4bba68
parent 63854330be05f77652955fe4654713081855c7bf
Author: Florian Dold <florian@dold.me>
Date: Wed, 1 Jul 2026 15:32:41 +0200
wallet-core: make noWait an argument of confirmPay to ease migration
Diffstat:
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/packages/taler-util/src/types-taler-wallet.ts b/packages/taler-util/src/types-taler-wallet.ts
@@ -2721,6 +2721,15 @@ export interface ConfirmPayRequest {
* Only applies to v1 orders.
*/
choiceIndex?: number;
+
+ /**
+ * Do not wait for the first payment success or error
+ * before returning a response. Instead, status will
+ * be communicated via notifications.
+ *
+ * Will become the default in future versions.
+ */
+ noWait?: boolean;
}
export const codecForConfirmPayRequest = (): Codec<ConfirmPayRequest> =>
@@ -2731,6 +2740,7 @@ export const codecForConfirmPayRequest = (): Codec<ConfirmPayRequest> =>
.property("forcedTokenSel", codecOptional(codecForBoolean()))
.property("choiceIndex", codecOptional(codecForNumber()))
.property("useDonau", codecOptional(codecForBoolean()))
+ .property("noWait", codecOptional(codecForBoolean()))
.build("ConfirmPay");
export interface ListDiscountsRequest {
diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts
@@ -2729,6 +2729,7 @@ export async function confirmPay(
forcedCoinSel?: ForcedCoinSel;
choiceIndex?: number;
useDonau?: boolean;
+ noWait?: boolean;
},
): Promise<ConfirmPayResult> {
const { transactionId, sessionIdOverride, forcedCoinSel } = args;
@@ -2788,8 +2789,7 @@ export async function confirmPay(
existingPurchase.proposalId,
);
await wex.taskScheduler.resetTask(ctx.taskId);
- // This will become the default behavior on the future.
- if (wex.ws.devExperimentState.flagConfirmPayNoWait) {
+ if (args.noWait) {
return {
type: ConfirmPayResultType.Pending,
transactionId: transactionId as TransactionIdStr,
@@ -3025,8 +3025,7 @@ export async function confirmPay(
// In case we're sharing the payment and we're long-polling
await wex.taskScheduler.resetTask(ctx.taskId);
- // This will become the default behavior on the future.
- if (wex.ws.devExperimentState.flagConfirmPayNoWait) {
+ if (args.noWait) {
wex.taskScheduler.startShepherdTask(ctx.taskId);
return {
type: ConfirmPayResultType.Pending,
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
@@ -1327,6 +1327,7 @@ async function handleConfirmPay(
forcedCoinSel: undefined,
sessionIdOverride: req.sessionId,
useDonau: req.useDonau,
+ noWait: req.noWait ?? wex.ws.devExperimentState.flagConfirmPayNoWait
});
}