diff options
author | Florian Dold <florian.dold@gmail.com> | 2015-12-20 20:34:20 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2015-12-20 20:34:20 +0100 |
commit | 604cb2f80473c23f76afd37670a1a7249ae170a3 (patch) | |
tree | 12783d32e3a1cc17a113db4c8a9e1ff66a69414e /extension/content_scripts | |
parent | 8e80bbbbb8489532e1f2a5c9b632e5ead4a6ec68 (diff) | |
download | wallet-core-604cb2f80473c23f76afd37670a1a7249ae170a3.tar.xz |
Missing files, payment
Diffstat (limited to 'extension/content_scripts')
-rw-r--r-- | extension/content_scripts/notify.js | 8 | ||||
-rw-r--r-- | extension/content_scripts/notify.ts | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/extension/content_scripts/notify.js b/extension/content_scripts/notify.js index 899355f8e..065aae193 100644 --- a/extension/content_scripts/notify.js +++ b/extension/content_scripts/notify.js @@ -55,7 +55,7 @@ document.addEventListener('taler-execute-payment', function (e) { }, }; chrome.runtime.sendMessage(msg, (resp) => { - //console.log("got response from bg page", JSON.stringify(resp)); + console.log("got backend response to execute-payment:", JSON.stringify(resp)); if (!resp.success) { console.log("failure!"); return; @@ -63,12 +63,16 @@ document.addEventListener('taler-execute-payment', function (e) { let r = new XMLHttpRequest(); r.open('post', resp.payUrl); r.send(JSON.stringify(resp.payReq)); + let evt; r.onload = (e) => { if (r.status != 200) { console.log("non-200 error"); console.log(r.responseText); + alert("merchant returned HTTP status " + r.status); + } + else { + evt = new CustomEvent("taler-payment-result", { detail: resp }); } - let evt = new Event("taler-payment-result", resp); document.dispatchEvent(evt); }; }); diff --git a/extension/content_scripts/notify.ts b/extension/content_scripts/notify.ts index 03135dd06..c45797db3 100644 --- a/extension/content_scripts/notify.ts +++ b/extension/content_scripts/notify.ts @@ -63,7 +63,7 @@ document.addEventListener('taler-execute-payment', function(e: CustomEvent) { }, }; chrome.runtime.sendMessage(msg, (resp) => { - //console.log("got response from bg page", JSON.stringify(resp)); + console.log("got backend response to execute-payment:", JSON.stringify(resp)); if (!resp.success) { console.log("failure!"); return; @@ -71,12 +71,15 @@ document.addEventListener('taler-execute-payment', function(e: CustomEvent) { let r = new XMLHttpRequest(); r.open('post', resp.payUrl); r.send(JSON.stringify(resp.payReq)); + let evt; r.onload = (e) => { if (r.status != 200) { console.log("non-200 error"); console.log(r.responseText); + alert("merchant returned HTTP status " + r.status); + } else { + evt = new CustomEvent("taler-payment-result", {detail: resp}); } - let evt = new Event("taler-payment-result", resp); document.dispatchEvent(evt); }; }); |