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

From Donate
Jump to navigation Jump to search
Content deleted Content added
stop using dotted payment method
No edit summary
Line 8: Line 8:


donationForm.redirectPayment = function(paymentMethod, paymentSubMethod, skipValidation) {
donationForm.redirectPayment = function(paymentMethod, paymentSubMethod, skipValidation) {

if (typeof paymentSubMethod == 'undefined') {
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
// set up inputs
document.getElementsByName("currency_code")[0].value = '</html>{{{currency|USD}}}<html>';
form.currency_code.value = '</html>{{{currency|USD}}}<html>';


if (typeof paymentSubMethod == 'undefined') {
if (typeof paymentSubMethod == 'undefined') {
paymentSubMethod = '';
paymentSubMethod = '';
}
var form = document.paypalcontribution; // we should really change this some day
var paymentsURL = 'https://payments.wikimedia.org/index.php/Special:GatewayFormChooser';
var params = {
'uselang' : $("input[name='language']").val(),
'language' : $("input[name='language']").val(),
'currency_code' : $("input[name='currency_code']").val(),
'country' : $("input[name='country']").val(),
'paymentmethod' : paymentMethod
};
if( paymentSubMethod != '' ){
params['submethod'] = paymentSubMethod;
params['payment_submethod'] = paymentSubMethod;
}
// Testing for Adyen
if( paymentMethod === 'adyen-cc' ) {
paymentMethod = 'cc';
params.paymentmethod = 'cc';
params.gateway = 'adyen';
}
}


// Worldpay
// WorldPay override for cc
if( paymentMethod === 'cc-wp' ) {
if( paymentMethod === 'cc-wp' ) {
paymentMethod = 'cc';
paymentMethod = 'cc';
params.paymentmethod = 'cc';
form.payment_method.value = 'cc';
params.gateway = 'worldpay';
form.gateway.value = 'worldpay';
params.ffname = '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';
}
}
Line 49: Line 43:
if( frequency !== 'monthly' ){
if( frequency !== 'monthly' ){
frequency = 'onetime';
frequency = 'onetime';
// commented out below as it breaks eNETS for some reason
// params['recurring'] = 'false';
} else {
} else {
params['recurring'] = 'true';
form.recurring.value = 'true';
// the following causes tons of errors. Don't.
// paymentMethod = 'r' + paymentMethod;
}
}
form.action = paymentsURL + '?' + $.param(params);
form.payment_method.value = paymentMethod;
form.payment_method.value = paymentMethod;
form.payment_submethod.value = paymentSubMethod;


donationForm.addAnalytics();
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;
if ( skipValidation || validateForm(form) ) {
if ( skipValidation || validateForm(form) ) {
form.method = "POST";
form.method = "GET";
form.submit();
form.submit();
}
}
Line 105: Line 105:
}
}


form.utm_source.value += '.' + form.payment_method.value;
form.utm_campaign.value = getQuerystring( 'utm_campaign' );
form.utm_campaign.value = getQuerystring( 'utm_campaign' );
};
};

Revision as of 14:51, 5 April 2016