MediaWiki:MonthlyConvert.js: Difference between revisions

Content deleted Content added
don't do monthlyconvert here for adyen credit card - can be done post-payments now
also check wmf_medium for endowment
 
(18 intermediate revisions by the same user not shown)
Line 5:
// https://docs.google.com/spreadsheets/d/1z36zi8EegPLAvR5FYAgwz8ywKZ50QNB82SpwpTdk-xQ/edit#gid=1258723967
mc.amounts = {
'USDEUR' : [ // also CAD, AUD, NZDGBP
[ 21.7499, 0 ],
[ 2.35, 1.40 ],
[ 9, 1.75 ],
[ 12, 2 ],
Line 35 ⟶ 36:
[ Infinity, 0 ]
],
'GBPUSD' : [ // also EURCAD, AUD, NZD
[ 12.9974, 0 ],
[ 9, 1.75 ],
[ 12, 2 ],
Line 63 ⟶ 64:
[ 250, 25 ],
[ 499, 50 ],
[ Infinity, 0 ]
],
'INR' : [
[ 200, 0 ],
[ 300, 150 ],
[ 500, 175 ],
[ 1000, 250 ],
[ 1500, 350 ],
[ 3000, 500 ],
[ 5000, 750 ],
[ 10000, 1000 ],
[ 25000, 2500 ],
[ Infinity, 0 ]
],
Line 107 ⟶ 96:
[ Infinity, 0 ]
],
'SEK' : [ // Also NOK
[ 2529, 0 ],
[ 5035, 2520 ],
[ 10055, 3025 ],
[ 200105, 5030 ],
[ 300160, 7040 ],
[ 500210, 9050 ],
[ 1000360, 11060 ],
[ 2500450, 25075 ],
[ 5000600, 500100 ],
[ 800, 125 ],
[ 900, 150 ],
[ 1200, 200 ],
[ 1500, 250 ],
[ 1800, 300 ],
[ 2100, 350 ],
[ Infinity, 0 ]
],
Line 184 ⟶ 179:
[ Infinity, 0 ]
],
'DKK' : [ // Also NOK
[ 19, 0 ],
[ 2025, 10 ],
[ 120, 20 ],
[ 180250, 3040 ],
[ 300350, 50 ],
[ 450, 75 ],
[ 600, 100 ],
Line 198 ⟶ 193:
[ 1800, 300 ],
[ 2100, 350 ],
[ Infinity, 0 ]
],
'CZK' : [
[ 49, 0 ],
[ 180, 30 ],
[ 300, 50 ],
[ 600, 100 ],
[ 900, 150 ],
[ 1200, 200 ],
[ 1500, 250 ],
[ 1800, 300 ],
[ 2100, 350 ],
[ 2400, 400 ],
[ 3000, 500 ],
[ 3600, 600 ],
[ 4200, 700 ],
[ 4800, 800 ],
[ Infinity, 0 ]
],
'CLP' : [
[ 1999, 0 ],
[ 2300, 1000 ],
[ 2700, 1100 ],
[ 3300, 1200 ],
[ 4200, 1300 ],
[ 5500, 1400 ],
[ 9000, 1500 ],
[ 10500, 1700 ],
[ 16000, 2600 ],
[ 20800, 3400 ],
[ 26000, 4200 ],
[ 31200, 5000 ],
[ 38400, 6400 ],
[ 55000, 8500 ],
[ Infinity, 0 ]
],
'UYU' : [
[ 99, 0 ],
[ 120, 50 ],
[ 170, 65 ],
[ 220, 70 ],
[ 320, 75 ],
[ 480, 85 ],
[ 520, 90 ],
[ 750, 125 ],
[ 1050, 170 ],
[ 1350, 225 ],
[ 1600, 250 ],
[ 1800, 300 ],
[ 2100, 320 ],
[ Infinity, 0 ]
],
'PEN' : [
[ 9, 0 ],
[ 12, 5 ],
[ 17, 6 ],
[ 26, 7 ],
[ 48, 8 ],
[ 55, 9 ],
[ 78, 13 ],
[ 105, 17 ],
[ 130, 21 ],
[ 160, 26 ],
[ 180, 30 ],
[ 210, 32 ],
[ Infinity, 0 ]
],
'COP' : [
[ 9999, 0 ],
[ 11300, 5000 ],
[ 17000, 5200 ],
[ 22000, 5500 ],
[ 27000, 5800 ],
[ 45000, 7500 ],
[ 55000, 9000 ],
[ 75000, 12500 ],
[ 105000, 17000 ],
[ 120000, 20000 ],
[ 160000, 25000 ],
[ 180000, 30000 ],
[ 250000, 34000 ],
[ Infinity, 0 ]
],
'BRL' : [
[ 9, 0 ],
[ 12, 6 ],
[ 22, 7 ],
[ 35, 8 ],
[ 45, 9 ],
[ 55, 10 ],
[ 80, 12 ],
[ 105, 16 ],
[ 160, 25 ],
[ 210, 35 ],
[ 270, 45 ],
[ 320, 50 ],
[ Infinity, 0 ]
],
'MXN' : [
[ 39, 0 ],
[ 48, 25 ],
[ 60, 28 ],
[ 110, 30 ],
[ 160, 35 ],
[ 260, 45 ],
[ 270, 50 ],
[ 350, 60 ],
[ 550, 85 ],
[ 650, 90 ],
[ 750, 120 ],
[ 1500, 160 ],
[ Infinity, 0 ]
]
};
 
