gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: util: fix confirming withdraw


From: gnunet
Subject: [taler-wallet-core] branch master updated: util: fix confirming withdrawal ops
Date: Wed, 31 Jan 2024 01:51:10 +0100

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 361c2e03e util: fix confirming withdrawal ops
361c2e03e is described below

commit 361c2e03ec7e8020657173d00dabab640f018709
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Jan 31 01:50:57 2024 +0100

    util: fix confirming withdrawal ops
    
    This addresses a breaking change in libeufin-bank
---
 packages/taler-util/src/bank-api-client.ts | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/packages/taler-util/src/bank-api-client.ts 
b/packages/taler-util/src/bank-api-client.ts
index 0e122d10b..9c35af948 100644
--- a/packages/taler-util/src/bank-api-client.ts
+++ b/packages/taler-util/src/bank-api-client.ts
@@ -29,10 +29,13 @@ import {
   codecForAny,
   codecForString,
   encodeCrock,
-  generateIban,
   getRandomBytes,
+  HttpStatusCode,
   j2s,
   Logger,
+  opEmptySuccess,
+  opKnownHttpFailure,
+  opUnknownFailure,
   stringToBytes,
   TalerError,
   TalerErrorCode,
@@ -398,9 +401,9 @@ export class TalerCorebankApiClient {
   async confirmWithdrawalOperation(
     username: string,
     wopi: ConfirmWithdrawalArgs,
-  ): Promise<void> {
+  ) {
     const url = new URL(
-      `withdrawals/${wopi.withdrawalOperationId}/confirm`,
+      `accounts/${username}/withdrawals/${wopi.withdrawalOperationId}/confirm`,
       this.baseUrl,
     );
     logger.info(`confirming withdrawal operation via ${url.href}`);
@@ -410,10 +413,15 @@ export class TalerCorebankApiClient {
       headers: this.makeAuthHeader(),
     });
 
-    logger.info(`response status ${resp.status}`);
-    // const respJson = await readSuccessResponseJsonOrThrow(resp, 
codecForAny());
-
-    // FIXME: We don't check the status here!
+    switch (resp.status) {
+      case HttpStatusCode.Ok:
+      case HttpStatusCode.NoContent:
+        return opEmptySuccess(resp);
+      case HttpStatusCode.NotFound:
+        return opKnownHttpFailure(resp.status, resp);
+      default:
+        return opUnknownFailure(resp, await resp.text());
+    }
   }
 
   async abortWithdrawalOperation(wopi: WithdrawalOperationInfo): Promise<void> 
{

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