gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: handle multiple refresh sessi


From: gnunet
Subject: [taler-wallet-core] branch master updated: handle multiple refresh sessions correctly for refunded coins
Date: Sat, 02 Nov 2019 00:22:59 +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 8f973c69 handle multiple refresh sessions correctly for refunded coins
8f973c69 is described below

commit 8f973c69c4b84f455634f03e931304a3babde0ee
Author: Florian Dold <address@hidden>
AuthorDate: Sat Nov 2 00:22:55 2019 +0100

    handle multiple refresh sessions correctly for refunded coins
---
 src/i18n/de.po                  | 10 +++++-----
 src/i18n/en-US.po               | 10 +++++-----
 src/i18n/fr.po                  | 10 +++++-----
 src/i18n/it.po                  | 10 +++++-----
 src/i18n/sv.po                  | 10 +++++-----
 src/i18n/taler-wallet-webex.pot | 10 +++++-----
 src/talerTypes.ts               |  6 ++++++
 src/wallet.ts                   | 41 ++++++++++++++++++++++++++++++++---------
 src/walletTypes.ts              |  4 ++++
 9 files changed, 72 insertions(+), 39 deletions(-)

diff --git a/src/i18n/de.po b/src/i18n/de.po
index 7358c550..0181420a 100644
--- a/src/i18n/de.po
+++ b/src/i18n/de.po
@@ -37,27 +37,27 @@ msgstr ""
 msgid "time (ms/op)"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:113
+#: src/webex/pages/pay.tsx:118
 #, fuzzy, c-format
 msgid "The merchant %1$s offers you to purchase:"
 msgstr "Der Händler %1$s möchte einen Vertrag über %2$s mit Ihnen abschließen."
 
-#: src/webex/pages/pay.tsx:119
+#: src/webex/pages/pay.tsx:124
 #, c-format
 msgid "The total price is %1$s (plus %2$s fees)."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:124
+#: src/webex/pages/pay.tsx:129
 #, c-format
 msgid "The total price is %1$s."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:138
+#: src/webex/pages/pay.tsx:149
 #, c-format
 msgid "Retry"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:146
+#: src/webex/pages/pay.tsx:158
 #, fuzzy, c-format
 msgid "Confirm payment"
 msgstr "Bezahlung bestätigen"
diff --git a/src/i18n/en-US.po b/src/i18n/en-US.po
index 508a1f1f..fd4a9c98 100644
--- a/src/i18n/en-US.po
+++ b/src/i18n/en-US.po
@@ -37,27 +37,27 @@ msgstr ""
 msgid "time (ms/op)"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:113
+#: src/webex/pages/pay.tsx:118
 #, c-format
 msgid "The merchant %1$s offers you to purchase:"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:119
+#: src/webex/pages/pay.tsx:124
 #, c-format
 msgid "The total price is %1$s (plus %2$s fees)."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:124
+#: src/webex/pages/pay.tsx:129
 #, c-format
 msgid "The total price is %1$s."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:138
+#: src/webex/pages/pay.tsx:149
 #, c-format
 msgid "Retry"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:146
+#: src/webex/pages/pay.tsx:158
 #, c-format
 msgid "Confirm payment"
 msgstr ""
diff --git a/src/i18n/fr.po b/src/i18n/fr.po
index 56eee1dd..bbc02869 100644
--- a/src/i18n/fr.po
+++ b/src/i18n/fr.po
@@ -37,27 +37,27 @@ msgstr ""
 msgid "time (ms/op)"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:113
+#: src/webex/pages/pay.tsx:118
 #, c-format
 msgid "The merchant %1$s offers you to purchase:"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:119
+#: src/webex/pages/pay.tsx:124
 #, c-format
 msgid "The total price is %1$s (plus %2$s fees)."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:124
+#: src/webex/pages/pay.tsx:129
 #, c-format
 msgid "The total price is %1$s."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:138
+#: src/webex/pages/pay.tsx:149
 #, c-format
 msgid "Retry"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:146
+#: src/webex/pages/pay.tsx:158
 #, c-format
 msgid "Confirm payment"
 msgstr ""
diff --git a/src/i18n/it.po b/src/i18n/it.po
index 56eee1dd..bbc02869 100644
--- a/src/i18n/it.po
+++ b/src/i18n/it.po
@@ -37,27 +37,27 @@ msgstr ""
 msgid "time (ms/op)"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:113
+#: src/webex/pages/pay.tsx:118
 #, c-format
 msgid "The merchant %1$s offers you to purchase:"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:119
+#: src/webex/pages/pay.tsx:124
 #, c-format
 msgid "The total price is %1$s (plus %2$s fees)."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:124
