Skip to content
Snippets Groups Projects
Commit 2016de7b authored by mattwire's avatar mattwire
Browse files

Backend membership renewal fails with stripe token not passed because stripe.js is not included

parent 47e537dd
Branches
Tags
No related merge requests found
......@@ -44,15 +44,18 @@
Stripe.setPublishableKey($('#stripe-pub-key').val());
});
if ($('.webform-client-form').length) {
isWebform = true;
$('form.webform-client-form').addClass('stripe-payment-form');
}
else {
if (!($('.stripe-payment-form').length)) {
$('#crm-main-content-wrapper form').addClass('stripe-payment-form');
// Check for form marked as a stripe-payment-form by the server.
if (!($('form.stripe-payment-form').length)) {
// If there isn't one look for it.
if ($('.webform-client-form').length) {
isWebform = true;
$('form.webform-client-form').addClass('stripe-payment-form');
}
else {
$('#crm-container > form').addClass('stripe-payment-form');
}
}
$form = $('form.stripe-payment-form');
if (isWebform) {
$submit = $form.find('.button-primary');
......
......@@ -204,6 +204,18 @@ function stripe_civicrm_managed(&$entities) {
}
}
/**
* Add stripe.js to forms, to generate stripe token
* @param $formName
* @param $form
*/
function stripe_civicrm_buildForm($formName, &$form) {
if (($formName == 'CRM_Member_Form_MembershipRenewal') && !empty($form->_paymentProcessor['class_name'])) {
// civicrm_stripe.js is not included on backend form renewal unless we add it here.
CRM_Core_Resources::singleton()->addScriptFile('com.drastikbydesign.stripe', 'js/civicrm_stripe.js');
}
}
/*
* Implementation of hook_idsException.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment