gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-wallet-webex] branch master updated (18010a7 -> 93e3


From: gnunet
Subject: [GNUnet-SVN] [taler-wallet-webex] branch master updated (18010a7 -> 93e3d52)
Date: Thu, 16 Feb 2017 23:22:01 +0100

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

dold pushed a change to branch master
in repository wallet-webex.

    from 18010a7  Using pyvirtualdisplay for headless selenium tests.
     new af6843a  always compile to strict mode
     new 93e3d52  remove repurchase correlation id

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 gulpfile.js                   |  1 +
 src/content_scripts/notify.ts | 75 +++++++++++++------------------------------
 src/types-test.ts             |  1 -
 src/types.ts                  | 13 --------
 src/wallet.ts                 | 33 -------------------
 src/wxBackend.ts              |  6 +---
 tsconfig.json                 |  3 +-
 7 files changed, 26 insertions(+), 106 deletions(-)

diff --git a/gulpfile.js b/gulpfile.js
index 62a4c08..025a67a 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -110,6 +110,7 @@ const tsBaseArgs = {
   noFallthroughCasesInSwitch: true,
   strictNullChecks: true,
   noImplicitAny: true,
+  alwaysStrict: true,
 };
 
 
diff --git a/src/content_scripts/notify.ts b/src/content_scripts/notify.ts
index 582375e..a731e4d 100644
--- a/src/content_scripts/notify.ts
+++ b/src/content_scripts/notify.ts
@@ -76,20 +76,6 @@ namespace TalerNotify {
     });
   }
 