mc.amounts.EUR = mc.amounts.GBP;
mc.amounts.GBP = mc.amounts.EUR;
mc.amounts.CAD = mc.amounts.USD;
mc.amounts.AUD = mc.amounts.USD;
mc.amounts.NZD = mc.amounts.USD;
 
mc.amounts.RON = mc.amounts.MYR;
mc.amounts.PLN = mc.amounts.MYR;
mc.amounts.NOK = mc.amounts.DKKSEK;
 
mc.getSuggestedAmount = function ( amount, currency ) {
Line 275 ⟶ 384:
 
var initialAmount = params.amount,
currency = params.currency_codecurrency || 'USD',
suggestedAmount = mc.getSuggestedAmount( initialAmount, currency ),
locale = donationForm.getLocale( params.uselang, params.country ),
skipMc;
 
if ( mw.util.getParamValue( 'monthlyconvert' ) === 'false' || mw.util.getParamValue( 'monthlyconvert' ) === 'none' ) {
skipMc = true;
}
 
if ( mw.util.getParamValue( 'wmf_medium' ) === 'endowment' || mw.util.getParamValue( 'utm_medium' ) === 'endowment' ) {
// No recurring for endowment
skipMc = true;
}
 
if ( params.recurring ) {
Line 287 ⟶ 405:
if ( donationForm.noRecurringCountries.indexOf( params.country ) !== -1 ) {
// Country where we don't offer any recurring
skipMc = true;
}
 
if ( params.payment_method === 'paypal' && donationForm.noRecurringPaypalCountries.indexOf( params.country ) !== -1 ) {
skipMc = true;
}
Line 297 ⟶ 419:
if (
( params.payment_method === 'paypal' ) ||
( params.payment_method === 'applertbt' && params.payment_submethod === 'rtbt_ideal' ) ||
( params.payment_method === 'rtbtbt' && params.payment_submethod === 'rtbt_idealupi' ) ||
( params.payment_method === 'bt' && params.payment_submethod === 'paytmwallet' )
) {
// suitable method!
Line 348 ⟶ 471:
 
$('.mc-modal-screen').show();
document.querySelector('.mc-button').focus();
$('body').addClass('modal-open');
}
Line 357 ⟶ 481:
$( '.mc-diff-amount-link' ).on( 'click keypress', function ( e ) {
if ( e.which === 13 || e.type === 'click' ) {
$( '.mc-choice' ).fadeOut( function hide() {;
$( '.mc-edit-amount' ).fadeInshow();
$( '.mc-other-amount-input' ).focus();
} );
}
} );
Line 366 ⟶ 489:
$( '.mc-choice .mc-back' ).on( 'click keypress', function ( e ) {
if ( e.which === 13 || e.type === 'click' ) {
$( '.mc-edit-amount' ).fadeOut( function hide() {;
$('.mc-modal-screen').hide();
$('body').removeClass('modal-open');
} );
}
} );
Line 375 ⟶ 497:
$( '.mc-edit-amount .mc-back' ).on( 'click keypress', function ( e ) {
if ( e.which === 13 || e.type === 'click' ) {
$( '.mc-edit-amount' ).fadeOut( function hide() {;
$( '.mc-choice' ).fadeInshow();
} );
}
} );