gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: -fix test


From: gnunet
Subject: [taler-wallet-core] branch master updated: -fix test
Date: Tue, 07 Jan 2025 20:05:51 +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 f85428e42 -fix test
f85428e42 is described below

commit f85428e4244c0181e8c58f9292a41bb460c9c7c8
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Jan 7 20:05:48 2025 +0100

    -fix test
---
 .../src/integrationtests/test-payment-abort.ts     | 11 ++++++++---
 packages/taler-util/src/types-taler-merchant.ts    | 23 ++++++++++++++++++++--
 packages/taler-wallet-core/src/pay-merchant.ts     |  3 +++
 packages/taler-wallet-core/src/withdraw.ts         |  4 +++-
 4 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-payment-abort.ts 
b/packages/taler-harness/src/integrationtests/test-payment-abort.ts
index 86de07fbe..7b655a147 100644
--- a/packages/taler-harness/src/integrationtests/test-payment-abort.ts
+++ b/packages/taler-harness/src/integrationtests/test-payment-abort.ts
@@ -28,12 +28,12 @@ import {
   j2s,
 } from "@gnu-taler/taler-util";
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
-import { FaultInjectionRequestContext } from "../harness/faultInjection.js";
-import { GlobalTestState, harnessHttpLib } from "../harness/harness.js";
 import {
   createFaultInjectedMerchantTestkudosEnvironment,
   withdrawViaBankV2,
 } from "../harness/environments.js";
+import { FaultInjectionRequestContext } from "../harness/faultInjection.js";
+import { GlobalTestState, harnessHttpLib } from "../harness/harness.js";
 
 export async function runPaymentAbortTest(t: GlobalTestState) {
   // Set up test environment
@@ -155,7 +155,12 @@ export async function runPaymentAbortTest(t: 
GlobalTestState) {
 
   const txTypes = txns2.transactions.map((x) => x.type);
   console.log(txTypes);
-  t.assertDeepEqual(txTypes, ["withdrawal", "payment", "refund"]);
+  // No refund, as the deposit never reached the merchant.
+  t.assertDeepEqual(txTypes, ["withdrawal", "payment"]);
+
+  // FIXME: check a case where there is indeed a refund!
+  // That's easiest to simulate with two exchanges,
+  // where only one of them works.
 
   // FIXME: also check extended transaction list for refresh.
   // FIXME: also check balance
diff --git a/packages/taler-util/src/types-taler-merchant.ts 
b/packages/taler-util/src/types-taler-merchant.ts
index 316fa2302..eb6ec256c 100644
--- a/packages/taler-util/src/types-taler-merchant.ts
+++ b/packages/taler-util/src/types-taler-merchant.ts
@@ -297,7 +297,13 @@ export interface AbortResponse {
 
 export type MerchantAbortPayRefundStatus =
   | MerchantAbortPayRefundSuccessStatus
-  | MerchantAbortPayRefundFailureStatus;
+  | MerchantAbortPayRefundFailureStatus
+  | MerchantAbortPayRefundUndepositedStatus;
+
+export interface MerchantAbortPayRefundUndepositedStatus {
+  // Used as tag for the sum type RefundStatus sum type.
+  type: "undeposited";
+}
 
 // Details about why a refund failed.
 export interface MerchantAbortPayRefundFailureStatus {
@@ -2911,12 +2917,22 @@ export const 
codecForMerchantAbortPayRefundFailureStatus =
       .property("type", codecForConstString("failure"))
       .build("TalerMerchantApi.MerchantAbortPayRefundFailureStatus");
 
+export const codecForMerchantAbortPayRefundUndepositedStatus =
+  (): Codec<MerchantAbortPayRefundUndepositedStatus> =>
+    buildCodecForObject<MerchantAbortPayRefundUndepositedStatus>()
+      .property("type", codecForConstString("undeposited"))
+      .build("TalerMerchantApi.MerchantAbortPayRefundUndepositedStatus");
+
 export const codecForMerchantAbortPayRefundStatus =
   (): Codec<MerchantAbortPayRefundStatus> =>
     buildCodecForUnion<MerchantAbortPayRefundStatus>()
       .discriminateOn("type")
       .alternative("success", codecForMerchantAbortPayRefundSuccessStatus())
       .alternative("failure", codecForMerchantAbortPayRefundFailureStatus())
+      .alternative(
+        "undeposited",
+        codecForMerchantAbortPayRefundUndepositedStatus(),
+      )
       .build("TalerMerchantApi.MerchantAbortPayRefundStatus");
 
 export const codecForAbortResponse = (): Codec<AbortResponse> =>
@@ -3437,7 +3453,10 @@ export const codecForTokenFamilyDetails = (): 
Codec<TokenFamilyDetails> =>
     .property("slug", codecForString())
     .property("name", codecForString())
     .property("description", codecForString())
-    .property("description_i18n", 
codecOptional(codecForInternationalizedString()))
+    .property(
+      "description_i18n",
+      codecOptional(codecForInternationalizedString()),
+    )
     .property("valid_after", codecForTimestamp)
     .property("valid_before", codecForTimestamp)
     .property("duration", codecForDuration)
diff --git a/packages/taler-wallet-core/src/pay-merchant.ts 
b/packages/taler-wallet-core/src/pay-merchant.ts
index 360eea71e..17c3a16bd 100644
--- a/packages/taler-wallet-core/src/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/pay-merchant.ts
@@ -3424,6 +3424,9 @@ async function processPurchaseAbortingRefund(
 
   for (let i = 0; i < abortResp.refunds.length; i++) {
     const r = abortResp.refunds[i];
+    if (r.type === "undeposited") {
+      continue;
+    }
     refunds.push({
       ...r,
       coin_pub: payCoinSelection.coinPubs[i],
diff --git a/packages/taler-wallet-core/src/withdraw.ts 
b/packages/taler-wallet-core/src/withdraw.ts
index c2b4ae805..2753e28fe 100644
--- a/packages/taler-wallet-core/src/withdraw.ts
+++ b/packages/taler-wallet-core/src/withdraw.ts
@@ -3512,7 +3512,9 @@ export async function confirmWithdrawal(
       break;
     }
     if (!acceptable) {
-      throw Error("bank account not acceptable by the exchange");
+      // Might be acceptable if it's a withdrawal from a
+      // foreign account that is not properly marked as such.
+      logger.warn("no account acceptable by the exchange");
     }
 
     const bankAccountId = await wex.db.runReadWriteTx(

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