gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-web-common] branch master updated (d7e0135 -> 22a842


From: gnunet
Subject: [GNUnet-SVN] [taler-web-common] branch master updated (d7e0135 -> 22a8423)
Date: Wed, 26 Apr 2017 00:46:30 +0200

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

dold pushed a change to branch master
in repository web-common.

    from d7e0135  auditor calls
     new 952ae92  substitutions aren't valid in fulfillment URL anymore
     new 22a8423  pass merchant signature for payment success to wallet

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:
 taler-wallet-lib.js | 20 ++++++++------------
 taler-wallet-lib.ts | 21 ++++++++-------------
 2 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/taler-wallet-lib.js b/taler-wallet-lib.js
index b160918..fd2845f 100644
--- a/taler-wallet-lib.js
+++ b/taler-wallet-lib.js
@@ -122,12 +122,7 @@ var taler;
         callWallet("taler-create-reserve", args);
     }
     taler.createReserve = createReserve;
-    function handlePaymentResponse(resp) {
-        function subst(url, contractHash) {
-            url = url.replace("${H_contract}", contractHash);
-            url = url.replace("${$}", "$");
-            return url;
-        }
+    function handlePaymentResponse(walletResp) {
         /**
          * Handle a failed payment.
          *
@@ -150,10 +145,10 @@ var taler;
                 timeoutHandle = null;
                 err();
             }
-            callWallet("taler-payment-failed", { H_contract: resp.H_contract 
}, onResp);
+            callWallet("taler-payment-failed", { H_contract: 
walletResp.H_contract }, onResp);
             timeoutHandle = setTimeout(onTimeout, 200);
         }
-        logVerbose && console.log("handling taler-notify-payment: ", resp);
+        logVerbose && console.log("handling taler-notify-payment: ", 
walletResp);
         // Payment timeout in ms.
         var timeout_ms = 1000;
         // Current request.
@@ -161,18 +156,19 @@ var taler;
         var timeoutHandle = null;
         function sendPay() {
             r = new XMLHttpRequest();
-            r.open("post", resp.contract.pay_url);
+            r.open("post", walletResp.contract.pay_url);
             r.setRequestHeader("Content-Type", 
"application/json;charset=UTF-8");
-            r.send(JSON.stringify(resp.payReq));
+            r.send(JSON.stringify(walletResp.payReq));
             r.onload = function () {
                 if (!r) {
                     return;
                 }
                 switch (r.status) {
                     case 200:
+                        var merchantResp = JSON.parse(r.responseText);
                         logVerbose && console.log("got success from pay_url");
-                        callWallet("taler-payment-succeeded", { H_contract: 
resp.H_contract }, function () {
-                            var nextUrl = subst(resp.contract.fulfillment_url, 
resp.H_contract);
+                        callWallet("taler-payment-succeeded", { H_contract: 
walletResp.H_contract, merchantSig: merchantResp.sig }, function () {
+                            var nextUrl = walletResp.contract.fulfillment_url;
                             logVerbose && console.log("taler-payment-succeeded 
done, going to", nextUrl);
                             window.location.href = nextUrl;
                             window.location.reload(true);
diff --git a/taler-wallet-lib.ts b/taler-wallet-lib.ts
index aca5395..1a56e95 100644
--- a/taler-wallet-lib.ts
+++ b/taler-wallet-lib.ts
@@ -137,13 +137,7 @@ namespace taler {
   }
 
 
-  function handlePaymentResponse(resp: any) {
-    function subst(url: string, contractHash: string) {
-      url = url.replace("${H_contract}", contractHash);
-      url = url.replace("${$}", "$");
-      return url;
-    }
-
+  function handlePaymentResponse(walletResp: any) {
     /**
      * Handle a failed payment.
      *
@@ -166,12 +160,12 @@ namespace taler {
         timeoutHandle = null
         err();
       }
-      callWallet("taler-payment-failed", {H_contract: resp.H_contract}, 
onResp);
+      callWallet("taler-payment-failed", {H_contract: walletResp.H_contract}, 
onResp);
       timeoutHandle = setTimeout(onTimeout, 200);
     }
 
 
-    logVerbose && console.log("handling taler-notify-payment: ", resp);
+    logVerbose && console.log("handling taler-notify-payment: ", walletResp);
     // Payment timeout in ms.
     let timeout_ms = 1000;
     // Current request.
@@ -179,18 +173,19 @@ namespace taler {
     let timeoutHandle: number|null = null;
     function sendPay() {
       r = new XMLHttpRequest();
-      r.open("post", resp.contract.pay_url);
+      r.open("post", walletResp.contract.pay_url);
       r.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
-      r.send(JSON.stringify(resp.payReq));
+      r.send(JSON.stringify(walletResp.payReq));
       r.onload = function() {
         if (!r) {
           return;
         }
         switch (r.status) {
           case 200:
+            const merchantResp = JSON.parse(r.responseText);
             logVerbose && console.log("got success from pay_url");
-            callWallet("taler-payment-succeeded", {H_contract: 
resp.H_contract}, () => {
-              let nextUrl = subst(resp.contract.fulfillment_url, 
resp.H_contract);
+            callWallet("taler-payment-succeeded", {H_contract: 
walletResp.H_contract, merchantSig: merchantResp.sig}, () => {
+              let nextUrl = walletResp.contract.fulfillment_url;
               logVerbose && console.log("taler-payment-succeeded done, going 
to", nextUrl);
               window.location.href = nextUrl;
               window.location.reload(true);

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



reply via email to

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