summaryrefslogtreecommitdiff
path: root/src/frontend/checkout.php
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2015-09-15 18:02:09 +0200
committerMarcello Stanisci <marcello.stanisci@inria.fr>2015-09-15 18:02:09 +0200
commitf9e4086dffd7874abda25c6b6548c8fb39475100 (patch)
treea9a097afa71876ef0df1cf8b13cbd1ca1ab99fa0 /src/frontend/checkout.php
parenta25a80150f36d94f28075666932677571b3076d1 (diff)
downloadmerchant-f9e4086dffd7874abda25c6b6548c8fb39475100.tar.gz
merchant-f9e4086dffd7874abda25c6b6548c8fb39475100.tar.bz2
merchant-f9e4086dffd7874abda25c6b6548c8fb39475100.zip
adding merchant library +
testcases for contract mgmt + minor tree adjustments
Diffstat (limited to 'src/frontend/checkout.php')
-rw-r--r--src/frontend/checkout.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/frontend/checkout.php b/src/frontend/checkout.php
index d2ebd814..d9542c3b 100644
--- a/src/frontend/checkout.php
+++ b/src/frontend/checkout.php
@@ -92,12 +92,12 @@ function taler_pay(form)
if (contract_request.status == 200)
{
/* display contract_requestificate (i.e. it sends the JSON string
- to the (XUL) extension) */
+ to the extension) */
handle_contract(contract_request.responseText);
}
else
{
- alert("Failed to receive contract from server. Status was " + contract_request.status);
+ alert("No contract got from merchant.\n" + contract_request.responseText);
}
}
};
@@ -118,7 +118,6 @@ function pay(form)
for (var cnt=0; cnt < form.payment_system.length; cnt++)
{
var choice = form.payment_system[cnt];
-
if (choice.checked)
{
if (choice.value == "taler")
@@ -143,8 +142,7 @@ function has_taler_wallet_cb(aEvent)
// enable the Taler payment option from the form
var tbutton = document.getElementById("taler-radio-button-id");
tbutton.removeAttribute("disabled");
-
-
+
if (aEvent.type == "taler-wallet-wfirst"){
var eve = new Event('taler-payment-wfirst');
document.body.dispatchEvent(eve);
@@ -161,12 +159,21 @@ function taler_wallet_unload_cb(aEvent)
tbutton.setAttribute("disabled", "true");
};
+/* The merchant signals its taler-friendlyness to the client */
function signal_me()
{
var eve = new Event('taler-payment-mfirst');
document.body.dispatchEvent(eve);
};
+
+function test_without_wallet(){
+ var tbutton = document.getElementById("taler-radio-button-id");
+ tbutton.removeAttribute("disabled");
+};
+
+// test_without_wallet();
+
// Register event to be triggered by the wallet as a response to our
// first event
document.body.addEventListener("taler-wallet-mfirst", has_taler_wallet_cb, false);