[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-web-common] 02/02: pass merchant signature for payme
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-web-common] 02/02: pass merchant signature for payment success to wallet |
Date: |
Wed, 26 Apr 2017 00:46:32 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository web-common.
commit 22a84231b7b831d8cd92b4076456568d7d5730be
Author: Florian Dold <address@hidden>
AuthorDate: Wed Apr 26 00:46:24 2017 +0200
pass merchant signature for payment success to wallet
---
taler-wallet-lib.js | 15 ++++++++-------
taler-wallet-lib.ts | 15 ++++++++-------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/taler-wallet-lib.js b/taler-wallet-lib.js
index 2978d83..fd2845f 100644
--- a/taler-wallet-lib.js
+++ b/taler-wallet-lib.js
@@ -122,7 +122,7 @@ var taler;
callWallet("taler-create-reserve", args);
}
taler.createReserve = createReserve;
- function handlePaymentResponse(resp) {
+ function handlePaymentResponse(walletResp) {
/**
* Handle a failed payment.
*
@@ -145,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.
@@ -156,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 = resp.contract.fulfillment_url;
+ 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 a5694a9..1a56e95 100644
--- a/taler-wallet-lib.ts
+++ b/taler-wallet-lib.ts
@@ -137,7 +137,7 @@ namespace taler {
}
- function handlePaymentResponse(resp: any) {
+ function handlePaymentResponse(walletResp: any) {
/**
* Handle a failed payment.
*
@@ -160,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.
@@ -173,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 = resp.contract.fulfillment_url;
+ 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