test js mods
This commit is contained in:
@@ -1,18 +1,29 @@
|
|||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
var settings = Drupal.settings.booking_stripe;
|
var settings = Drupal.settings.booking_stripe;
|
||||||
var $form = $("#" + settings.form_selector);
|
var $stripeForm = $("#" + settings.form_selector);
|
||||||
var handler = StripeCheckout.configure({
|
var handler = StripeCheckout.configure({
|
||||||
key: settings.pubkey,
|
key: settings.pubkey,
|
||||||
image: settings.image,
|
image: settings.image,
|
||||||
locale: 'auto',
|
locale: 'auto',
|
||||||
token: function(token) {
|
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.
|
// Use the token to create the charge with a server-side script.
|
||||||
// You can access the token ID with `token.id`
|
// You can access the token ID with `token.id`
|
||||||
if (currentForm === undefined)
|
//if (currentForm === undefined)
|
||||||
return;
|
// return;
|
||||||
currentForm.find('input[name="token_id"]').val(token.id);
|
//currentForm.find('input[name="token_id"]').val(token.id);
|
||||||
currentForm.find('input[name="token_email"]').val(token.email);
|
//currentForm.find('input[name="token_email"]').val(token.email);
|
||||||
currentForm.submit();
|
//currentForm.submit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var currentForm = undefined;
|
var currentForm = undefined;
|
||||||
|
Reference in New Issue
Block a user