MediaWiki:DonationForm.js: Difference between revisions

Content deleted Content added
fix phab:T289247 - simplify preSelect values with extra decimal places to select preset buttons
add check for Apple Pay support, remove button if not supported
Line 1,078:
*
* Currently only used in monthlyconvert, but this could be useful
*
* @param {string} language
* @param {string} country
Line 1,094:
}
return language + '-' + country;
};
 
/**
* Should we show Apple Pay?
*
* Note there is a ~500ms delay in Safari when checking, so only call this if needed
*
* @param {string} country
* @return {boolean}
*/
donationForm.shouldShowApplePay = function ( country ) {
// TODO: Add country logic when we get a list from payments
if ( location.search.match('forceApplePay') ) {
return true;
}
if ( window.ApplePaySession ) {
if ( ApplePaySession.canMakePayments() ) {
return true;
}
}
return false;
};
 
Line 1,142 ⟶ 1,163:
 
addCardTypesClass( donationForm.country );
 
// Apple Pay
if ( $('.paymentmethod-applepay').length > 0 ) {
if ( !donationForm.shouldShowApplePay( donationForm.country ) ) {
$('.paymentmethod-applepay').remove();
}
}
}