MediaWiki:DonationForm T201415.js: Difference between revisions
Content deleted Content added
clean trailing spaces |
No edit summary |
||
Line 685:
if ( donationForm.validate( skipAmountValidation ) ) {
var
var params = {};
if (typeof paymentSubMethod == 'undefined') {
Line 696 ⟶ 695:
if ( paymentMethod === 'cc-adyen' ) {
paymentMethod = 'cc';
}
Line 704 ⟶ 703:
if ( paymentMethod === 'cc-dlocal' ) {
paymentMethod = 'cc';
}
// Default to variant = panExplain for India▼
var frequency = $("input[name='frequency']:checked").val();▼
// TODO: make this default payments side - https://phabricator.wikimedia.org/T259146▼
if( frequency !== 'monthly' ){▼
}▼
▲ if ( frequency !== 'monthly' ) {
frequency = 'onetime';
} else {
}
form.payment_submethod.value = paymentSubMethod;▼
if ( form.recurring.value == 'true' ) {▼
▲ }
if ( paymentSubMethod ) {
}
var amount = donationForm.getAmount();
if ( $('#ptf-checkbox').prop('checked') ) {
donationForm.extraData.ptf = 1;
}▼
params.amount = amount;
/* Email optin */
if ( $('input[name="opt_in"]').length > 0 ) {
var opt_inValue = $('input[name="opt_in"]:checked').val();
params.opt_in = opt_inValue; // donationForm.validate() already checked it's 1 or 0
}
donationForm.extraData.time = Math.round( (Date.now() - donationForm.loadedTime)/1000 );
// TODO: do we need this?
} else {
Line 750 ⟶ 758:
return false; // don't submit if called by a button
};
donationForm.goToPayments = function( uri ) {
if ( window.top !== window.self ) {
// In a frame, open payments in a new tab
window.open( uri.toString() );
} else {
window.location.href = uri.toString();
}
};
Line 755 ⟶ 773:
* Build a utm_source value, including the landing page info.
*
* Own function so it can be overriden for weird tests
*
* @param {Object} params
* @return {string} utm_source
*/
donationForm.buildUtmSource = function( params ) {
var utm_source = mw.util.getParamValue( 'utm_source' ) + '.';
var fullDottedPaymentMethod = params.payment_method;
fullDottedPaymentMethod = 'r' + fullDottedPaymentMethod;
}
fullDottedPaymentMethod = fullDottedPaymentMethod + '.' + params.payment_submethod;
}
/* Get URL parameter, but remove parts using old format. Allow fallback to a default value */
Line 1,029 ⟶ 1,056:
if ( form ) {
▲ // Strip protocol to stop firewall throwing fits
▲ form.referrer.value = document.referrer.replace(/https?:\/\//i, "");
// hide frequency options for some countries
Line 1,063 ⟶ 1,084:
&& donationForm.noRecurringCountries.indexOf( form.country.value ) === -1 ) {
$('#frequency_monthly').click();
▲ }
▲ // Default to variant = panExplain for India
▲ // https://phabricator.wikimedia.org/T259146
▲ if ( form.country.value === 'IN' ) {
▲ form.variant.value = 'panExplain';
}
|