Template:2012FR/Form-section/Processing/Default: Difference between revisions

Content deleted Content added
explicitly set recurring=false if needed
only mess with form after validating
Line 9:
donationForm.redirectPayment = function(paymentMethod, paymentSubMethod, skipValidation) {
 
if (typeof paymentSubMethodskipValidation ==|| validateForm(form) 'undefined') {
paymentSubMethod = '';
}
var form = document.paypalcontribution; // we should really change this some day
var paymentsURL = 'https://payments.wikimedia.org/index.php/Special:GatewayFormChooser';
 
if (typeof paymentSubMethod == 'undefined') {
form.action = paymentsURL;
paymentSubMethod = '';
} }
var form = document.paypalcontribution; // we should really change this some day
var paymentsURL = 'https://payments.wikimedia.org/index.php/Special:GatewayFormChooser';
 
form.action = paymentsURL;
// set up inputs
form.currency_code.value = '</html>{{{currency|USD}}}<html>';
 
// set up inputs
if (typeof paymentSubMethod == 'undefined') {
paymentSubMethodform.currency_code.value = '</html>{{{currency|USD}}}<html>';
}
 
if (typeof paymentSubMethod == 'undefined') {
// WorldPay override for cc
paymentSubMethod = '';
if( paymentMethod === 'cc-wp' ) {
paymentMethod = 'cc';}
form.payment_method.value = 'cc';
form.gateway.value = 'worldpay';
form.ffname.value = 'worldpay';
}
// Adyen override for cc
if( paymentMethod === 'cc-adyen' ) {
paymentMethod = 'cc';
form.payment_method.value = 'cc';
form.gateway.value = 'adyen';
form.ffname.value = 'adyen';
}
var frequency = $("input[name='frequency']:checked").val();
if( frequency !== 'monthly' ){
frequency = 'onetime';
form.recurring.value = 'false';
} else {
form.recurring.value = 'true';
}
form.payment_method.value = paymentMethod;
form.payment_submethod.value = paymentSubMethod;
 
// WorldPay override for cc
donationForm.addAnalytics();
if( paymentMethod === 'cc-wp' ) {
if( paymentMethod === 'cc-adyen' ) {;
form.payment_method.value = 'cc';
form.gateway.value = 'worldpay';
form.ffname.value = 'worldpay';
}
 
// Adyen override for cc
var full_dotted_payment_method = paymentMethod;
if if( form.recurring.valuepaymentMethod === 'truecc-adyen' ) {
paymentMethod = 'cc';
full_dotted_payment_method = 'r' + full_dotted_payment_method;
form.payment_method.value = 'cc';
}
form.gateway.value = 'adyen';
if ( paymentSubMethod ) {
full_dotted_payment_method = form.payment_methodffname.value += '.adyen' + paymentSubMethod;
}
 
var frequency = $("input[name='frequency']:checked").val();
if( frequency !== 'monthly' ){
frequency = 'onetime';
form.ffnamerecurring.value = 'adyenfalse';
} else {
form.recurring.value = 'falsetrue';
}
 
form.payment_method.value = paymentMethod;
form.payment_submethod.value = paymentSubMethod;
 
donationForm.addAnalytics();
 
var full_dotted_payment_method = paymentMethod;
if ( form.recurring.value == 'true'; ) {
full_dotted_payment_method = 'r' + full_dotted_payment_method;
}
if ( paymentSubMethod ) {
full_dotted_payment_method = form.payment_method.value + '.' + paymentSubMethod;
}
 
form.utm_source.value += '.' + full_dotted_payment_method;
 
form.utm_source.value += '.' + full_dotted_payment_method;
if ( skipValidation || validateForm(form) ) {
form.method = "GET";
form.submit();