gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-wallet-core] branch master updated: adapt to instanc


From: gnunet
Subject: [GNUnet-SVN] [taler-wallet-core] branch master updated: adapt to instance changes
Date: Tue, 01 Oct 2019 20:56:38 +0200

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 1a23fbcb adapt to instance changes
1a23fbcb is described below

commit 1a23fbcb4fdad661feb9ea923761f7e02d7f6e8d
Author: Florian Dold <address@hidden>
AuthorDate: Tue Oct 1 20:45:36 2019 +0200

    adapt to instance changes
---
 Makefile                         |   2 +-
 package.json                     |   2 +-
 src/headless/integrationtest.ts  |   2 -
 src/headless/merchant.ts         |   4 +-
 src/headless/taler-wallet-cli.ts |  11 +----
 src/taleruri-test.ts             |  31 ++++++++++--
 src/taleruri.ts                  |  15 +++---
 src/wallet.ts                    |   5 +-
 yarn.lock                        | 100 +++++++++++++++++++++++++++++----------
 9 files changed, 115 insertions(+), 57 deletions(-)

diff --git a/Makefile b/Makefile
index 6fdb2552..b448f3a2 100644
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,7 @@ clean:
 
 .PHONY: check
 check: tsc yarn-install
-       $(ava) 'dist/node/**/*-test.js'
+       find dist/node -name '*-test.js' | xargs $(ava)
 
 .PHONY: coverage
 coverage: tsc yarn-install