+#: src/webex/pages/pay.tsx:129
 #, c-format
 msgid "The total price is %1$s."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:138
+#: src/webex/pages/pay.tsx:149
 #, c-format
 msgid "Retry"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:146
+#: src/webex/pages/pay.tsx:158
 #, c-format
 msgid "Confirm payment"
 msgstr ""
diff --git a/src/i18n/sv.po b/src/i18n/sv.po
index c1c0d456..dd546b77 100644
--- a/src/i18n/sv.po
+++ b/src/i18n/sv.po
@@ -37,27 +37,27 @@ msgstr ""
 msgid "time (ms/op)"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:113
+#: src/webex/pages/pay.tsx:118
 #, fuzzy, c-format
 msgid "The merchant %1$s offers you to purchase:"
 msgstr "Säljaren %1$s erbjuder följande:"
 
-#: src/webex/pages/pay.tsx:119
+#: src/webex/pages/pay.tsx:124
 #, fuzzy, c-format
 msgid "The total price is %1$s (plus %2$s fees)."
 msgstr "Det totala priset är %1$s (plus %2$s avgifter).\n"
 
-#: src/webex/pages/pay.tsx:124
+#: src/webex/pages/pay.tsx:129
 #, fuzzy, c-format
 msgid "The total price is %1$s."
 msgstr "Det totala priset är %1$s."
 
-#: src/webex/pages/pay.tsx:138
+#: src/webex/pages/pay.tsx:149
 #, c-format
 msgid "Retry"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:146
+#: src/webex/pages/pay.tsx:158
 #, c-format
 msgid "Confirm payment"
 msgstr "Godkän betalning"
diff --git a/src/i18n/taler-wallet-webex.pot b/src/i18n/taler-wallet-webex.pot
index 56eee1dd..bbc02869 100644
--- a/src/i18n/taler-wallet-webex.pot
+++ b/src/i18n/taler-wallet-webex.pot
@@ -37,27 +37,27 @@ msgstr ""
 msgid "time (ms/op)"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:113
+#: src/webex/pages/pay.tsx:118
 #, c-format
 msgid "The merchant %1$s offers you to purchase:"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:119
+#: src/webex/pages/pay.tsx:124
 #, c-format
 msgid "The total price is %1$s (plus %2$s fees)."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:124
+#: src/webex/pages/pay.tsx:129
 #, c-format
 msgid "The total price is %1$s."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:138
+#: src/webex/pages/pay.tsx:149
 #, c-format
 msgid "Retry"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:146
+#: src/webex/pages/pay.tsx:158
 #, c-format
 msgid "Confirm payment"
 msgstr ""
