gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: wallet-core: return txid when


From: gnunet
Subject: [taler-wallet-core] branch master updated: wallet-core: return txid when starting refund via URI
Date: Wed, 10 May 2023 17:30:46 +0200

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

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

The following commit(s) were added to refs/heads/master by this push:
     new 6308c7ea6 wallet-core: return txid when starting refund via URI
6308c7ea6 is described below

commit 6308c7ea6ba195199ee413c6c485321a013a514a
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed May 10 17:30:38 2023 +0200

    wallet-core: return txid when starting refund via URI
---
 packages/taler-util/src/wallet-types.ts                   |  4 ++++
 packages/taler-wallet-core/src/operations/pay-merchant.ts | 13 +++++++++++--
 packages/taler-wallet-core/src/wallet-api-types.ts        |  3 ++-
 packages/taler-wallet-core/src/wallet.ts                  |  3 +--
 4 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/packages/taler-util/src/wallet-types.ts 
b/packages/taler-util/src/wallet-types.ts
index 9c3bbe815..40476f4cc 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -1645,6 +1645,10 @@ export interface PrepareRefundRequest {
   talerRefundUri: string;
 }
 
+export interface StartRefundQueryForUriResponse {
+  transactionId: string;
+}
+
 export const codecForPrepareRefundRequest = (): Codec<PrepareRefundRequest> =>
   buildCodecForObject<PrepareRefundRequest>()
     .property("talerRefundUri", codecForString())
diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts 
b/packages/taler-wallet-core/src/operations/pay-merchant.ts
index e34dc7443..49ab63b19 100644
--- a/packages/taler-wallet-core/src/operations/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts
@@ -69,6 +69,7 @@ import {
   PrepareRefundResult,
   randomBytes,
   RefreshReason,
+  StartRefundQueryForUriResponse,
   TalerError,
   TalerErrorCode,
   TalerErrorDetail,
@@ -2051,7 +2052,7 @@ async function processPurchaseAcceptRefund(
 export async function startRefundQueryForUri(
   ws: InternalWalletState,
   talerUri: string,
-): Promise<void> {
+): Promise<StartRefundQueryForUriResponse> {
   const parsedUri = parseTalerUri(talerUri);
   if (!parsedUri) {
     throw Error("invalid taler:// URI");
@@ -2070,7 +2071,15 @@ export async function startRefundQueryForUri(
   if (!purchaseRecord) {
     throw Error("no purchase found, can't refund");
   }
-  return startQueryRefund(ws, purchaseRecord.proposalId);
+  const proposalId = purchaseRecord.proposalId;
+  const transactionId = constructTransactionIdentifier({
+    tag: TransactionType.Payment,
+    proposalId,
+  });
+  await startQueryRefund(ws, proposalId);
+  return {
+    transactionId,
+  }
 }
 
 export async function startQueryRefund(
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts 
b/packages/taler-wallet-core/src/wallet-api-types.ts
index f0da6059f..d8424494b 100644
--- a/packages/taler-wallet-core/src/wallet-api-types.ts
+++ b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -110,6 +110,7 @@ import {
   WithdrawFakebankRequest,
   WithdrawTestBalanceRequest,
   WithdrawUriInfoResponse,
+  StartRefundQueryForUriResponse,
 } from "@gnu-taler/taler-util";
 import { AuditorTrustRecord, WalletContractData } from "./db.js";
 import {
@@ -438,7 +439,7 @@ export type ConfirmPayOp = {
 export type StartRefundQueryForUriOp = {
   op: WalletApiOperation.StartRefundQueryForUri;
   request: PrepareRefundRequest;
-  response: EmptyObject;
+  response: StartRefundQueryForUriResponse;
 };
 
 export type StartRefundQueryOp = {
diff --git a/packages/taler-wallet-core/src/wallet.ts 
b/packages/taler-wallet-core/src/wallet.ts
index d76aa4ec9..01df4a5e1 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -1288,8 +1288,7 @@ async function dispatchRequestInternal<Op extends 
WalletApiOperation>(
     }
     case WalletApiOperation.StartRefundQueryForUri: {
       const req = codecForPrepareRefundRequest().decode(payload);
-      await startRefundQueryForUri(ws, req.talerRefundUri);
-      return {};
+      return await startRefundQueryForUri(ws, req.talerRefundUri);
     }
     case WalletApiOperation.StartRefundQuery: {
       const req = codecForStartRefundQueryRequest().decode(payload);

-- 
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]