MediaWiki:MonthlyConvert.js: Difference between revisions
Content deleted Content added
re-use donationForm.parseOtherAmount |
No edit summary |
||
Line 123:
mc.amounts.NZD = mc.amounts.USD;
mc.
var i,
amountsForCurrency = mc.amounts[ currency ],
Line 141:
mc.formatAmount = function ( amount, currency, locale ) {
var formattedAmount;
try {
formattedAmount = amount.toLocaleString( locale, { currency: currency, style: 'currency' } );
Line 154 ⟶ 153:
var otherInput = document.getElementById('mc-other-amount-input'),
otherAmount = null;
if ( otherInput.value !== '' ) {
otherAmount = donationForm.parseOtherAmount( otherInput.value );
}
return otherAmount;
};
Line 189 ⟶ 186:
};
mc.main = function(
var
currency = params.currency,
suggestedAmount = mc.getSuggestedAmount( initialAmount, currency ),
locale = 'en-US';
if ( params.recurring ) {
// Already recurring
}
if ( donationForm.noRecurringCountries.indexOf( params.country ) !== -1 ) {
// Country where we don't offer any recurring
return params;
}
if ( suggestedAmount === 0 ) {
// Amount too low, or we don't have any suggestions
▲ return false;
return params;
}
if (
( params.paymentMethod === 'paypal' ) ||
( params.paymentMethod === 'rtbt' && params.payment_submethod === 'rtbt_ideal' ) ||
( params.paymentMethod === 'cc' && params.gateway === 'adyen' )
) {
// suitable method!
} else {
return params;
}
$('.mc-
$('.mc-amt-initial').text( mc.formatAmount( initialAmount, currency, locale) );
$('.mc-amt-suggest').text( mc.formatAmount( suggestedAmount, currency, locale ) );
|