MediaWiki:DonationFormSandbox.js: Difference between revisions

Content deleted Content added
No edit summary
base64 decode recipient_id if needed
 
(5 intermediate revisions by the same user not shown)
Line 255:
{}
)
};
 
// currencyDisplay: 'narrowSymbol' fixes some issues like en-CO showing the ISO code
Line 840:
}
 
// TODO: refactor this to a list of parameters to pass unchanged
// or just pass everything by default?
if ( mw.util.getParamValue( 'pym_appeal' ) ) {
params.appeal = mw.util.getParamValue( 'pym_appeal' );
}
// https://phabricator.wikimedia.org/T381405
if ( mw.util.getParamValue( 'contact_id' ) ) {
params.contact_id = mw.util.getParamValue( 'contact_id' );
}
if ( mw.util.getParamValue( 'contact_hash' ) ) {
params.contact_hash = mw.util.getParamValue( 'contact_hash' );
}
// SMS
var recipient_id = mw.util.getParamValue( 'recipient_id' );
if ( recipient_id ) {
if ( isNaN( parseFloat( recipient_id ) ) ) {
// Lop off last 2 characters and decode base64
params.recipient_id = atob( recipient_id.slice(0, -2) );
} else {
params.recipient_id = recipient_id;
}
}
 
Line 864 ⟶ 883:
donationForm.finalStep = function( params ) {
 
var uriurl = new mw.UriURL('https://payments.wikimedia.org/index.php/Special:GatewayChooser');
 
// Skip form chooser for Apple Pay / Google Pay
if ( params.payment_method === 'apple' || params.payment_method === 'google' ) {
uriurl = new mw.UriURL('https://payments.wikimedia.org/index.php/Special:AdyenCheckoutGateway');
}
 
// Skip form chooser for Venmo
if ( params.payment_method === 'venmo' ) {
uriurl = new mw.UriURL('https://payments.wikimedia.org/index.php/Special:BraintreeGateway');
}
 
Line 888 ⟶ 907:
}
 
urifor ( var key of Object.extendkeys( params ); ) {
url.searchParams.set( key, params[key] );
}
 
if ( window.top !== window.self ) {
// In a frame, open payments in a new tab
window.open( uriurl.toString() );
} else {
window.location.href = uriurl.toString();
}
};
Line 1,470 ⟶ 1,491:
}
}
 
// Dumb hack to remove ACH for Portal test against Fundraise Up
if ( mw.util.getParamValue( 'wmf_source' ) === 'portalBanner_en6C_2024_overlayBanner4WikiForm' ) {
$('.paymentmethod-ach').remove();
}
 
}