gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: allow http for taler withdraw


From: gnunet
Subject: [taler-wallet-core] branch master updated: allow http for taler withdraw URIs
Date: Mon, 27 Jul 2020 19:57: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 a4f1127e allow http for taler withdraw URIs
a4f1127e is described below

commit a4f1127e0adc4fca173a4b66419f87c0d387fb8a
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Mon Jul 27 23:27:32 2020 +0530

    allow http for taler withdraw URIs
---
 src/util/taleruri-test.ts | 11 +++++++++++
 src/util/taleruri.ts      | 10 ++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/util/taleruri-test.ts b/src/util/taleruri-test.ts
index 40a30bf7..314a981f 100644
--- a/src/util/taleruri-test.ts
+++ b/src/util/taleruri-test.ts
@@ -107,6 +107,17 @@ test("taler withdraw uri parsing", (t) => {
   t.is(r1.bankIntegrationApiBaseUrl, "https://bank.example.com/";);
 });
 
+test("taler withdraw uri parsing (http)", (t) => {
+  const url1 = "taler+http://withdraw/bank.example.com/12345";;
+  const r1 = parseWithdrawUri(url1);
+  if (!r1) {
+    t.fail();
+    return;
+  }
+  t.is(r1.withdrawalOperationId, "12345");
+  t.is(r1.bankIntegrationApiBaseUrl, "http://bank.example.com/";);
+});
+
 test("taler refund uri parsing", (t) => {
   const url1 = "taler://refund/merchant.example.com/1234";
   const r1 = parseRefundUri(url1);
diff --git a/src/util/taleruri.ts b/src/util/taleruri.ts
index 7e64dd4c..fd2cca6c 100644
--- a/src/util/taleruri.ts
+++ b/src/util/taleruri.ts
@@ -40,13 +40,11 @@ export interface TipUriResult {
  * Return undefined if not passed a valid URI.
  */
 export function parseWithdrawUri(s: string): WithdrawUriResult | undefined {
-  const pfx = "taler://withdraw/";
-  if (!s.toLowerCase().startsWith(pfx)) {
+  const pi = parseProtoInfo(s, "withdraw");
+  if (!pi) {
     return undefined;
   }
-
-  const rest = s.substring(pfx.length);
-  const parts = rest.split("/");
+  const parts = pi.rest.split("/");
 
   if (parts.length < 2) {
     return undefined;
@@ -58,7 +56,7 @@ export function parseWithdrawUri(s: string): 
WithdrawUriResult | undefined {
   const p = [host, ...pathSegments].join("/");
 
   return {
-    bankIntegrationApiBaseUrl: `https://${p}/`,
+    bankIntegrationApiBaseUrl: `${pi.innerProto}://${p}/`,
     withdrawalOperationId: withdrawId,
   };
 }

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