test js mods

This commit is contained in:
Nathan Coad
2016-07-22 09:26:27 +10:00
parent ee93be90d8
commit 2614e25364

View File

@@ -1,18 +1,29 @@
jQuery(document).ready(function($) {
var settings = Drupal.settings.booking_stripe;
var $form = $("#" + settings.form_selector);
var $stripeForm = $("#" + settings.form_selector);
var handler = StripeCheckout.configure({
key: settings.pubkey,
image: settings.image,
locale: 'auto',
token: function(token) {
try {
var $token_id = $(':input[name="token_id"]', $stripeForm);
var $token_email = $(':input[name="token_email"]', $stripeForm);
$token_id.val(token.id);
$token_email.val(token.email);
$stripeForm.get(0).submit();
}
catch(err) {
console.log([err]);
}
// Use the token to create the charge with a server-side script.
// You can access the token ID with `token.id`
if (currentForm === undefined)
return;
currentForm.find('input[name="token_id"]').val(token.id);
currentForm.find('input[name="token_email"]').val(token.email);
currentForm.submit();
//if (currentForm === undefined)
// return;
//currentForm.find('input[name="token_id"]').val(token.id);
//currentForm.find('input[name="token_email"]').val(token.email);
//currentForm.submit();
}
});
var currentForm = undefined;