commit 18b59b3ef5e75178aabe5a90f0ae000772b42cd3
parent 88bfeb5aa067156ded296874b0632f9ecbdeb3e1
Author: Florian Dold <dold@taler.net>
Date: Fri, 28 Aug 2026 14:36:41 +0200
wallet: remove deprecated payment sharing API
Diffstat:
8 files changed, 2 insertions(+), 848 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-payment-order-gone.ts b/packages/taler-harness/src/integrationtests/test-payment-order-gone.ts
@@ -149,50 +149,7 @@ export async function runPaymentOrderGoneTest(t: GlobalTestState) {
t.logStep("refund-query-given-up");
}
- // Case 2: the order is deleted while a shared proposal is waiting for
- // another wallet to pay it. Nobody can pay a deleted order, so the wallet
- // must stop watching it.
- {
- const order = await createOrder("TESTKUDOS:5" as AmountString);
-
- const prep = await walletClient.call(
- WalletApiOperation.PreparePayForUriV2,
- { talerPayUri: order.talerPayUri },
- );
- await walletClient.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: prep.transactionId,
- txState: {
- major: TransactionMajorState.Dialog,
- minor: TransactionMinorState.Proposed,
- },
- });
-
- succeedOrThrow(
- await merchantClient.deleteOrder(
- merchantAdminAccessToken,
- order.orderId,
- true,
- ),
- );
-
- t.logStep("shared-order-deleted");
-
- await walletClient.call(WalletApiOperation.SharePayment, {
- merchantBaseUrl: merchant.makeInstanceBaseUrl(),
- orderId: order.orderId,
- });
-
- await walletClient.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: prep.transactionId,
- txState: {
- major: TransactionMajorState.Aborted,
- },
- });
-
- t.logStep("shared-proposal-given-up");
- }
-
- // No task may be left polling the merchant for either order.
+ // No task may be left polling the merchant for the order.
await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
}
diff --git a/packages/taler-harness/src/integrationtests/test-payment-share-idempotency.ts b/packages/taler-harness/src/integrationtests/test-payment-share-idempotency.ts
@@ -1,323 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2020 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Imports.
- */
-import {
- AmountString,
- ConfirmPayResultType,
- succeedOrThrow,
- TalerMerchantInstanceHttpClient,
- TransactionMajorState,
- TransactionMinorState,
-} from "@gnu-taler/taler-util";
-import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
-import {
- createSimpleTestkudosEnvironmentV3,
- createWalletDaemonWithClient,
- withdrawViaBankV3,
-} from "../harness/environments.js";
-import { GlobalTestState } from "../harness/harness.js";
-
-/**
- * Run test for basic, bank-integrated withdrawal and payment.
- */
-export async function runPaymentShareIdempotencyTest(t: GlobalTestState) {
- // Set up test environment
- const {
- walletClient: firstWallet,
- bankClient,
- exchange,
- merchant,
- merchantAdminAccessToken,
- } = await createSimpleTestkudosEnvironmentV3(t);
-
- const merchantClient = new TalerMerchantInstanceHttpClient(
- merchant.makeInstanceBaseUrl(),
- );
-
- // Withdraw digital cash into the wallet.
- await withdrawViaBankV3(t, {
- walletClient: firstWallet,
- bankClient,
- exchange,
- amount: "TESTKUDOS:20",
- });
- await firstWallet.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
-
- const { walletClient: secondWallet } = await createWalletDaemonWithClient(t, {
- name: "wallet2",
- });
-
- await withdrawViaBankV3(t, {
- walletClient: secondWallet,
- bankClient,
- exchange,
- amount: "TESTKUDOS:20",
- });
- await secondWallet.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
-
- {
- const first = await firstWallet.call(WalletApiOperation.GetBalances, {});
- const second = await secondWallet.call(WalletApiOperation.GetBalances, {});
- t.assertAmountEquals(first.balances[0].available, "TESTKUDOS:19.84");
- t.assertAmountEquals(second.balances[0].available, "TESTKUDOS:19.84");
- }
-
- t.logStep("setup-done");
-
- // create two orders to pay
- async function createOrder(amount: string) {
- const order = {
- summary: "Buy me!",
- amount: amount as AmountString,
- fulfillment_url: "taler://fulfillment-success/thx",
- };
-
- const args = { order };
-
- const orderResp = succeedOrThrow(
- await merchantClient.createOrder(merchantAdminAccessToken, {
- order: args.order,
- }),
- );
-
- const orderStatus = succeedOrThrow(
- await merchantClient.getOrderDetails(
- merchantAdminAccessToken,
- orderResp.order_id,
- ),
- );
-
- t.assertTrue(orderStatus.order_status === "unpaid");
- return { id: orderResp.order_id, uri: orderStatus.taler_pay_uri };
- }
-
- t.logStep("orders-created");
-
- /**
- * Scenario A (a)
- * - Claim with first wallet, don't confirm.
- * - Claim shared URI with second wallet, don't confirm.
- * - Claim with second wallet again, should still be able to confirm.
- */
- {
- const order = await createOrder("TESTKUDOS:5");
- // Claim the order with the first wallet
- const claimFirstWallet = await firstWallet.call(
- WalletApiOperation.PreparePayForUriV2,
- { talerPayUri: order.uri },
- );
-
- await firstWallet.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: claimFirstWallet.transactionId,
- txState: {
- major: TransactionMajorState.Dialog,
- minor: TransactionMinorState.Proposed,
- },
- });
-
- t.logStep("w1-payment-possible");
-
- // share order from the first wallet
- const { privatePayUri } = await firstWallet.call(
- WalletApiOperation.SharePayment,
- {
- merchantBaseUrl: merchant.makeInstanceBaseUrl(),
- orderId: order.id,
- },
- );
-
- t.logStep("w1-payment-shared");
-
- // claim from the second wallet
- const claimSecondWallet = await secondWallet.call(
- WalletApiOperation.PreparePayForUriV2,
- { talerPayUri: privatePayUri },
- );
-
- await secondWallet.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: claimSecondWallet.transactionId,
- txState: {
- major: TransactionMajorState.Dialog,
- minor: TransactionMinorState.Proposed,
- },
- });
-
- t.logStep("w2-claimed");
-
- // claim from the second wallet (again)
- const claimSecondWalletAgain = await secondWallet.call(
- WalletApiOperation.PreparePayForUriV2,
- { talerPayUri: privatePayUri },
- );
-
- // Preparing the payment must return the same transaction ID here.
- t.assertTrue(
- claimSecondWallet.transactionId === claimSecondWalletAgain.transactionId,
- );
-
- await secondWallet.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: claimSecondWalletAgain.transactionId,
- txState: {
- major: TransactionMajorState.Dialog,
- minor: TransactionMinorState.Proposed,
- },
- });
-
- t.logStep("w2-claimed-again");
-
- console.log(`confirming ${claimSecondWalletAgain.transactionId}`);
-
- // pay from the second wallet
- const r2 = await secondWallet.call(WalletApiOperation.ConfirmPay, {
- transactionId: claimSecondWalletAgain.transactionId,
- choiceIndex: 0,
- });
-
- t.logStep("w2-confirmed");
-
- t.assertTrue(r2.type === ConfirmPayResultType.Done);
-
- t.logStep("w2-confirmed-checked");
-
- // Wait for refresh to settle before we do checks
- await secondWallet.call(
- WalletApiOperation.TestingWaitTransactionsFinal,
- {},
- );
-
- t.logStep("w2-refresh-settled");
-
- {
- const first = await firstWallet.call(WalletApiOperation.GetBalances, {});
- const second = await secondWallet.call(
- WalletApiOperation.GetBalances,
- {},
- );
- t.assertAmountEquals(first.balances[0].available, "TESTKUDOS:19.84");
- t.assertAmountEquals(second.balances[0].available, "TESTKUDOS:14.69");
- }
-
- t.logStep("wait-for-payment");
- }
-
- t.logStep("scenario-a-a-done");
-
- /**
- * Scenario A (b)
- * - Claim with first wallet, don't confirm.
- * - Claim shared URI with second wallet, confirm.
- * - Claim with second wallet again, tx should transition to `done`.
- */
- {
- const order = await createOrder("TESTKUDOS:5");
- // Claim the order with the first wallet
- const claimFirstWallet = await firstWallet.call(
- WalletApiOperation.PreparePayForUriV2,
- { talerPayUri: order.uri },
- );
-
- await firstWallet.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: claimFirstWallet.transactionId,
- txState: {
- major: TransactionMajorState.Dialog,
- minor: TransactionMinorState.Proposed,
- },
- });
-
- t.logStep("w1-payment-possible");
-
- // share order from the first wallet
- const { privatePayUri } = await firstWallet.call(
- WalletApiOperation.SharePayment,
- {
- merchantBaseUrl: merchant.makeInstanceBaseUrl(),
- orderId: order.id,
- },
- );
-
- t.logStep("w1-payment-shared");
-
- // claim from the second wallet
- const claimSecondWallet = await secondWallet.call(
- WalletApiOperation.PreparePayForUriV2,
- { talerPayUri: privatePayUri },
- );
-
- console.log(`second claim tx id: ${claimSecondWallet.transactionId}`);
-
- await secondWallet.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: claimSecondWallet.transactionId,
- txState: {
- major: TransactionMajorState.Dialog,
- minor: TransactionMinorState.Proposed,
- },
- });
-
- t.logStep("w2-claimed");
-
- // pay from the second wallet
- const r2 = await secondWallet.call(WalletApiOperation.ConfirmPay, {
- transactionId: claimSecondWallet.transactionId,
- choiceIndex: 0,
- });
-
- t.assertTrue(r2.type === ConfirmPayResultType.Done);
-
- t.logStep("w2-confirmed");
-
- // Wait for refresh to settle before we do checks
- await secondWallet.call(
- WalletApiOperation.TestingWaitTransactionsFinal,
- {},
- );
-
- t.logStep("w2-refresh-settled");
-
- {
- const first = await firstWallet.call(WalletApiOperation.GetBalances, {});
- const second = await secondWallet.call(
- WalletApiOperation.GetBalances,
- {},
- );
- t.assertAmountEquals(first.balances[0].available, "TESTKUDOS:19.84");
- t.assertAmountEquals(second.balances[0].available, "TESTKUDOS:9.54");
- }
-
- t.logStep("wait-for-payment");
-
- // claim from the second wallet (again)
- const claimSecondWalletAgain = await secondWallet.call(
- WalletApiOperation.PreparePayForUriV2,
- { talerPayUri: privatePayUri },
- );
-
- t.logStep("scenario-a-b-wait-done");
-
- await secondWallet.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: claimSecondWalletAgain.transactionId,
- txState: {
- major: TransactionMajorState.Done,
- },
- });
- }
-
- t.logStep("scenario-a-b-done");
-}
-
-runPaymentShareIdempotencyTest.suites = ["wallet"];
diff --git a/packages/taler-harness/src/integrationtests/test-payment-share.ts b/packages/taler-harness/src/integrationtests/test-payment-share.ts
@@ -1,337 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2020 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Imports.
- */
-import {
- AmountString,
- ConfirmPayResultType,
- succeedOrThrow,
- TalerMerchantInstanceHttpClient,
- TransactionMajorState,
- TransactionMinorState,
-} from "@gnu-taler/taler-util";
-import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
-import {
- createSimpleTestkudosEnvironmentV3,
- createWalletDaemonWithClient,
- withdrawViaBankV3,
-} from "../harness/environments.js";
-import { GlobalTestState } from "../harness/harness.js";
-
-/**
- * Run test for basic, bank-integrated withdrawal and payment.
- */
-export async function runPaymentShareTest(t: GlobalTestState) {
- // Set up test environment
- const {
- walletClient: firstWallet,
- bankClient,
- exchange,
- merchant,
- merchantAdminAccessToken,
- } = await createSimpleTestkudosEnvironmentV3(t);
-
- const merchantClient = new TalerMerchantInstanceHttpClient(
- merchant.makeInstanceBaseUrl(),
- );
-
- // Withdraw digital cash into the wallet.
- await withdrawViaBankV3(t, {
- walletClient: firstWallet,
- bankClient,
- exchange,
- amount: "TESTKUDOS:20",
- });
- await firstWallet.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
-
- const { walletClient: secondWallet } = await createWalletDaemonWithClient(t, {
- name: "wallet2",
- });
-
- await withdrawViaBankV3(t, {
- walletClient: secondWallet,
- bankClient,
- exchange,
- amount: "TESTKUDOS:20",
- });
- await secondWallet.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
-
- {
- const first = await firstWallet.call(WalletApiOperation.GetBalances, {});
- const second = await secondWallet.call(WalletApiOperation.GetBalances, {});
- t.assertAmountEquals(first.balances[0].available, "TESTKUDOS:19.84");
- t.assertAmountEquals(second.balances[0].available, "TESTKUDOS:19.84");
- }
-
- t.logStep("setup-done");
-
- // create two orders to pay
- async function createOrder(amount: string) {
- const order = {
- summary: "Buy me!",
- amount: amount as AmountString,
- fulfillment_url: "taler://fulfillment-success/thx",
- };
-
- const args = { order };
-
- const orderResp = succeedOrThrow(
- await merchantClient.createOrder(merchantAdminAccessToken, {
- order: args.order,
- }),
- );
-
- const orderStatus = succeedOrThrow(
- await merchantClient.getOrderDetails(
- merchantAdminAccessToken,
- orderResp.order_id,
- ),
- );
-
- t.assertTrue(orderStatus.order_status === "unpaid");
- return { id: orderResp.order_id, uri: orderStatus.taler_pay_uri };
- }
-
- t.logStep("orders-created");
-
- /**
- * Case 1:
- * - Claim with first wallet and pay in the second wallet.
- * - First wallet should be notified.
- */
- {
- const order = await createOrder("TESTKUDOS:5");
- // Claim the order with the first wallet
- const claimFirstWallet = await firstWallet.call(
- WalletApiOperation.PreparePayForUriV2,
- { talerPayUri: order.uri },
- );
-
- await firstWallet.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: claimFirstWallet.transactionId,
- txState: {
- major: TransactionMajorState.Dialog,
- minor: TransactionMinorState.Proposed,
- },
- });
-
- t.logStep("w1-payment-possible");
-
- // share order from the first wallet
- const { privatePayUri } = await firstWallet.call(
- WalletApiOperation.SharePayment,
- {
- merchantBaseUrl: merchant.makeInstanceBaseUrl(),
- orderId: order.id,
- },
- );
-
- t.logStep("w1-payment-shared");
-
- // claim from the second wallet
- const claimSecondWallet = await secondWallet.call(
- WalletApiOperation.PreparePayForUriV2,
- { talerPayUri: privatePayUri },
- );
-
- await secondWallet.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: claimSecondWallet.transactionId,
- txState: {
- major: TransactionMajorState.Dialog,
- minor: TransactionMinorState.Proposed,
- },
- });
-
- t.logStep("w2-claimed");
-
- // pay from the second wallet
- const r2 = await secondWallet.call(WalletApiOperation.ConfirmPay, {
- transactionId: claimSecondWallet.transactionId,
- choiceIndex: 0,
- });
-
- t.assertTrue(r2.type === ConfirmPayResultType.Done);
-
- t.logStep("w2-confirmed");
-
- // Wait for refresh to settle before we do checks
- await secondWallet.call(
- WalletApiOperation.TestingWaitTransactionsFinal,
- {},
- );
-
- t.logStep("w2-refresh-settled");
-
- {
- const first = await firstWallet.call(WalletApiOperation.GetBalances, {});
- const second = await secondWallet.call(
- WalletApiOperation.GetBalances,
- {},
- );
- t.assertAmountEquals(first.balances[0].available, "TESTKUDOS:19.84");
- t.assertAmountEquals(second.balances[0].available, "TESTKUDOS:14.69");
- }
-
- t.logStep("wait-for-payment");
- // firstWallet.waitForNotificationCond(n =>
- // n.type === NotificationType.TransactionStateTransition &&
- // n.transactionId === claimFirstWallet.transactionId
- // )
- // Claim the order with the first wallet
- const claimFirstWalletAgain = await firstWallet.call(
- WalletApiOperation.PreparePayForUriV2,
- { talerPayUri: order.uri },
- );
-
- await firstWallet.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: claimFirstWalletAgain.transactionId,
- txState: {
- major: TransactionMajorState.Failed,
- minor: TransactionMinorState.PaidByOther,
- },
- });
-
- t.logStep("w1-prepared-again");
-
- const r1 = await firstWallet.call(WalletApiOperation.ConfirmPay, {
- transactionId: claimFirstWallet.transactionId,
- choiceIndex: 0,
- });
-
- //t.assertTrue(r1.type === ConfirmPayResultType.Pending);
-
- t.logStep("w1-confirmed-shared");
-
- await firstWallet.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
-
- await secondWallet.call(
- WalletApiOperation.TestingWaitTransactionsFinal,
- {},
- );
-
- /**
- * only the second wallet balance was affected
- */
- {
- const first = await firstWallet.call(WalletApiOperation.GetBalances, {});
- const second = await secondWallet.call(
- WalletApiOperation.GetBalances,
- {},
- );
- t.assertAmountEquals(first.balances[0].available, "TESTKUDOS:19.84");
- t.assertAmountEquals(second.balances[0].available, "TESTKUDOS:14.69");
- }
- }
-
- t.logStep("first-case-done");
-
- /**
- * Case 2:
- * - Claim with first wallet and share with the second wallet
- * - Pay with the first wallet, second wallet should be notified
- */
- {
- const order = await createOrder("TESTKUDOS:3");
- // Claim the order with the first wallet
- const claimFirstWallet = await firstWallet.call(
- WalletApiOperation.PreparePayForUriV2,
- { talerPayUri: order.uri },
- );
-
- await firstWallet.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: claimFirstWallet.transactionId,
- txState: {
- major: TransactionMajorState.Dialog,
- minor: TransactionMinorState.Proposed,
- },
- });
-
- t.logStep("case2-w1-claimed");
-
- // share order from the first wallet
- const { privatePayUri } = await firstWallet.call(
- WalletApiOperation.SharePayment,
- {
- merchantBaseUrl: merchant.makeInstanceBaseUrl(),
- orderId: order.id,
- },
- );
-
- t.logStep("case2-w1-shared");
-
- // claim from the second wallet
- const claimSecondWallet = await secondWallet.call(
- WalletApiOperation.PreparePayForUriV2,
- { talerPayUri: privatePayUri },
- );
-
- t.logStep("case2-w2-prepared");
-
- await secondWallet.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: claimSecondWallet.transactionId,
- txState: {
- major: TransactionMajorState.Dialog,
- minor: TransactionMinorState.Proposed,
- },
- });
-
- // pay from the first wallet
- const r2 = await firstWallet.call(WalletApiOperation.ConfirmPay, {
- transactionId: claimFirstWallet.transactionId,
- choiceIndex: 0,
- });
-
- t.assertTrue(r2.type === ConfirmPayResultType.Done);
-
- // Wait for refreshes to settle before doing checks
- await firstWallet.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
-
- /**
- * only the first wallet balance was affected
- */
- const bal1 = await firstWallet.call(WalletApiOperation.GetBalances, {});
- const bal2 = await secondWallet.call(WalletApiOperation.GetBalances, {});
- t.assertAmountEquals(bal1.balances[0].available, "TESTKUDOS:16.69");
- t.assertAmountEquals(bal2.balances[0].available, "TESTKUDOS:14.69");
-
- t.logStep("wait-for-payment");
-
- // Now the second wallet should realize that the first wallet indeed
- // paid.
-
- // Manually trigger checking the status. In the future,
- // this might happen automatically via long-polling
- // in the dialog state.
-
- await secondWallet.call(WalletApiOperation.PreparePayForUriV2, {
- talerPayUri: order.uri,
- });
-
- await secondWallet.call(WalletApiOperation.TestingWaitTransactionState, {
- transactionId: claimSecondWallet.transactionId,
- txState: {
- major: TransactionMajorState.Failed,
- minor: TransactionMinorState.PaidByOther,
- },
- });
- }
-
- t.logStep("second-case-done");
-}
-
-runPaymentShareTest.suites = ["wallet"];
diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts b/packages/taler-harness/src/integrationtests/testrunner.ts
@@ -149,8 +149,6 @@ import { runPaymentExpiredTest } from "./test-payment-expired.js";
import { runPaymentForgettableTest } from "./test-payment-forgettable.js";
import { runPaymentMultipleTest } from "./test-payment-multiple.js";
import { runPaymentOrderGoneTest } from "./test-payment-order-gone.js";
-import { runPaymentShareIdempotencyTest } from "./test-payment-share-idempotency.js";
-import { runPaymentShareTest } from "./test-payment-share.js";
import { runPaymentUnclaimTest } from "./test-payment-unclaim.js";
import { runPaymentTemplateTest } from "./test-payment-template.js";
import { runPaymentTransientTest } from "./test-payment-transient.js";
@@ -342,9 +340,7 @@ const allTests: TestMainFunction[] = [
runPaymentMultipleTest,
runPaymentOrderGoneTest,
runPaymentTest,
- runPaymentShareTest,
runPaymentUnclaimTest,
- runPaymentShareIdempotencyTest,
runPaymentTemplateTest,
runPaymentAbortTest,
runPaymentTransientTest,
diff --git a/packages/taler-util/src/types-taler-wallet.ts b/packages/taler-util/src/types-taler-wallet.ts
@@ -3133,29 +3133,6 @@ export type GetChoicesForPaymentResult = {
contractTerms: MerchantContractTerms;
};
-/**
- * @deprecated Sharing transfers the wallet's private claim nonce. Use
- * UnclaimPaymentRequest to release the order and continue in another wallet.
- */
-export interface SharePaymentRequest {
- merchantBaseUrl: string;
- orderId: string;
-}
-
-export const codecForSharePaymentRequest = (): Codec<SharePaymentRequest> =>
- buildCodecForObject<SharePaymentRequest>()
- .property("merchantBaseUrl", codecForCanonBaseUrl())
- .property("orderId", codecForString())
- .build("SharePaymentRequest");
-
-export interface SharePaymentResult {
- privatePayUri: string;
-}
-export const codecForSharePaymentResult = (): Codec<SharePaymentResult> =>
- buildCodecForObject<SharePaymentResult>()
- .property("privatePayUri", codecForString())
- .build("SharePaymentResult");
-
export interface UnclaimPaymentRequest {
transactionId: TransactionIdStr;
}
diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts
@@ -88,7 +88,6 @@ import {
ScopeType,
SelectedCoin,
SelectedProspectiveCoin,
- SharePaymentResult,
SignedTokenEnvelope,
StartRefundQueryForUriResponse,
stringToBytes,
@@ -4642,90 +4641,6 @@ export function computePayMerchantTransactionActions(
}
}
-/** @deprecated Use unclaimPayment() for cross-wallet payment handoff. */
-export async function sharePayment(
- wex: WalletExecutionContext,
- merchantBaseUrl: string,
- orderId: string,
-): Promise<SharePaymentResult> {
- // First, translate the order ID into a proposal ID
- const proposalId = await wex.runWalletDbTx(async (tx) => {
- const p = await tx.getPurchaseByUrlAndOrderId(merchantBaseUrl, orderId);
- return p?.proposalId;
- });
-
- if (!proposalId) {
- throw TalerError.fromDetail(
- TalerErrorCode.WALLET_PURCHASE_NOT_FOUND,
- { merchantBaseUrl, orderId },
- `no purchase found for order ${orderId}`,
- );
- }
-
- const ctx = new PayMerchantTransactionContext(wex, proposalId);
-
- // "gone" and "wrong state" need different error codes, so they cannot both
- // come back as undefined.
- const result = await wex.runWalletDbTx(async (tx) => {
- const [p, h] = await ctx.getRecordHandle(tx);
- if (!p) {
- logger.warn("purchase does not exist anymore");
- return { type: "gone" as const };
- }
- if (
- p.purchaseStatus !== PurchaseStatus.DialogProposed &&
- p.purchaseStatus !== PurchaseStatus.DialogShared
- ) {
- // FIXME: purchase can be shared before being paid
- return { type: "bad-state" as const, purchase: p };
- }
- if (p.purchaseStatus === PurchaseStatus.DialogProposed) {
- p.purchaseStatus = PurchaseStatus.DialogShared;
- p.shared = true;
- await h.update(p, "share");
- }
- return {
- type: "ok" as const,
- proposalId: p.proposalId,
- nonce: p.noncePriv,
- session: p.lastSessionId ?? p.downloadSessionId,
- token: p.claimToken,
- };
- });
-
- switch (result.type) {
- case "ok":
- break;
- case "gone":
- throw makeTransactionNotFoundError(ctx.transactionId);
- case "bad-state":
- throw TalerError.fromDetail(
- TalerErrorCode.WALLET_REQUEST_TRANSACTION_STATE_UNSUPPORTED,
- {
- txState: computePayMerchantTransactionState(result.purchase),
- debugStateNum: result.purchase.purchaseStatus,
- },
- "this payment can only be shared before it is paid",
- );
- default:
- assertUnreachable(result);
- }
-
- // schedule a task to watch for the status
- wex.taskScheduler.startShepherdTask(ctx.taskId);
-
- const privatePayUri = TalerUris.stringify({
- type: TalerUriAction.Pay,
- merchantBaseUrl: merchantBaseUrl as HostPortPath, // FIXME: change function argument
- orderId,
- sessionId: result.session,
- noncePriv: result.nonce,
- claimToken: result.token,
- });
-
- return { privatePayUri };
-}
-
function makePublicPayUri(purchase: WalletPurchase) {
return TalerUris.stringify({
type: TalerUriAction.Pay,
@@ -4738,8 +4653,7 @@ function makePublicPayUri(purchase: WalletPurchase) {
/**
* Release this wallet's claim on an order and return a public payment URI that
- * another wallet can claim. Unlike sharePayment(), the URI contains no
- * private nonce.
+ * another wallet can claim. The URI contains no private nonce.
*/
export async function unclaimPayment(
wex: WalletExecutionContext,
diff --git a/packages/taler-wallet-core/src/requests.ts b/packages/taler-wallet-core/src/requests.ts
@@ -112,8 +112,6 @@ import {
Result,
RunFixupRequest,
ScopeType,
- SharePaymentRequest,
- SharePaymentResult,
UnclaimPaymentRequest,
UnclaimPaymentResult,
StartRefundQueryRequest,
@@ -242,7 +240,6 @@ import {
codecForSendTalerUriMailboxMessageRequest,
codecForSetCoinSuspendedRequest,
codecForSetDonauRequest,
- codecForSharePaymentRequest,
codecForUnclaimPaymentRequest,
codecForStartExchangeWalletKycRequest,
codecForStartRefundQueryRequest,
@@ -349,7 +346,6 @@ import {
getChoicesForPayment,
preparePayForTemplateV2,
preparePayForUriV2,
- sharePayment,
startQueryRefund,
startRefundQueryForUri,
unclaimPayment,
@@ -705,13 +701,6 @@ async function handlePrepareWithdrawExchange(
);
}
-async function handleSharePayment(
- wex: WalletExecutionContext,
- req: SharePaymentRequest,
-): Promise<SharePaymentResult> {
- return await sharePayment(wex, req.merchantBaseUrl, req.orderId);
-}
-
async function handleUnclaimPayment(
wex: WalletExecutionContext,
req: UnclaimPaymentRequest,
@@ -2664,10 +2653,6 @@ const handlers: { [T in WalletApiOperation]: HandlerWithValidator<T> } = {
codec: codecForGetExchangeTosRequest(),
handler: handleGetExchangeTos,
},
- [WalletApiOperation.SharePayment]: {
- codec: codecForSharePaymentRequest(),
- handler: handleSharePayment,
- },
[WalletApiOperation.UnclaimPayment]: {
codec: codecForUnclaimPaymentRequest(),
handler: handleUnclaimPayment,
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -181,8 +181,6 @@ import {
SendTalerUriMailboxMessageRequest,
SetCoinSuspendedRequest,
SetDonauRequest,
- SharePaymentRequest,
- SharePaymentResult,
UnclaimPaymentRequest,
UnclaimPaymentResult,
StartExchangeWalletKycRequest,
@@ -312,7 +310,6 @@ export enum WalletApiOperation {
PreparePayForTemplateV2 = "preparePayForTemplateV2",
PreparePayForPaivana = "preparePayForPaivana",
GetPaivanaCookie = "getPaivanaCookie",
- SharePayment = "sharePayment",
UnclaimPayment = "unclaimPayment",
CheckPayForTemplate = "checkPayForTemplate",
StartRefundQueryForUri = "startRefundQueryForUri",
@@ -920,12 +917,6 @@ export type GetChoicesForPaymentOp = {
response: GetChoicesForPaymentResult;
};
-export type SharePaymentOp = {
- op: WalletApiOperation.SharePayment;
- request: SharePaymentRequest;
- response: SharePaymentResult;
-};
-
export type UnclaimPaymentOp = {
op: WalletApiOperation.UnclaimPayment;
request: UnclaimPaymentRequest;
@@ -1834,11 +1825,6 @@ export const walletApiExpectedErrors = {
TalerErrorCode.WALLET_REQUEST_TRANSACTION_STATE_UNSUPPORTED,
TalerErrorCode.WALLET_CORE_API_BAD_REQUEST,
],
- [WalletApiOperation.SharePayment]: [
- TalerErrorCode.WALLET_PURCHASE_NOT_FOUND,
- TalerErrorCode.WALLET_TRANSACTION_NOT_FOUND,
- TalerErrorCode.WALLET_REQUEST_TRANSACTION_STATE_UNSUPPORTED,
- ],
[WalletApiOperation.UnclaimPayment]: [
TalerErrorCode.WALLET_TRANSACTION_NOT_FOUND,
TalerErrorCode.WALLET_REQUEST_TRANSACTION_STATE_UNSUPPORTED,
@@ -2043,7 +2029,6 @@ export type WalletOperations = {
[WalletApiOperation.PreparePayForTemplateV2]: PreparePayForTemplateV2Op;
[WalletApiOperation.PreparePayForPaivana]: PreparePayForPaivanaOp;
[WalletApiOperation.GetPaivanaCookie]: GetPaivanaCookieOp;
- [WalletApiOperation.SharePayment]: SharePaymentOp;
[WalletApiOperation.UnclaimPayment]: UnclaimPaymentOp;
[WalletApiOperation.CheckPayForTemplate]: CheckPayForTemplateOp;
[WalletApiOperation.WithdrawTestkudos]: WithdrawTestkudosOp;