Page MenuHomePhabricator

Monthly convert: min/max logic
Closed, ResolvedPublic2 Estimate Story Points

Description

Hey @Ejegg, after we finished our meeting, I realized that the first place to start with monthly convert would be to see if we can implement this UX improvement requested by Michael and Donor Services. We adopted this in banners just last week. This code change sets a minimum and maximum amount, under/above which the donor will not be shown the monthly convert modal.

To be clear: this isn't a variant - this should be the default functionality of the payments wiki monthly convert modal.

For us, this required two changes:

  1. Updating the javascript function
  2. Updating the "convert logic" with min and max values.

Re: the javascript, here's how the current best banner code looks:

frb.upsellPossible = function() {
    // Only do monthly upsell if initial selection is one-time and payment method supports monthly and upsell value is not 0 (meaning skip)
    if ( frb.getRecurring(document.getElementById('frb-form')) || 
         !frb.shouldShowRecurring( frb.storedOptions, mw.centralNotice.data.country ) ||
         form.otherMonthlyAmount.value == 0 ) {
        return false;
    } else {
        return true;
    }
}

And here's the convert logic that accompanies it in banners. Please note that this requires a different logic array for GB & IE, as the minimum there (1.99) is different than the 'dollar' minimum (2.75) in AU, CA, NZ & US.

// If one-time amount <= left amount, suggest right amount for monthly
frb.amounts.monthlySuggest = {
    'USD' : [ // also CAD, AUD, NZD
        [ 2.74, 0 ],
        [ 9, 1.75 ],
        [ 12, 2 ],
        [ 15, 2.5 ],
        [ 18, 3 ],
        [ 21, 3.5 ],
        [ 24, 4 ],
        [ 27, 4.5 ],
        [ 30, 5 ],
        [ 33, 5.5 ],
        [ 36, 6 ],
        [ 39, 6.5 ],
        [ 42, 7 ],
        [ 45, 7.5 ],
        [ 48, 8 ],
        [ 51, 8.5 ],
        [ 54, 9 ],
        [ 57, 9.5 ],
        [ 60, 10 ],
        [ 63, 10.5 ],
        [ 66, 11 ],
        [ 69, 11.5 ],
        [ 72, 12 ],
        [ 75, 12.5 ],
        [ 102, 17 ],
        [ 250, 25 ],
        [ 499, 50 ],
        [ Infinity, 0 ]
    ],
    'GBP' : [ // also EUR
        [ 1.99, 0 ],
        [ 9, 1.75 ],
        [ 12, 2 ],
        [ 15, 2.5 ],
        [ 18, 3 ],
        [ 21, 3.5 ],
        [ 24, 4 ],
        [ 27, 4.5 ],
        [ 30, 5 ],
        [ 33, 5.5 ],
        [ 36, 6 ],
        [ 39, 6.5 ],
        [ 42, 7 ],
        [ 45, 7.5 ],
        [ 48, 8 ],
        [ 51, 8.5 ],
        [ 54, 9 ],
        [ 57, 9.5 ],
        [ 60, 10 ],
        [ 63, 10.5 ],
        [ 66, 11 ],
        [ 69, 11.5 ],
        [ 72, 12 ],
        [ 75, 12.5 ],
        [ 102, 17 ],
        [ 250, 25 ],
        [ 499, 50 ],
        [ Infinity, 0 ]
    ]
};
frb.amounts.monthlySuggest.EUR = frb.amounts.monthlySuggest.GBP;
frb.amounts.monthlySuggest.CAD = frb.amounts.monthlySuggest.USD;
frb.amounts.monthlySuggest.AUD = frb.amounts.monthlySuggest.USD;
frb.amounts.monthlySuggest.NZD = frb.amounts.monthlySuggest.USD;

Details

Related Gerrit Patches:
mediawiki/extensions/DonationInterface : masterMonthly convert: switch suggested amount logic to use '<=' over '<'
mediawiki/extensions/DonationInterface : masterMonthly convert: better suggested amount, skip on min/max
mediawiki/extensions/DonationInterface : masterRename upsell to monthlyConvert

Event Timeline

spatton created this task.Nov 8 2019, 10:06 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 8 2019, 10:06 PM

Hang on a minute, @Ejegg - I am thinking about this and realizing it might be much easier to just set this check in the banners, and only send CC donors to the upsell variant if their one-time gift meets the min/max requirements.