diff --git a/src/talerTypes.ts b/src/talerTypes.ts
index e28b35c7..ebb13f4a 100644
--- a/src/talerTypes.ts
+++ b/src/talerTypes.ts
@@ -388,6 +388,12 @@ export class ContractTerms {
   @Checkable.String(timestampCheck)
   refund_deadline: string;
 
+    /**
+   * Deadline for the wire transfer.
+   */
+  @Checkable.String(timestampCheck)
+  wire_transfer_deadline: string;
+
   /**
    * Time when the contract was generated by the merchant.
    */
diff --git a/src/wallet.ts b/src/wallet.ts
index 29475cc7..244a4f22 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -114,6 +114,7 @@ import {
   parseTipUri,
   parseRefundUri,
 } from "./taleruri";
+import { isFirefox } from "./webex/compat";
 
 interface SpeculativePayData {
   payCoinInfo: PayCoinInfo;
@@ -965,7 +966,9 @@ export class Wallet {
     let resp;
     const payReq = { ...purchase.payReq, session_id: sessionId };
 
-    const payUrl = new 
URI("pay").absoluteTo(purchase.contractTerms.merchant_base_url).href()
+    const payUrl = new URI("pay")
+      .absoluteTo(purchase.contractTerms.merchant_base_url)
+      .href();
 
     try {
       resp = await this.http.postJson(payUrl, payReq);
@@ -1925,10 +1928,16 @@ export class Wallet {
         !versionMatch.compatible &&
         versionMatch.currentCmp === -1
       ) {
-        console.log("wallet version might be outdated, checking for updates");
-        chrome.runtime.requestUpdateCheck((status, details) => {
-          console.log("update check status:", status);
-        });
+        console.warn(
+          `wallet version ${WALLET_PROTOCOL_VERSION} might be outdated 
(exchange has ${exchangeInfo.protocolVersion}), checking for updates`,
+        );
+        if (!isFirefox()) {
+          console.log("skipping update check on Firefox")
+        } else {
+          chrome.runtime.requestUpdateCheck((status, details) => {
+            console.log("update check status:", status);
+          });
+        }
       }
     }
 
@@ -2215,6 +2224,9 @@ export class Wallet {
         paybackAmount: z,
         pendingIncoming: z,
         pendingPayment: z,
+        pendingIncomingDirty: z,
+        pendingIncomingRefresh: z,
+        pendingIncomingWithdraw: z,
       };
       let entryCurr = balance.byCurrency[amount.currency];
       if (!entryCurr) {
@@ -2240,6 +2252,7 @@ export class Wallet {
       }
       if (c.status === CoinStatus.Dirty) {
         addTo(balance, "pendingIncoming", c.currentAmount, c.exchangeBaseUrl);
+        addTo(balance, "pendingIncomingDirty", c.currentAmount, 
c.exchangeBaseUrl);
         return balance;
       }
       return balance;
@@ -2259,6 +2272,7 @@ export class Wallet {
       amount = Amounts.add(amount, r.precoin_amount).amount;
       if (Amounts.cmp(smallestWithdraw[r.exchange_base_url], amount) < 0) {
         addTo(balance, "pendingIncoming", amount, r.exchange_base_url);
+        addTo(balance, "pendingIncomingWithdraw", amount, r.exchange_base_url);
       }
       return balance;
     }
@@ -2286,6 +2300,7 @@ export class Wallet {
         return balance;
       }
       addTo(balance, "pendingIncoming", r.valueOutput, r.exchangeBaseUrl);
+      addTo(balance, "pendingIncomingRefresh", r.valueOutput, 
r.exchangeBaseUrl);
 
       return balance;
     }
@@ -2340,6 +2355,7 @@ export class Wallet {
     tx.iter(Stores.reserves).fold(collectPaybacks, balanceStore);
     tx.iter(Stores.purchases).fold(collectPayments, balanceStore);
     await tx.finish();
+    console.log("computed balances:", balanceStore)
     return balanceStore;
   }
 
@@ -2443,9 +2459,12 @@ export class Wallet {
         .iter(Stores.refresh)
         .toArray();
       for (const session of oldRefreshSessions) {
+        if (session.finished) {
+          continue;
+        }
         Wallet.enableTracing &&
-          console.log("got old refresh session for", oldCoinPub, session);
-        return this.continueRefreshSession(session);
+          console.log("waiting for unfinished old refresh session for", 
oldCoinPub, session);
+        await this.continueRefreshSession(session);
       }
       const coin = await this.q().get(Stores.coins, oldCoinPub);
       if (!coin) {
@@ -2456,6 +2475,7 @@ export class Wallet {
         coin.status === CoinStatus.Useless ||
         coin.status === CoinStatus.Fresh
       ) {
+        Wallet.enableTracing && console.log("not refreshing due to coin 
status", CoinStatus[coin.status])
         return;
       }
       const refreshSession = await this.createRefreshSession(oldCoinPub);
@@ -3034,7 +3054,8 @@ export class Wallet {
       merchant: {},
       merchant_pub: pub,
       order_id: "none",
-      pay_deadline: `/Date(${stampSecNow + 60 * 5})/`,
+      pay_deadline: `/Date(${stampSecNow + 30 * 5})/`,
+      wire_transfer_deadline: `/Date(${stampSecNow + 60 * 5})/`,
       merchant_base_url: "taler://return-to-account",
       products: [],
       refund_deadline: `/Date(${stampSecNow + 60 * 5})/`,
@@ -3552,7 +3573,9 @@ export class Wallet {
 
     const abortReq = { ...purchase.payReq, mode: "abort-refund" };
 
-    const payUrl = new 
URI("pay").absoluteTo(purchase.contractTerms.merchant_base_url).href()
+    const payUrl = new URI("pay")
+      .absoluteTo(purchase.contractTerms.merchant_base_url)
+      .href();
 
     try {
       resp = await this.http.postJson(payUrl, abortReq);
diff --git a/src/walletTypes.ts b/src/walletTypes.ts
index d29e3812..fddf0568 100644
--- a/src/walletTypes.ts
+++ b/src/walletTypes.ts
@@ -187,6 +187,10 @@ export interface WalletBalanceEntry {
    * Amount that was paid back and we could withdraw again.
    */
   paybackAmount: AmountJson;
+
+  pendingIncomingWithdraw: AmountJson;
+  pendingIncomingRefresh: AmountJson;
+  pendingIncomingDirty: AmountJson;
 }
 
 /**

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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