diff --git a/package.json b/package.json
index a6b83ff1..1f5df728 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
   "devDependencies": {
     "@types/react": "^16.4.0",
     "@types/react-dom": "^16.0.0",
-    "ava": "^2.3.0",
+    "ava": "^2.4.0",
     "awesome-typescript-loader": "^5.2.1",
     "glob": "^7.1.1",
     "gulp": "^4.0.0",
diff --git a/src/headless/integrationtest.ts b/src/headless/integrationtest.ts
index a692cabd..6b328690 100644
--- a/src/headless/integrationtest.ts
+++ b/src/headless/integrationtest.ts
@@ -28,7 +28,6 @@ export async function runIntegrationTest(args: {
   bankBaseUrl: string;
   merchantBaseUrl: string;
   merchantApiKey: string;
-  merchantInstance: string;
   amountToWithdraw: string;
   amountToSpend: string;
 }) {
@@ -42,7 +41,6 @@ export async function runIntegrationTest(args: {
 
   const myMerchant = new MerchantBackendConnection(
     args.merchantBaseUrl,
-    args.merchantInstance,
     args.merchantApiKey,
   );
 
diff --git a/src/headless/merchant.ts b/src/headless/merchant.ts
index 4861a7d2..889eb2d6 100644
--- a/src/headless/merchant.ts
+++ b/src/headless/merchant.ts
@@ -32,7 +32,6 @@ import URI = require("urijs");
 export class MerchantBackendConnection {
   constructor(
     public merchantBaseUrl: string,
-    public merchantInstance: string,
     public apiKey: string,
   ) {}
 
@@ -47,7 +46,6 @@ export class MerchantBackendConnection {
         amount,
         summary,
         fulfillment_url: fulfillmentUrl,
-        instance: this.merchantInstance,
       },
     };
     const resp = await axios({
@@ -76,7 +74,7 @@ export class MerchantBackendConnection {
     const resp = await axios({
       method: "get",
       url: reqUrl,
-      params: { order_id: orderId, instance: this.merchantInstance },
+      params: { order_id: orderId },
       responseType: "json",
       headers: {
         Authorization: `ApiKey ${this.apiKey}`,
diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts
index 7d4acb2f..8c31e67d 100644
--- a/src/headless/taler-wallet-cli.ts
+++ b/src/headless/taler-wallet-cli.ts
@@ -114,8 +114,7 @@ program
     applyVerbose(program.verbose);
     console.log("creating order");
     const merchantBackend = new MerchantBackendConnection(
-      "https://backend.test.taler.net";,
-      "default",
+      "https://backend.test.taler.net/";,
       "sandbox",
     );
     const orderResp = await merchantBackend.createOrder(
@@ -289,12 +288,7 @@ program
     "https://backend.test.taler.net/";,
   )
   .option(
-    "-m, --merchant-instance <merchant-instance>",
-    "merchant instance",
-    "default",
-  )
-  .option(
-    "-m, --merchant-api-key <merchant-api-key>",
+    "-k, --merchant-api-key <merchant-api-key>",
     "merchant API key",
     "sandbox",
   )
@@ -321,7 +315,6 @@ program
         exchangeBaseUrl: cmdObj.exchange,
         merchantApiKey: cmdObj.merchantApiKey,
         merchantBaseUrl: cmdObj.merchant,
-        merchantInstance: cmdObj.merchantInstance,
       }).catch(err => {
         console.error("Failed with exception:");
         console.error(err);
diff --git a/src/taleruri-test.ts b/src/taleruri-test.ts
index 27cd7d18..8b5828b7 100644
--- a/src/taleruri-test.ts
+++ b/src/taleruri-test.ts
@@ -53,7 +53,7 @@ test("taler pay url parsing: defaults", (t) => {
     t.fail();
     return;
   }
-  t.is(r1.downloadUrl, 
"https://example.com/public/proposal?instance=default&order_id=myorder";);
+  t.is(r1.downloadUrl, "https://example.com/public/proposal?order_id=myorder";);
   t.is(r1.sessionId, undefined);
 
   const url2 = "taler://pay/example.com/-/-/myorder/mysession";
@@ -62,7 +62,7 @@ test("taler pay url parsing: defaults", (t) => {
     t.fail();
     return;
   }
-  t.is(r2.downloadUrl, 
"https://example.com/public/proposal?instance=default&order_id=myorder";);
+  t.is(r2.downloadUrl, "https://example.com/public/proposal?order_id=myorder";);
   t.is(r2.sessionId, "mysession");
 });
 
@@ -74,10 +74,33 @@ test("taler pay url parsing: trailing parts", (t) => {
     t.fail();
     return;
   }
-  t.is(r1.downloadUrl, 
"https://example.com/public/proposal?instance=default&order_id=myorder";);
+  t.is(r1.downloadUrl, "https://example.com/public/proposal?order_id=myorder";);
   t.is(r1.sessionId, "mysession");
 });
 
+
+test("taler pay url parsing: instance", (t) => {
+  const url1 = "taler://pay/example.com/-/myinst/myorder";
+  const r1 = parsePayUri(url1);
+  if (!r1) {
+    t.fail();
+    return;
+  }
+  t.is(r1.downloadUrl, 
"https://example.com/instances/myinst/public/proposal?order_id=myorder";);
+});
+
+
+test("taler pay url parsing: path prefix and instance", (t) => {
+  const url1 = "taler://pay/example.com/mypfx/myinst/myorder";
+  const r1 = parsePayUri(url1);
+  if (!r1) {
+    t.fail();
+    return;
+  }
+  t.is(r1.downloadUrl, 
"https://example.com/mypfx/instances/myinst/public/proposal?order_id=myorder";);
+});
+
+
 test("taler withdraw uri parsing", (t) => {
   const url1 = "taler://withdraw/bank.example.com/-/12345";
   const r1 = parseWithdrawUri(url1);
@@ -86,4 +109,4 @@ test("taler withdraw uri parsing", (t) => {
     return;
   }
   t.is(r1.statusUrl, "https://bank.example.com/api/withdraw-operation/12345";);
-});
\ No newline at end of file
+});
diff --git a/src/taleruri.ts b/src/taleruri.ts
index bd01abb6..0d68621b 100644
--- a/src/taleruri.ts
+++ b/src/taleruri.ts
@@ -96,18 +96,19 @@ export function parsePayUri(s: string): PayUriResult | 
undefined {
   }
 
   if (maybePath === "-") {
-    maybePath = "public/proposal";
+    maybePath = "";
   } else {
-    maybePath = decodeURIComponent(maybePath);
+    maybePath = decodeURIComponent(maybePath) + "/";
   }
-  if (maybeInstance === "-") {
-    maybeInstance = "default";
+  let maybeInstancePath = "";
+  if (maybeInstance !== "-") {
+    maybeInstancePath = `instances/${maybeInstance}/`;
   }
 
   const downloadUrl = new URI(
-    "https://"; + host + "/" + decodeURIComponent(maybePath),
+    "https://"; + host + "/" + decodeURIComponent(maybePath) + 
maybeInstancePath + "public/proposal",
   )
-    .addQuery({ instance: maybeInstance, order_id: orderId })
+    .addQuery({ order_id: orderId })
     .href();
 
   return {
@@ -207,4 +208,4 @@ export function parseRefundUri(s: string): RefundUriResult 
| undefined {
   return {
     refundUrl,
   };
-}
\ No newline at end of file
+}
diff --git a/src/wallet.ts b/src/wallet.ts
index 175a6dba..25857870 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -3467,10 +3467,7 @@ export class Wallet {
     }
 
     const tipStatusUrl = new URI(res.tipPickupUrl)
-      .addQuery({
-        instance: res.merchantInstance,
-        tip_id: res.tipId,
-      })
+      .addQuery({ tip_id: res.tipId })
       .href();
     console.log("checking tip status from", tipStatusUrl);
     const merchantResp = await this.http.get(tipStatusUrl);
diff --git a/yarn.lock b/yarn.lock
index 63cf700a..31f7d3ef 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -33,18 +33,18 @@
   dependencies:
     "@babel/highlight" "^7.0.0"
 
-"@babel/core@^7.5.5":
-  version "7.5.5"
-  resolved 
"https://registry.yarnpkg.com/@babel/core/-/core-7.5.5.tgz#17b2686ef0d6bc58f963dddd68ab669755582c30";
-  integrity 
sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg==
+"@babel/core@^7.6.0":
+  version "7.6.2"
+  resolved 
"https://registry.yarnpkg.com/@babel/core/-/core-7.6.2.tgz#069a776e8d5e9eefff76236bc8845566bd31dd91";
+  integrity 
sha512-l8zto/fuoZIbncm+01p8zPSDZu/VuuJhAfA7d/AbzM09WR7iVhavvfNDYCNpo1VvLk6E6xgAoP9P+/EMJHuRkQ==
   dependencies:
     "@babel/code-frame" "^7.5.5"
-    "@babel/generator" "^7.5.5"
-    "@babel/helpers" "^7.5.5"
-    "@babel/parser" "^7.5.5"
-    "@babel/template" "^7.4.4"
-    "@babel/traverse" "^7.5.5"
-    "@babel/types" "^7.5.5"
+    "@babel/generator" "^7.6.2"
+    "@babel/helpers" "^7.6.2"
+    "@babel/parser" "^7.6.2"
+    "@babel/template" "^7.6.0"
+    "@babel/traverse" "^7.6.2"
+    "@babel/types" "^7.6.0"
     convert-source-map "^1.1.0"
     debug "^4.1.0"
     json5 "^2.1.0"
@@ -64,6 +64,16 @@
     source-map "^0.5.0"
     trim-right "^1.0.1"
 
+"@babel/generator@^7.6.0", "@babel/generator@^7.6.2":
+  version "7.6.2"
+  resolved 
"https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.2.tgz#dac8a3c2df118334c2a29ff3446da1636a8f8c03";
+  integrity 
sha512-j8iHaIW4gGPnViaIHI7e9t/Hl8qLjERI6DcV9kEpAIDJsAOrcnXqRS7t+QbhL76pwbtqP+QCQLL0z1CyVmtjjQ==
+  dependencies:
+    "@babel/types" "^7.6.0"
+    jsesc "^2.5.1"
+    lodash "^4.17.13"
+    source-map "^0.5.0"
+
 "@babel/helper-annotate-as-pure@^7.0.0":
   version "7.0.0"
   resolved 
"https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32";
@@ -154,14 +164,14 @@
     "@babel/traverse" "^7.1.0"
     "@babel/types" "^7.2.0"
 
-"@babel/helpers@^7.5.5":
-  version "7.5.5"
-  resolved 
"https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.5.5.tgz#63908d2a73942229d1e6685bc2a0e730dde3b75e";
-  integrity 
sha512-nRq2BUhxZFnfEn/ciJuhklHvFOqjJUD5wpx+1bxUF2axL9C+v4DE/dmp5sT2dKnpOs4orZWzpAZqlCy8QqE/7g==
+"@babel/helpers@^7.6.2":
+  version "7.6.2"
+  resolved 
"https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.6.2.tgz#681ffe489ea4dcc55f23ce469e58e59c1c045153";
+  integrity 
sha512-3/bAUL8zZxYs1cdX2ilEE0WobqbCmKWr/889lf2SS0PpDcpEIY8pb1CCyz0pEcX3pEb+MCbks1jIokz2xLtGTA==
   dependencies:
-    "@babel/template" "^7.4.4"
-    "@babel/traverse" "^7.5.5"
-    "@babel/types" "^7.5.5"
+    "@babel/template" "^7.6.0"
+    "@babel/traverse" "^7.6.2"
+    "@babel/types" "^7.6.0"
 
 "@babel/highlight@^7.0.0":
   version "7.5.0"
@@ -177,6 +187,11 @@
   resolved 
"https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b";
   integrity 
sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g==
 
+"@babel/parser@^7.6.0", "@babel/parser@^7.6.2":
+  version "7.6.2"
+  resolved 
"https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.2.tgz#205e9c95e16ba3b8b96090677a67c9d6075b70a1";
+  integrity 
sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg==
+
 "@babel/plugin-proposal-async-generator-functions@^7.2.0":
   version "7.2.0"
   resolved 
"https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e";
@@ -251,7 +266,16 @@
     "@babel/parser" "^7.4.4"
     "@babel/types" "^7.4.4"
 
-"@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.5.5":
+"@babel/template@^7.6.0":
+  version "7.6.0"
+  resolved 
"https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6";
+  integrity 
sha512-5AEH2EXD8euCk446b7edmgFdub/qfH1SN6Nii3+fyXP807QRx9Q73A2N5hNwRRslC2H9sNzaFhsPubkS4L8oNQ==
+  dependencies:
+    "@babel/code-frame" "^7.0.0"
+    "@babel/parser" "^7.6.0"
+    "@babel/types" "^7.6.0"
+
+"@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3":
   version "7.5.5"
   resolved 
"https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.5.tgz#f664f8f368ed32988cd648da9f72d5ca70f165bb";
   integrity 
sha512-MqB0782whsfffYfSjH4TM+LMjrJnhCNEDMDIjeTpl+ASaUvxcjoiVCo/sM1GhS1pHOXYfWVCYneLjMckuUxDaQ==
@@ -266,6 +290,21 @@
     globals "^11.1.0"
     lodash "^4.17.13"
 
+"@babel/traverse@^7.6.2":
+  version "7.6.2"
+  resolved 
"https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.2.tgz#b0e2bfd401d339ce0e6c05690206d1e11502ce2c";
+  integrity 
sha512-8fRE76xNwNttVEF2TwxJDGBLWthUkHWSldmfuBzVRmEDWOtu4XdINTgN7TDWzuLg4bbeIMLvfMFD9we5YcWkRQ==
+  dependencies:
+    "@babel/code-frame" "^7.5.5"
+    "@babel/generator" "^7.6.2"
+    "@babel/helper-function-name" "^7.1.0"
+    "@babel/helper-split-export-declaration" "^7.4.4"
+    "@babel/parser" "^7.6.2"
+    "@babel/types" "^7.6.0"
+    debug "^4.1.0"
+    globals "^11.1.0"
+    lodash "^4.17.13"
+
 "@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.4.0", 
"@babel/types@^7.4.4", "@babel/types@^7.5.5":
   version "7.5.5"
   resolved 
"https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a";
@@ -275,6 +314,15 @@
     lodash "^4.17.13"
     to-fast-properties "^2.0.0"
 
+"@babel/types@^7.6.0":
+  version "7.6.1"
+  resolved 
"https://registry.yarnpkg.com/@babel/types/-/types-7.6.1.tgz#53abf3308add3ac2a2884d539151c57c4b3ac648";
+  integrity 
sha512-X7gdiuaCmA0uRjCmRtYJNAVCc/q+5xSgsfKJHqMN4iNLILX39677fJE1O40arPMh0TTtS9ItH67yre6c7k6t0g==
+  dependencies:
+    esutils "^2.0.2"
+    lodash "^4.17.13"
+    to-fast-properties "^2.0.0"
+
 "@concordance/react@^2.0.0":
   version "2.0.0"
   resolved 
"https://registry.yarnpkg.com/@concordance/react/-/react-2.0.0.tgz#aef913f27474c53731f4fd79cc2f54897de90fde";
@@ -637,7 +685,7 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1:
   dependencies:
     color-convert "^1.9.0"
 
-ansi-styles@^4.0.0:
+ansi-styles@^4.1.0:
   version "4.1.0"
   resolved 
"https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.1.0.tgz#d3ba8047b818293eaaa7978321dd61bff9842cfc";
   integrity 
sha512-Qts4KCLKG+waHc9C4m07weIY8qyeixoS0h6RnbsNVD6Fw+pEZGW3vTyObL3WXpE09Mq4Oi7/lBEyLmOiLtlYWQ==
@@ -919,18 +967,18 @@ atob@^2.1.1:
   resolved 
"https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9";
   integrity 
sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
 
-ava@^2.3.0:
-  version "2.3.0"
-  resolved 
"https://registry.yarnpkg.com/ava/-/ava-2.3.0.tgz#cac4d7f0a30077a852c6bf5bc7c0bc78c3021e63";
-  integrity 
sha512-4VaaSnl13vpTZmqW3aMqioSolT0/ozRkjQxTLi3p8wtyRONuX/uLKL3uF0j50w2BNRoLsJqztnkX2h8xeVp2lg==
+ava@^2.4.0:
+  version "2.4.0"
+  resolved 
"https://registry.yarnpkg.com/ava/-/ava-2.4.0.tgz#a3bd8b0e01d8826004c91de375eb2313ba5237c3";
+  integrity 
sha512-CQWtzZZZeU2g4StojRv6MO9RIRi4sLxGSB9+3C3hv0ttUEG1tkJLTLyrBQeFS4WEeK12Z4ovE3f2iPVhSy8elA==
   dependencies:
     "@ava/babel-preset-stage-4" "^4.0.0"
     "@ava/babel-preset-transform-test-files" "^6.0.0"
-    "@babel/core" "^7.5.5"
-    "@babel/generator" "^7.5.5"
+    "@babel/core" "^7.6.0"
+    "@babel/generator" "^7.6.0"
     "@concordance/react" "^2.0.0"
     ansi-escapes "^4.2.1"
-    ansi-styles "^4.0.0"
+    ansi-styles "^4.1.0"
     arr-flatten "^1.1.0"
     array-union "^2.1.0"
     array-uniq "^2.1.0"

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



reply via email to

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