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
No related branches found
No related tags found
Loading
...@@ -44,15 +44,18 @@ ...@@ -44,15 +44,18 @@
Stripe.setPublishableKey($('#stripe-pub-key').val()); Stripe.setPublishableKey($('#stripe-pub-key').val());
}); });
if ($('.webform-client-form').length) { // Check for form marked as a stripe-payment-form by the server.
isWebform = true; if (!($('form.stripe-payment-form').length)) {
$('form.webform-client-form').addClass('stripe-payment-form'); // If there isn't one look for it.
} if ($('.webform-client-form').length) {
else { isWebform = true;
if (!($('.stripe-payment-form').length)) { $('form.webform-client-form').addClass('stripe-payment-form');
$('#crm-main-content-wrapper form').addClass('stripe-payment-form'); }
else {
$('#crm-container > form').addClass('stripe-payment-form');
} }
} }
$form = $('form.stripe-payment-form'); $form = $('form.stripe-payment-form');
if (isWebform) { if (isWebform) {
$submit = $form.find('.button-primary'); $submit = $form.find('.button-primary');
......
...@@ -204,6 +204,18 @@ function stripe_civicrm_managed(&$entities) { ...@@ -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. * Implementation of hook_idsException.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment