gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] 01/01: wallet-core: remove deprecated peer...Payment


From: gnunet
Subject: [taler-wallet-core] 01/01: wallet-core: remove deprecated peer...PaymentId
Date: Fri, 08 Mar 2024 01:06:18 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

commit b4ab2fcdf3e1bbc0ca9096661a1812481dca58b3
Author: Florian Dold <florian@dold.me>
AuthorDate: Fri Mar 8 01:06:13 2024 +0100

    wallet-core: remove deprecated peer...PaymentId
---
 .../src/integrationtests/test-peer-repair.ts       |  2 +-
 .../src/integrationtests/test-peer-to-peer-pull.ts |  4 ++--
 packages/taler-util/src/wallet-types.ts            | 24 ++++------------------
 packages/taler-wallet-cli/src/index.ts             |  5 +++--
 .../taler-wallet-core/src/pay-peer-pull-debit.ts   | 17 +++++----------
 .../taler-wallet-core/src/pay-peer-push-credit.ts  | 22 ++++++++------------
 packages/taler-wallet-core/src/testing.ts          |  2 +-
 .../src/cta/InvoicePay/state.ts                    | 12 ++++-------
 .../src/cta/TransferPickup/state.ts                |  8 ++++----
 9 files changed, 32 insertions(+), 64 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-peer-repair.ts 
b/packages/taler-harness/src/integrationtests/test-peer-repair.ts
index 22664bcc1..8bc7ed0a1 100644
--- a/packages/taler-harness/src/integrationtests/test-peer-repair.ts
+++ b/packages/taler-harness/src/integrationtests/test-peer-repair.ts
@@ -138,7 +138,7 @@ export async function runPeerRepairTest(t: GlobalTestState) 
{
   );
 
   await wallet2.client.call(WalletApiOperation.ConfirmPeerPushCredit, {
-    peerPushCreditId: resp2.peerPushCreditId,
+    transactionId: resp2.transactionId,
   });
 
   await peerPushCreditDone1Cond;
diff --git 
a/packages/taler-harness/src/integrationtests/test-peer-to-peer-pull.ts 
b/packages/taler-harness/src/integrationtests/test-peer-to-peer-pull.ts
index b61a3941b..e1565f295 100644
--- a/packages/taler-harness/src/integrationtests/test-peer-to-peer-pull.ts
+++ b/packages/taler-harness/src/integrationtests/test-peer-to-peer-pull.ts
@@ -157,7 +157,7 @@ async function checkNormalPeerPull(
   );
 
   await wallet2.client.call(WalletApiOperation.ConfirmPeerPullDebit, {
-    peerPullDebitId: checkResp.peerPullDebitId,
+    transactionId: checkResp.transactionId,
   });
 
   await peerPullCreditDoneCond;
@@ -257,7 +257,7 @@ async function checkAbortedPeerPull(
   });
 
   await wallet2.client.call(WalletApiOperation.ConfirmPeerPullDebit, {
-    peerPullDebitId: checkResp.peerPullDebitId,
+    transactionId: checkResp.transactionId,
   });
 
   console.log(`waiting for ${resp.transactionId} to go to state aborted`);
diff --git a/packages/taler-util/src/wallet-types.ts 
b/packages/taler-util/src/wallet-types.ts
index 599f65731..4ebaa3668 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -2766,14 +2766,7 @@ export const codecForCheckPeerPullPaymentRequest =
       .build("PreparePeerPullDebitRequest");
 
 export interface ConfirmPeerPushCreditRequest {
-  /**
-   * Transparent identifier of the incoming peer push payment.
-   *
-   * @deprecated specify transactionId instead!
-   */
-  peerPushCreditId?: string;
-
-  transactionId?: string;
+  transactionId: string;
 }
 export interface AcceptPeerPushPaymentResponse {
   transactionId: TransactionIdStr;
@@ -2786,19 +2779,11 @@ export interface AcceptPeerPullPaymentResponse {
 export const codecForConfirmPeerPushPaymentRequest =
   (): Codec<ConfirmPeerPushCreditRequest> =>
     buildCodecForObject<ConfirmPeerPushCreditRequest>()
-      .property("peerPushCreditId", codecOptional(codecForString()))
-      .property("transactionId", codecOptional(codecForString()))
+      .property("transactionId", codecForString())
       .build("ConfirmPeerPushCreditRequest");
 
 export interface ConfirmPeerPullDebitRequest {
-  /**
-   * Transparent identifier of the incoming peer pull payment.
-   *
-   * @deprecated use transactionId instead
-   */
-  peerPullDebitId?: string;
-
-  transactionId?: TransactionIdStr;
+  transactionId: TransactionIdStr;
 }
 
 export interface ApplyDevExperimentRequest {
@@ -2814,8 +2799,7 @@ export const codecForApplyDevExperiment =
 export const codecForAcceptPeerPullPaymentRequest =
   (): Codec<ConfirmPeerPullDebitRequest> =>
     buildCodecForObject<ConfirmPeerPullDebitRequest>()
-      .property("peerPullDebitId", codecOptional(codecForString()))
-      .property("transactionId", codecOptional(codecForTransactionIdStr()))
+      .property("transactionId", codecForTransactionIdStr())
       .build("ConfirmPeerPullDebitRequest");
 
 export interface CheckPeerPullCreditRequest {
diff --git a/packages/taler-wallet-cli/src/index.ts 
b/packages/taler-wallet-cli/src/index.ts
index 5c0bfe3cf..32b1eb901 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -1057,13 +1057,14 @@ peerCli
 
 peerCli
   .subcommand("confirmIncomingPayPull", "confirm-pull-debit")
-  .requiredArgument("peerPullDebitId", clk.STRING)
+  .requiredArgument("transactionId", clk.STRING)
   .action(async (args) => {
     await withWallet(args, async (wallet) => {
       const resp = await wallet.client.call(
         WalletApiOperation.ConfirmPeerPullDebit,
         {
-          peerPullDebitId: args.confirmIncomingPayPull.peerPullDebitId,
+          transactionId: args.confirmIncomingPayPull
+            .transactionId as TransactionIdStr,
         },
       );
       console.log(JSON.stringify(resp, undefined, 2));
diff --git a/packages/taler-wallet-core/src/pay-peer-pull-debit.ts 
b/packages/taler-wallet-core/src/pay-peer-pull-debit.ts
index 0ccca82a2..114d2366a 100644
--- a/packages/taler-wallet-core/src/pay-peer-pull-debit.ts
+++ b/packages/taler-wallet-core/src/pay-peer-pull-debit.ts
@@ -561,18 +561,11 @@ export async function confirmPeerPullDebit(
   req: ConfirmPeerPullDebitRequest,
 ): Promise<AcceptPeerPullPaymentResponse> {
   let peerPullDebitId: string;
-
-  if (req.transactionId) {
-    const parsedTx = parseTransactionIdentifier(req.transactionId);
-    if (!parsedTx || parsedTx.tag !== TransactionType.PeerPullDebit) {
-      throw Error("invalid peer-pull-debit transaction identifier");
-    }
-    peerPullDebitId = parsedTx.peerPullDebitId;
-  } else if (req.peerPullDebitId) {
-    peerPullDebitId = req.peerPullDebitId;
-  } else {
-    throw Error("invalid request, transactionId or peerPullDebitId required");
+  const parsedTx = parseTransactionIdentifier(req.transactionId);
+  if (!parsedTx || parsedTx.tag !== TransactionType.PeerPullDebit) {
+    throw Error("invalid peer-pull-debit transaction identifier");
   }
+  peerPullDebitId = parsedTx.peerPullDebitId;
 
   const peerPullInc = await wex.db.runReadOnlyTx(
     ["peerPullDebit"],
@@ -583,7 +576,7 @@ export async function confirmPeerPullDebit(
 
   if (!peerPullInc) {
     throw Error(
-      `can't accept unknown incoming p2p pull payment 
(${req.peerPullDebitId})`,
+      `can't accept unknown incoming p2p pull payment (${req.transactionId})`,
     );
   }
 
diff --git a/packages/taler-wallet-core/src/pay-peer-push-credit.ts 
b/packages/taler-wallet-core/src/pay-peer-push-credit.ts
index f6ba429a6..ecc1e827f 100644
--- a/packages/taler-wallet-core/src/pay-peer-push-credit.ts
+++ b/packages/taler-wallet-core/src/pay-peer-push-credit.ts
@@ -901,20 +901,14 @@ export async function confirmPeerPushCredit(
 ): Promise<AcceptPeerPushPaymentResponse> {
   let peerInc: PeerPushPaymentIncomingRecord | undefined;
   let peerPushCreditId: string;
-  if (req.peerPushCreditId) {
-    peerPushCreditId = req.peerPushCreditId;
-  } else if (req.transactionId) {
-    const parsedTx = parseTransactionIdentifier(req.transactionId);
-    if (!parsedTx) {
-      throw Error("invalid transaction ID");
-    }
-    if (parsedTx.tag !== TransactionType.PeerPushCredit) {
-      throw Error("invalid transaction ID type");
-    }
-    peerPushCreditId = parsedTx.peerPushCreditId;
-  } else {
-    throw Error("no transaction ID (or deprecated peerPushCreditId) provided");
+  const parsedTx = parseTransactionIdentifier(req.transactionId);
+  if (!parsedTx) {
+    throw Error("invalid transaction ID");
+  }
+  if (parsedTx.tag !== TransactionType.PeerPushCredit) {
+    throw Error("invalid transaction ID type");
   }
+  peerPushCreditId = parsedTx.peerPushCreditId;
 
   logger.trace(`confirming peer-push-credit ${peerPushCreditId}`);
 
@@ -934,7 +928,7 @@ export async function confirmPeerPushCredit(
 
   if (!peerInc) {
     throw Error(
-      `can't accept unknown incoming p2p push payment 
(${req.peerPushCreditId})`,
+      `can't accept unknown incoming p2p push payment (${req.transactionId})`,
     );
   }
 
diff --git a/packages/taler-wallet-core/src/testing.ts 
b/packages/taler-wallet-core/src/testing.ts
index 795f963d0..b192e7b70 100644
--- a/packages/taler-wallet-core/src/testing.ts
+++ b/packages/taler-wallet-core/src/testing.ts
@@ -821,7 +821,7 @@ export async function runIntegrationTest2(
   });
 
   await confirmPeerPullDebit(wex, {
-    peerPullDebitId: peerPullInc.peerPullDebitId,
+    transactionId: peerPullInc.transactionId,
   });
 
   await waitUntilTransactionWithAssociatedRefreshesFinal(
diff --git a/packages/taler-wallet-webextension/src/cta/InvoicePay/state.ts 
b/packages/taler-wallet-webextension/src/cta/InvoicePay/state.ts
index ff9c7e5c7..99de03d2d 100644
--- a/packages/taler-wallet-webextension/src/cta/InvoicePay/state.ts
+++ b/packages/taler-wallet-webextension/src/cta/InvoicePay/state.ts
@@ -23,10 +23,10 @@ import {
   TalerProtocolTimestamp,
 } from "@gnu-taler/taler-util";
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { useTranslationContext } from "@gnu-taler/web-util/browser";
 import { useEffect } from "preact/hooks";
 import { alertFromError, useAlertContext } from "../../context/alert.js";
 import { useBackendContext } from "../../context/backend.js";
-import { useTranslationContext } from "@gnu-taler/web-util/browser";
 import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js";
 import { Props, State } from "./index.js";
 
@@ -77,12 +77,8 @@ export function useComponentState({
   //   };
   // }
 
-  const {
-    contractTerms,
-    peerPullDebitId,
-    amountEffective,
-    amountRaw,
-  } = hook.response.p2p;
+  const { contractTerms, transactionId, amountEffective, amountRaw } =
+    hook.response.p2p;
 
   const amountStr: string = contractTerms.amount;
   const amount = Amounts.parseOrThrow(amountStr);
@@ -156,7 +152,7 @@ export function useComponentState({
     const resp = await api.wallet.call(
       WalletApiOperation.ConfirmPeerPullDebit,
       {
-        peerPullDebitId,
+        transactionId,
       },
     );
     onSuccess(resp.transactionId);
diff --git a/packages/taler-wallet-webextension/src/cta/TransferPickup/state.ts 
b/packages/taler-wallet-webextension/src/cta/TransferPickup/state.ts
index 50b9e5fe7..67f6d9113 100644
--- a/packages/taler-wallet-webextension/src/cta/TransferPickup/state.ts
+++ b/packages/taler-wallet-webextension/src/cta/TransferPickup/state.ts
@@ -20,9 +20,9 @@ import {
   TalerProtocolTimestamp,
 } from "@gnu-taler/taler-util";
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { useTranslationContext } from "@gnu-taler/web-util/browser";
 import { alertFromError, useAlertContext } from "../../context/alert.js";
 import { useBackendContext } from "../../context/backend.js";
-import { useTranslationContext } from "@gnu-taler/web-util/browser";
 import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js";
 import { Props, State } from "./index.js";
 
@@ -59,10 +59,10 @@ export function useComponentState({
 
   const {
     contractTerms,
-    peerPushCreditId,
+    transactionId,
     amountEffective,
     amountRaw,
-    exchangeBaseUrl
+    exchangeBaseUrl,
   } = hook.response;
 
   const effective = Amounts.parseOrThrow(amountEffective);
@@ -74,7 +74,7 @@ export function useComponentState({
     const resp = await api.wallet.call(
       WalletApiOperation.ConfirmPeerPushCredit,
       {
-        peerPushCreditId,
+        transactionId,
       },
     );
     onSuccess(resp.transactionId);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]