gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: if the order is not found, m


From: gnunet
Subject: [taler-wallet-core] branch master updated: if the order is not found, marked the payment as failed
Date: Tue, 10 Jan 2023 15:24:57 +0100

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

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

The following commit(s) were added to refs/heads/master by this push:
     new da5b42025 if the order is not found, marked the payment as failed
da5b42025 is described below

commit da5b42025a7996f9b1df8cebe7b6f94c3cd0583a
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Tue Jan 10 11:24:46 2023 -0300

    if the order is not found, marked the payment as failed
---
 .../src/operations/pay-merchant.ts                 | 75 ++++++++--------------
 1 file changed, 27 insertions(+), 48 deletions(-)

diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts 
b/packages/taler-wallet-core/src/operations/pay-merchant.ts
index 570a50c47..c8e3230b9 100644
--- a/packages/taler-wallet-core/src/operations/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts
@@ -1135,9 +1135,9 @@ export function selectForced(
 
 export type SelectPayCoinsResult =
   | {
-      type: "failure";
-      insufficientBalanceDetails: PayMerchantInsufficientBalanceDetails;
-    }
+    type: "failure";
+    insufficientBalanceDetails: PayMerchantInsufficientBalanceDetails;
+  }
   | { type: "success"; coinSel: PayCoinSelection };
 
 /**
@@ -1623,7 +1623,7 @@ export async function runPayForConfirmPay(
       const numRetry = opRetry?.retryInfo.retryCounter ?? 0;
       if (
         res.errorDetail.code ===
-          TalerErrorCode.WALLET_PAY_MERCHANT_SERVER_ERROR &&
+        TalerErrorCode.WALLET_PAY_MERCHANT_SERVER_ERROR &&
         numRetry < maxRetry
       ) {
         // Pretend the operation is pending instead of reporting
@@ -1942,50 +1942,6 @@ export async function processPurchasePay(
       };
     }
 
-    if (resp.status === HttpStatusCode.BadRequest) {
-      const errDetails = await readUnexpectedResponseDetails(resp);
-      logger.warn("unexpected 400 response for /pay");
-      logger.warn(j2s(errDetails));
-      await ws.db
-        .mktx((x) => [x.purchases])
-        .runReadWrite(async (tx) => {
-          const purch = await tx.purchases.get(proposalId);
-          if (!purch) {
-            return;
-          }
-          // FIXME: Should be some "PayPermanentlyFailed" and error info 
should be stored
-          purch.purchaseStatus = PurchaseStatus.PaymentAbortFinished;
-          await tx.purchases.put(purch);
-        });
-      throw makePendingOperationFailedError(
-        errDetails,
-        TransactionType.Payment,
-        proposalId,
-      );
-    }
-
-    if (resp.status === HttpStatusCode.Gone) {
-      const errDetails = await readUnexpectedResponseDetails(resp);
-      logger.warn("unexpected 410 response for /pay");
-      logger.warn(j2s(errDetails));
-      await ws.db
-        .mktx((x) => [x.purchases])
-        .runReadWrite(async (tx) => {
-          const purch = await tx.purchases.get(proposalId);
-          if (!purch) {
-            return;
-          }
-          // FIXME: Should be some "PayPermanentlyFailed" and error info 
should be stored
-          purch.purchaseStatus = PurchaseStatus.PaymentAbortFinished;
-          await tx.purchases.put(purch);
-        });
-      throw makePendingOperationFailedError(
-        errDetails,
-        TransactionType.Payment,
-        proposalId,
-      );
-    }
-
     if (resp.status === HttpStatusCode.Conflict) {
       const err = await readTalerErrorResponse(resp);
       if (
@@ -2012,6 +1968,29 @@ export async function processPurchasePay(
           result: undefined,
         };
       }
+
+      if (resp.status >= 400 && resp.status <= 499) {
+        const errDetails = await readUnexpectedResponseDetails(resp);
+        logger.warn(`server returned ${resp.status} response for /pay`);
+        logger.warn(j2s(errDetails));
+        await ws.db
+          .mktx((x) => [x.purchases])
+          .runReadWrite(async (tx) => {
+            const purch = await tx.purchases.get(proposalId);
+            if (!purch) {
+              return;
+            }
+            // FIXME: Should be some "PayPermanentlyFailed" and error info 
should be stored
+            purch.purchaseStatus = PurchaseStatus.PaymentAbortFinished;
+            await tx.purchases.put(purch);
+          });
+        throw makePendingOperationFailedError(
+          errDetails,
+          TransactionType.Payment,
+          proposalId,
+        );
+      }
+
     }
 
     const merchantResp = await readSuccessResponseJsonOrThrow(

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