MediaWiki:DonationForm.js: Difference between revisions
Content deleted Content added
update LatAm feeMinimums |
No edit summary |
||
(10 intermediate revisions by the same user not shown) | |||
Line 7:
donationForm.loadedTime = Date.now();
donationForm.extraData = {};
// Don't offer recurring at all in these countries
donationForm.noRecurringPaypalCountries = [ 'CL', 'CO', 'PE', 'UY', 'BR' ];
donationForm.maxUSD = 25000;
Line 228 ⟶ 223:
minAmount = donationForm.minimums[ currency ],
locale = donationForm.getLocale( mw.config.get('wgPageContentLanguage'), donationForm.country );
// Round up
minAmount = Math.ceil( minAmount * 100 ) / 100;
Line 274 ⟶ 269:
// If changing, please update https://docs.google.com/spreadsheets/d/1e02TsZ_bKDAS1BMVBCdyo9D7RGln_wCGnkg7IF5kU5s/edit
var radioAmountsData = {
"USD" : { // also used for CAD, AUD, NZD
"default" : [
[ 0, [ 2.75, 5, 10, 20, 25, 35, 50 ] ],
Line 291 ⟶ 286:
[ 1000, [ 1000, 2000, 3000, 4000, 5000, 7500, 10000 ] ],
[ 3000, [ 3000, 4000, 5000, 6000, 7500, 10000, 12000 ] ]
],
"midtier2018" : [
Line 429 ⟶ 304:
]
},
"EUR" : [ // also used for GBP
[ 0, [ 2, 5, 10, 20, 25, 35, 50 ] ],
[ 5, [ 5, 10, 15, 20, 35, 50, 100 ] ],
[ 10, [ 10, 15, 20, 25, 35, 50, 100 ] ],
[ 15, [ 15, 20, 25, 35, 50, 75, 100 ] ],
[ 20, [ 20, 25, 35, 50, 75, 100, 150 ] ],
[ 25, [ 25, 30, 40, 50, 75, 100, 150 ] ],
[ 35, [ 35, 50, 75, 100, 200, 300, 500 ] ],
[ 50, [ 50, 75, 100, 200, 300, 500, 750 ] ],
[ 75, [ 75, 100, 150, 250, 500, 750, 1000 ] ],
[ 100, [ 100, 150, 250, 500, 750, 1000, 2500 ] ],
[ 150, [ 150, 200, 300, 500, 750, 1000, 2000 ] ],
[ 200, [ 200, 300, 500, 750, 1000, 2500, 5000 ] ],
[ 500, [ 500, 750, 1000, 2500, 5000, 7500, 10000 ] ],
[ 1000, [ 1000, 2000, 3000, 4000, 5000, 7500, 10000 ] ],
[ 3000, [ 3000, 4000, 5000, 6000, 7500, 10000, 12000 ] ]
],
"JPY" : [
[ 0, [ 500, 1000, 2000, 2500, 4000, 5000, 10000 ] ],
Line 449 ⟶ 341:
radioAmountsData.AUD = radioAmountsData.USD;
radioAmountsData.CAD = radioAmountsData.USD;
radioAmountsData.NZD = radioAmountsData.USD;
radioAmountsData.GBP = radioAmountsData.EUR;
var appealAmountsData = {
"USD" : [ // also used for CAD, AUD, NZD, GBP, EUR
Line 680 ⟶ 572:
var params = {};
params.currency = donationForm.currency;
params.country = donationForm.country;
Line 694 ⟶ 586:
params.payment_method = paymentMethod;
}
if ( params.payment_method === 'cc' && params.country === 'ZA' ) {
params.gateway = 'astropay';
Line 776 ⟶ 668:
uri = new mw.Uri('https://payments.wikimedia.org/index.php/Special:AdyenCheckoutGateway');
}
// Skip form chooser for Venmo
if ( params.payment_method === 'venmo' ) {
Line 785 ⟶ 677:
// Tracking data
params.
params.
params.
params.
if ( document.referrer ) { // TODO: do we need this?
// Strip protocol to stop firewall complaining
Line 805 ⟶ 697:
/**
* Build a
*
* Own function so it can be overriden for weird tests
*
* @param {Object} params
* @return {string}
*/
donationForm.
var
wmf_source += '.';
var fullDottedPaymentMethod = params.payment_method;
Line 834 ⟶ 727:
/* The landing page info, separated by ~. This mostly exists for legacy reasons */
return
};
/**
* Build a string for
*
* @param {Object} data
* @return {string}
*/
donationForm.
var
dataArray = [];
if (
dataArray.push(
}
for (var key in data) {
Line 1,124 ⟶ 1,017:
/**
* Format an amount for a given locale
*
* 2 decimal places if it has a fractional part, 0 if not
* Note this doesn't include any currency symbol
*
* @param {number} amount
* @param {string} locale To determine correct separators
Line 1,367 ⟶ 1,260:
$('#frequency_onetime').prop('checked', true);
$('.frequency-options, #cancel-monthly, #donate-recurring-smallprint').hide();
}
if ( donationForm.noRecurringPaypalCountries.indexOf( donationForm.country ) !== -1 ) {
$( '.paymentmethod-pp, .paymentmethod-pp-usd' ).addClass( 'not-monthly-capable' );
}
Line 1,372 ⟶ 1,269:
// Only show Amazon for links from Ways to give
// TODO: remove utm_source when Ways to give has been updated
if (
mw.util.getParamValue( '
mw.util.getParamValue( 'wmf_source' ) === 'Ways_to_Give'
) {
}
Line 1,385 ⟶ 1,283:
}
}
// Venmo browser check
if ( $('.paymentmethod-venmo').length > 0 ) {
Line 1,408 ⟶ 1,306:
// Allow preselecting monthly
if (
mw.util.getParamValue('monthly') && mw.util.getParamValue('monthly') !== '0'
&& donationForm.noRecurringCountries.indexOf( donationForm.country ) === -1
) {
$('#frequency_monthly').click();
}
Line 1,421 ⟶ 1,322:
}
finally {
$('.frb-monthly-pitch, .frb-monthly-pitch-thanks').appendTo('.frequency-options');
$('.ptf').appendTo('.amount-options');
$('.optin-options').insertAfter('.amount-options');
|