summaryrefslogtreecommitdiff
path: root/src/frontend/checkout.php
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-08-18 20:47:19 +0200
committerChristian Grothoff <christian@grothoff.org>2015-08-18 20:47:19 +0200
commit36603d8c745d06a03ef339909d069766cf5a285b (patch)
treeebbe24b4816f06d88b9842a0d89b7829d9d7f8eb /src/frontend/checkout.php
parent088462e69eef74585a74e0517900b78b56f0b09b (diff)
downloadmerchant-36603d8c745d06a03ef339909d069766cf5a285b.tar.gz
merchant-36603d8c745d06a03ef339909d069766cf5a285b.tar.bz2
merchant-36603d8c745d06a03ef339909d069766cf5a285b.zip
towards fixing the work flow in the demo
Diffstat (limited to 'src/frontend/checkout.php')
-rw-r--r--src/frontend/checkout.php32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/frontend/checkout.php b/src/frontend/checkout.php
index 8d62ca9d..44049987 100644
--- a/src/frontend/checkout.php
+++ b/src/frontend/checkout.php
@@ -100,21 +100,27 @@ function ok(form){
-/* the following event gets fired whenever a customer has a taler
-wallet installed in his browser. In that case, the webmaster can decide
-whether or not displaying Taler as a payment option */
+/* the following event gets fired whenever a customer has a Taler
+ wallet installed in his browser. In that case, the webmaster can decide
+ whether or not displaying Taler as a payment option */
-function hasWallet(aEvent){
+function has_taler_wallet_cb(aEvent){
// event awaited by the wallet to change its button's color
var eve = new Event('taler-currency');
document.body.dispatchEvent(eve);
- // ungrey the Taler payment option from the form
+ // enable the Taler payment option from the form
var tbutton = document.getElementById("t-button-id");
tbutton.removeAttribute("disabled");
};
+// The Taler extension was unloaded, disable the option
+function taler_wallet_unload_cb(aEvent){
+ var tbutton = document.getElementById("t-button-id");
+ tbutton.addAttribute("disabled");
+};
+
function sendContract(jsonContract){
@@ -122,17 +128,13 @@ function sendContract(jsonContract){
document.body.dispatchEvent(cevent);
};
-function closeEnd(aEvent){
-
- var eve = new Event("taler-unload");
- document.body.dispatchEvent(eve);
-
-};
-
+/* FIXME: these triggers do not work when I enable/disable
+ the extension... */
// to be triggered by the wallet
-document.body.addEventListener("taler-wallet", hasWallet, false);
-// to be triggered by the wallet
-document.body.addEventListener("taler-unload", closeEnd, false);
+document.body.addEventListener("taler-wallet", has_taler_wallet_cb, false);
+
+// to be triggered by the wallet when it is unloaded
+document.body.addEventListener("taler-unload", taler_wallet_unload_cb, false);
</script>