-  function checkRepurchase(contract: string): Promise<any> {
-    const walletMsg = {
-      type: "check-repurchase",
-      detail: {
-        contract: contract
-      },
-    };
-    return new Promise((resolve, reject) => {
-      chrome.runtime.sendMessage(walletMsg, (resp: any) => {
-        resolve(resp);
-      });
-    });
-  }
-
   function queryPayment(query: any): Promise<any> {
     // current URL without fragment
     const walletMsg = {
@@ -239,49 +225,32 @@ namespace TalerNotify {
       return;
     }
 
-    let resp = await checkRepurchase(proposal.data);
-
-    if (resp.error) {
-      console.error("wallet backend error", resp);
-      return;
+    let merchantName = "(unknown)";
+    try {
+      merchantName = proposal.data.merchant.name;
+    } catch (e) {
+      // bad contract / name not included
     }
 
-    if (resp.isRepurchase) {
-      logVerbose && console.log("doing repurchase");
-      console.assert(resp.existingFulfillmentUrl);
-      console.assert(resp.existingContractHash);
-      window.location.href = subst(resp.existingFulfillmentUrl,
-                                   resp.existingContractHash);
-
-    } else {
-
-      let merchantName = "(unknown)";
-      try {
-        merchantName = proposal.data.merchant.name;
-      } catch (e) {
-        // bad contract / name not included
+    let historyEntry = {
+      timestamp: (new Date).getTime(),
+      subjectId: `contract-${contractHash}`,
+      type: "offer-contract",
+      detail: {
+        contractHash,
+        merchantName,
       }
+    };
+    await putHistory(historyEntry);
+    let offerId = await saveOffer(proposal);
 
-      let historyEntry = {
-        timestamp: (new Date).getTime(),
-        subjectId: `contract-${contractHash}`,
-        type: "offer-contract",
-        detail: {
-          contractHash,
-          merchantName,
-        }
-      };
-      await putHistory(historyEntry);
-      let offerId = await saveOffer(proposal);
-
-      const uri = URI(chrome.extension.getURL(
-        "/src/pages/confirm-contract.html"));
-      const params = {
-        offerId: offerId.toString(),
-      };
-      const target = uri.query(params).href();
-      document.location.replace(target);
-    }
+    const uri = URI(chrome.extension.getURL(
+      "/src/pages/confirm-contract.html"));
+    const params = {
+      offerId: offerId.toString(),
+    };
+    const target = uri.query(params).href();
+    document.location.replace(target);
   }
 
   function registerHandlers() {
diff --git a/src/types-test.ts b/src/types-test.ts
index f8f25bc..7298728 100644
--- a/src/types-test.ts
+++ b/src/types-test.ts
@@ -53,7 +53,6 @@ test("contract validation", (t: TestLib) => {
     timestamp: "Date(12345)",
     transaction_id: 1234,
     fulfillment_url: "foo",
-    repurchase_correlation_id: "blabla",
   };
 
   types.Contract.checked(c);
diff --git a/src/types.ts b/src/types.ts
index 30e9b78..28c989a 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -486,12 +486,6 @@ export class Contract {
   @Checkable.String
   fulfillment_url: string;
 
-  @Checkable.Optional(Checkable.String)
-  repurchase_correlation_id: string;
-
-  @Checkable.Optional(Checkable.String)
-  instance: string;
-
   @Checkable.Any
   extra: any;
 
@@ -614,13 +608,6 @@ export namespace Amounts {
 }
 
 
-export interface CheckRepurchaseResult {
-  isRepurchase: boolean;
-  existingContractHash?: string;
-  existingFulfillmentUrl?: string;
-}
-
-
 export interface Notifier {
   notify(): void;
 }
diff --git a/src/wallet.ts b/src/wallet.ts
index 67393ed..01d26c2 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -24,7 +24,6 @@
 import {
   AmountJson,
   Amounts,
-  CheckRepurchaseResult,
   CoinRecord,
   CoinPaySig,
   Contract,
@@ -349,10 +348,6 @@ export namespace Stores {
       super("transactions", {keyPath: "contractHash"});
     }
 
-    repurchaseIndex = new Index<[string,string],TransactionRecord>(this, 
"repurchase", [
-      "contract.merchant_pub",
-      "contract.repurchase_correlation_id"
-    ]);
     fulfillmentUrlIndex = new Index<string,TransactionRecord>(this, 
"fulfillment_url", "contract.fulfillment_url");
     orderIdIndex = new Index<string,TransactionRecord>(this, "order_id", 
"contract.order_id");
   }
@@ -1691,34 +1686,6 @@ export class Wallet {
     return this.cryptoApi.hashString(canonicalJson(contract));
   }
 
-  /**
-   * Check if there's an equivalent contract we've already purchased.
-   */
-  async checkRepurchase(contract: Contract): Promise<CheckRepurchaseResult> {
-    if (!contract.repurchase_correlation_id) {
-      console.log("no repurchase: no correlation id");
-      return {isRepurchase: false};
-    }
-    let result: TransactionRecord|undefined = await (
-      this.q()
-          .getIndexed(Stores.transactions.repurchaseIndex,
-                      [
-                        contract.merchant_pub,
-                        contract.repurchase_correlation_id
-                      ]));
-
-    if (result) {
-      console.assert(result.contract.repurchase_correlation_id == 
contract.repurchase_correlation_id);
-      return {
-        isRepurchase: true,
-        existingContractHash: result.contractHash,
-        existingFulfillmentUrl: result.contract.fulfillment_url,
-      };
-    } else {
-      return {isRepurchase: false};
-    }
-  }
-
 
   /**
    * Generate a nonce in form of an EdDSA public key.
diff --git a/src/wxBackend.ts b/src/wxBackend.ts
index cdc8f43..5957e1e 100644
--- a/src/wxBackend.ts
+++ b/src/wxBackend.ts
@@ -35,7 +35,7 @@ import * as logging from "./logging";
 "use strict";
 
 const DB_NAME = "taler";
-const DB_VERSION = 14;
+const DB_VERSION = 15;
 
 import {Stores} from "./wallet";
 import {Store, Index} from "./query";
@@ -194,10 +194,6 @@ function makeHandlers(db: IDBDatabase,
       let amount = AmountJson.checked(detail.amount);
       return wallet.getReserveCreationInfo(detail.baseUrl, amount);
     },
-    ["check-repurchase"]: function (detail, sender) {
-      let contract = Contract.checked(detail.contract);
-      return wallet.checkRepurchase(contract);
-    },
     ["get-history"]: function (detail, sender) {
       // TODO: limit history length
       return wallet.getHistory();
diff --git a/tsconfig.json b/tsconfig.json
index 1bff3f8..417068d 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -10,7 +10,8 @@
     "noImplicitReturns": true,
     "noFallthroughCasesInSwitch": true,
     "strictNullChecks": true,
-    "noImplicitAny": true
+    "noImplicitAny": true,
+    "alwaysStrict": true
   },
   "files": [
     "decl/chrome/chrome.d.ts",

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



reply via email to

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