Page MenuHomePhabricator

Make easy on/off switch for Monthly covert
Closed, ResolvedPublic2 Estimated Story Points

Description

As an fr-tech team member I need an easy way to quickly shut off monthly convert for donors in specific countries in the event of an issue.

DoD:
This should be configurable by country and no longer in a variant.
per @Ejegg "I think the idea with that ticket is to move monthlyConvert away from being a variant and instead make it contingent on a new global settings var that would have a list of countries for which it is enabled"

One edge case came up kind of late: this cannot be shown to endowment donors. How hard would it be to add that?

Event Timeline

DStrine set the point value for this task to 2.Sep 15 2020, 8:37 PM
DStrine moved this task from Sprint +1 to Current Sprint on the Fundraising-Backlog board.

@DStrine Which monthly convert variant would be the main one? the one at variant=monthlyConvert?

Yes @Cstone, you're correct; variant=monthlyConvert should be the main one! TY.

mepps subscribed.

I might take a look at this tomorrow.

I just realized I assumed that this task was about making monthlyConvert the default and then being able to turn it off. Just in case, it occurred to me another way it could be read is being able to turn off access to the variant itself. Either way, my questions about where to put the code will persist.

Okay so I'm assuming we're making this a config variable.
For scenario 1: I'm currently considering putting getVariant() in ingenico_gateway.body.php because it would overwrite that function in GatewayPage. I would have it first get the variant from the parent method, then check if it's a monthly convert variant. If it's not, I'd want to set it to a monthly convert. The problem here is that if it's employer, we'd overwrite that.

I think scenario 2 is unlikely as I think about it.

Based on irc conversation with @Ejegg, it sounds like want this to be a permanent option, in which case, it may involve more restructuring than I realized.

I was wondering if a good place to put this is in readConfig, or at least to put in an option to read an extra config. However, the issue is if we have two variants, the scripts of one would overwrite the scripts of the second.
I think now there'll be a way to put a switch in the form to load the js extension if this config is set for the country.
My next question is should I put this in ingenico, or make it general enough that any adapter could use something like this eventually?

@Ejegg is recommending we use the showMonthlyConvert method in gatewayadapter then getResources in Mustache.

Change 632793 had a related patch set uploaded (by Mepps; owner: Mepps):
[mediawiki/extensions/DonationInterface@master] Create $wgMonthlyConvertCountries, addVariant method for ConfiguratonReader Allows turning on and monthlyConvert modal by country

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

Notes based on @Ejegg's feedback:
To know that we need to add the monthly convert extension in Mustache.php we need to know that

  • The current country is in MonthlyConvertCountries
  • No other monthlyconvertvariant has been called
  • The current adapter is one that should have recurringConversion enabled

Where showMonthlyConvert() is called is pretty late in the code to add the resources.
Potentially we could move this higher up.
There's a lot lot of logic in that method it'd be nice not to have to repeat.
Also I'll mention that my reason for using additionalResources originally is that my gut is that config variables shouldn't be accessed at the form layer.

Change 632793 merged by jenkins-bot:
[mediawiki/extensions/DonationInterface@master] Create $wgDonationInterfaceMonthlyConvertCountries Allows turning on base monthlyConvert variant by country

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

Change 635891 had a related patch set uploaded (by Mepps; owner: Mepps):
[mediawiki/extensions/DonationInterface@master] WIP: Pull adapter resources out of mustache, consolidate monthlyconvert logic

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

Change 635891 abandoned by Mepps:

[mediawiki/extensions/DonationInterface@master] WIP: Pull adapter resources out of mustache, consolidate monthlyconvert logic

Reason:

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