MediaWiki:DonationForm.js: Difference between revisions
Content deleted Content added
update minimums to match payments |
add donationForm.currencyRates; define donationForm.minLocal and maxLocal at load and allow overriding (currently only for India) |
||
Line 14:
donationForm.noRecurringPaypalCountries = [ 'CL', 'CO', 'PE', 'UY', 'BR' ];
donationForm.
donationForm.minimums = {▼
// From https://github.com/wikimedia/wikimedia-fundraising-SmashPig/blob/master/PaymentData/ReferenceData/CurrencyRates.php
// Updated 2024-07-31
Line 97 ⟶ 95:
'IEP' : 0.72460490043714,
'ILS' : 3.69,
'INR' :
'IQD' : 1290,
'IRR' : 42009,
Line 220 ⟶ 218:
/* Localize the amount errors. Call when initialising form. */
donationForm.localizeErrors = function() {
var currency
minAmount = donationForm.minimums[ currency ],▼
locale = donationForm.getLocale( mw.config.get('wgPageContentLanguage'), donationForm.country );
$('.lp-error-smallamount').text( function( index, oldText ) {
return oldText.replace( '$1', donationForm.formatAmount(
});
Line 240 ⟶ 234:
$('.lp-error-bigamount').text( function( index, oldText ) {
return oldText.replace( '$1', donationForm.formatAmount( donationForm.
.replace( '$2', currency )
.replace( '$3', 'benefactors@wikimedia.org' )
Line 929 ⟶ 923:
var amount = donationForm.getAmount();
var minAmount = donationForm.minimums[ donationForm.currency ] || 1;▼
if ( amount === null || isNaN(amount) || amount <= 0 || amount <
$('.amount-options').addClass('lp-haserror');
$('.lp-error-bigamount').hide();
$('.lp-error-smallamount').show();
return false;
} else if ( amount > donationForm.
$('.amount-options').addClass('lp-haserror');
$('.lp-error-bigamount').show();
Line 959 ⟶ 952:
var selectedAmount = donationForm.getAmount(),
feeAmount = donationForm.calculateFee( selectedAmount ),
minAmount = donationForm.minimums[ donationForm.currency ] || 1,▼
maxAmount = donationForm.maxUSD * minAmount,▼
feeText, locale;
Line 967 ⟶ 958:
$('.ptf label span').text( feeText );
if ( selectedAmount + feeAmount <=
$('.ptf').slideDown();
}
Line 1,314 ⟶ 1,305:
}
donationForm.country = mw.util.getParamValue('country').toUpperCase();
// Minimum amount is usually about 1 USD
▲
donationForm.minLocal = Math.ceil( donationForm.minLocal * 100 ) / 100; // Round it up
▲
// Overrides for India
donationForm.minLocal = 10;
// Until https://phabricator.wikimedia.org/T370583 fixed?
donationForm.maxLocal = 250000;
}
// Block typing symbols in Other field
|