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

From Donate
Jump to navigation Jump to search
(Undo revision 27393 by Pcoombe (talk) - issues)
(remove paypal_ec override for Japan, it's default everywhere now)
 
(8 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
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 form = document.paypalcontribution; // we should really change this some day
  +
var paymentsURL = 'https://payments.wikimedia.org/index.php/Special:GatewayFormChooser';
 
  +
if ( skipValidation || validateForm(form) ) {
   
  +
if (typeof paymentSubMethod == 'undefined') {
form.action = paymentsURL;
 
  +
paymentSubMethod = '';
  +
}
  +
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') {
 
paymentSubMethod = '';
+
form.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';
 
} 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' ) {
  +
paymentMethod = 'cc';
  +
form.payment_method.value = 'cc';
  +
form.gateway.value = 'worldpay';
  +
form.ffname.value = 'worldpay';
  +
}
   
  +
// Adyen override for cc
var full_dotted_payment_method = paymentMethod;
 
if ( form.recurring.value == 'true' ) {
+
if( paymentMethod === 'cc-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_method.value + '.' + paymentSubMethod;
+
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;
  +
  +
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.method = "GET";
 
form.submit();
 
form.submit();

Latest revision as of 18:19, 8 March 2018