But we'd still need an email solution. @Pcoombe, wonder what you think? Is it best to do this on payments wiki or donate wiki?

spatton added a subscriber: Ppena.Nov 8 2019, 10:31 PM

@spatton It's not a bad idea to do it on donatewiki, but I really don't have the time to work on adding that feature before December.

Makes sense @Pcoombe, these are the days of hydra tasks, where every completion spawns two new possibilities. Thanks for the fast response!

@Ejegg, I'm curious to get your assessment re: time to implement on payments wiki.

As I mentioned above ... I figure we can come up with a work around for banners. So then the question is email. @CCogdill_WMF, the point of this min/max logic is to suppress the monthly convert ask for donors giving less than a minimum or more than a maximum amount.

For U.S., CA, AU & NZ: minimum = 2.75 and maximum = 500 in local currency.
For GB & IE, minimum = 1.99 and maximum = 500 in local currency.

I figure that the maximum isn't much of an issue for email, bc you already suppress sends for people giving above some threshold. But do we have a lot of emails below the 2.75 / 1.99 minimum?

Ejegg added a comment.Nov 12 2019, 7:34 PM

@spatton, @Pcoombe, et al: should we change the variant name from 'upsell' to 'monthlyConvert' at the same time, or do you have 'upsell' coded in too many places by now?

spatton added a subscriber: mepps.Nov 12 2019, 7:35 PM

Yes please, @Ejegg, I'd be happy to make this improvement (suggested by @mepps a while ago) and it's no big bother to update our banners. TY for remembering it!

Change 550537 had a related patch set uploaded (by Ejegg; owner: Ejegg):
[mediawiki/extensions/DonationInterface@master] Rename upsell to monthlyConvert

https://gerrit.wikimedia.org/r/550537

Ejegg claimed this task.Nov 12 2019, 8:16 PM
Ejegg triaged this task as Medium priority.
Ejegg set the point value for this task to 2.

Change 550570 had a related patch set uploaded (by Ejegg; owner: Ejegg):
[mediawiki/extensions/DonationInterface@master] Monthly convert: better suggested amount, skip on min/max

https://gerrit.wikimedia.org/r/550570

Change 550537 merged by jenkins-bot:
[mediawiki/extensions/DonationInterface@master] Rename upsell to monthlyConvert

https://gerrit.wikimedia.org/r/550537

Change 550570 merged by jenkins-bot:
[mediawiki/extensions/DonationInterface@master] Monthly convert: better suggested amount, skip on min/max

https://gerrit.wikimedia.org/r/550570

Awesome @Ejegg, I'm seeing a slightly different result from what is expected in my QA testing of this new logic with minimum/maximum amounts.

Expected result: Submitting a $2.74 USD donation via the monthlyConvert variant will not trigger the monthly convert modal.
Observed result: I still get the modal.

I also tested at $2.50 USD and the form correctly bypasses the modal and goes straight to the TY page. I've hit the velocity filter and can't do more testing for a bit.

In banners, any gift less than or equal to 2.74 USD/CAD/AUD/NZD or less than or equal to 1.99 GBP/EUR does not trigger the monthlyConvert step. Could you confirm the pwk logic, please?

jgleeson added a subscriber: jgleeson.EditedNov 15 2019, 2:50 PM

I can what's up here. In the patch released yesterday, the code is checking if the donation amount is less than only and not equal to. You can see the logic here https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/DonationInterface/+/550570/4/modules/js/ext.donationInterface.monthlyConvert.js@83

I'll push up a fix now. @spatton can the deployment of this wait until Monday? we don't normally like making releases on a Friday.

Awesome @jgleeson, I was hoping it was as simple as a change in operator. Deployment on Monday sounds perfect 👌

Change 551197 had a related patch set uploaded (by Jgleeson; owner: Jgleeson):
[mediawiki/extensions/DonationInterface@master] Monthly convert: switch suggested amount logic to use '<=' over '<'

https://gerrit.wikimedia.org/r/551197

Change 551197 merged by jenkins-bot:
[mediawiki/extensions/DonationInterface@master] Monthly convert: switch suggested amount logic to use '<=' over '<'

https://gerrit.wikimedia.org/r/551197

Ejegg closed this task as Resolved.Nov 19 2019, 3:57 PM