Skip to content
Snippets Groups Projects
Commit 129c617e authored by Peter Hartmann's avatar Peter Hartmann
Browse files

add debug helper function

parent 1b664d15
Branches
Tags
No related merge requests found
......@@ -117,24 +117,29 @@
$form.submit(function (event) {
// Don't handle submits generated by the CiviDiscount button.
if ($form.data('cividiscount-dont-handle') == 1) {
debugging('pvjwy');
return true;
}
if (isWebform) {
var $processorFields = $('.civicrm-enabled[name$="civicrm_1_contribution_1_contribution_payment_processor_id]"]');
if ($('#action').attr('value') == webformPrevious) {
debugging('wmlfp');
return true;
}
if ($('#wf-crm-billing-total').length) {
if ($('#wf-crm-billing-total').data('data-amount') == '0') {
debugging('qplfr');
return true;
}
}
if ($processorFields.length) {
if ($processorFields.filter(':checked').val() == '0') {
debugging('evxyh');
return true;
}
if (!($form.find('input[name="stripe_token"]').length)) {
debugging('irjfg');
return true;
}
}
......@@ -150,6 +155,7 @@
if(typeof currentTotal !== 'undefined') {
if (currentTotal == 0 && !additionalParticipants) {
// This is also hit when "Going back", but we already have stripe_token.
debugging('ozlkf');
return true;
}
}
......@@ -161,11 +167,13 @@
if (($form.find('input[name="payment_processor"]:checked').length) || ($form.find('input[name="payment_processor_id"]:checked').length)) {
processorId = $form.find(('input[name="payment_processor"]:checked')||('input[name="payment_processor_id"]:checked').val());
if (!($form.find('input[name="stripe_token"]').length) || ($('#stripe-id').length && $('#stripe-id').val() != processorId)) {
debugging('kfoej');
return true;
}
}
else {
// No payment processor is checked.
debugging('qlmvy');
return true;
}
}
......@@ -173,6 +181,7 @@
// Handle pay later (option value '0' in payment_processor radio group).
if (($form.find('input[name="payment_processor"]:checked').length && !parseInt($form.find('input[name="payment_processor"]:checked').val()))
|| ($form.find('input[name="payment_processor_id"]:checked').length && !parseInt($form.find('input[name="payment_processor_id"]:checked').val()))) {
debugging('ynhpz');
return true;
}
......@@ -180,12 +189,14 @@
if ($form.find("input#stripe-token").val()) {
$form.find("input#credit_card_number").removeAttr('name');
$form.find("input#cvv2").removeAttr('name');
debugging('zpqef');
return true;
}
// If there's no credit card field, no use in continuing (probably wrong
// context anyway)
if (!$form.find('#credit_card_number').length) {
debugging('gvzod');
return true;
}
......@@ -210,7 +221,14 @@
exp_year: cc_year
}, stripeResponseHandler);
debugging('ywkvh');
return false;
});
});
}(cj, CRM));
function debugging (errorCode) {
// Uncomment the following to debug unexpected returns.
// console.log(errorCode);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment