Page MenuHomePhabricator

Refactor fail page logic
Closed, ResolvedPublic

Description

Context: This is part of the Form Chooser refactor because we want to get rid of the ffname data object and the error form configuration in DonationInterfaceFormSettings.

Passing around ffname shouldn't be necessary - move logic from the error page config in DonationInterfaceFormSettings and FormChooser::getBestErrorForm to MustacheErrorForm

A good first step in this ticket would be to make MustacheErrorForm::addMessageParameters not depend on ffname. It can instead use a series of if tests of e.g. $this->adapter->getFinalStatus() to determine which string to show. Note that the 'noform' string is likely unreachable at that point, as the MustacheErrorForm needs a gateway object to be rendered. The 'maintenance' form should be shown when $wgDonationInterfaceFundraiserMaintenance is set to true.

While we are refactoring the fail pages, we can also simplify them a bit so our dev sites always work the same as production.

There has historically been a 'RapidFail' global that when true instructs DI to render error pages as mustache forms in the current request. When false, DI consults the 'FailPage' global and assumes that is the title of a wiki page to redirect donors to on error.

This refactor should remove the 'RapidFail' global and always render a mustache form. The DonationInterfaceFailPage global should be removed.

Other functions that will need changes, with suggestions:

GatewayPage::displayFailPage: if $this->adapter does exist, call $this->adapter->addRequestData( [ 'showError' => true ] ); rather than ResultPages::getFailPage. When the adapter does not exist, call $this->getOutput()->showErrorPage with the default error message, similar to what we already do in GatewayFormChooser when there is no form chosen.

GatewayAdapter::getFormClass: stop looking at ffname substrings - if the showError request parameter is true, return MustacheErrorForm, otherwise Gateway_Form_Mustache

Anywhere we are calling ResultPages::getFailPage to get a fail page URL to use from client-side logic (i.e. Adyen Checkout), make a simple boolean querystring value (e.g. showError=1) trigger showing the error page instead of a payments form. This way the client-side logic doesn't need to consult a mwConfig value for the url - it can just reload the existing page with that extra querystring value appended.

Event Timeline

Change 791400 had a related patch set uploaded (by Wfan; author: Wfan):

[mediawiki/extensions/DonationInterface@master] wip: get the error parameters without relay on ffname

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

Change 791628 had a related patch set uploaded (by Wfan; author: Wfan):

[mediawiki/extensions/DonationInterface@master] wip: Clear adyen ffname replaced with showError as request param

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

Change 792234 had a related patch set uploaded (by Wfan; author: Wfan):

[mediawiki/extensions/DonationInterface@master] fail page logic

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

Change 792234 abandoned by Wfan:

[mediawiki/extensions/DonationInterface@master] fail page logic

Reason:

extra test

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

Change 792234 restored by Wfan:

[mediawiki/extensions/DonationInterface@master] fail page logic

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

Change 791400 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] get the error parameters without relay on ffname

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

Change 792641 had a related patch set uploaded (by Wfan; author: Wfan):

[wikimedia/fundraising/dev@master] fail page logic

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

Change 792674 had a related patch set uploaded (by Ejegg; author: Ejegg):

[mediawiki/extensions/DonationInterface@master] Remove 'noform' mustache template bits

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

Change 792674 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Remove 'noform' mustache template bits

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

Change 797334 had a related patch set uploaded (by Wfan; author: Wfan):

[mediawiki/extensions/DonationInterface@master] wip: Amazon ffname to showError

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

Change 797334 abandoned by Wfan:

[mediawiki/extensions/DonationInterface@master] wip: Amazon ffname to showError

Reason:

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

Change 792234 abandoned by Wfan:

[mediawiki/extensions/DonationInterface@master] fail page logic

Reason:

merged to https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DonationInterface/+/791628/12..13

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

Change 791628 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Use showError as request param instead of error-xx from ffname

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

Change 797750 had a related patch set uploaded (by Wfan; author: Wfan):

[mediawiki/extensions/DonationInterface@master] remove depreciated globalcollect getForm function

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

Change 792641 merged by Ejegg:

[wikimedia/fundraising/dev@master] fail page logic

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

XenoRyet set Final Story Points to 4.