Page MenuHomePhabricator

GatewayChooser edge case: allow choosing gateway that doesn't support currency when CurrencyFallback is on
Closed, ResolvedPublic

Description

We have a feature to fall back to a supported currency and convert the donation amount when an unsupported currency is specified. The GatewayChooser should allow matching on a gateway with no support for the specified currency when that gateway has CurrencyFallback on. Probably we should still prefer gateways that have the currency supported though - maybe the fallback happens in a second round if there are no matches in the first round?

Event Timeline

Ejegg moved this task from Triage to Current Sprint on the Fundraising-Backlog board.

Oops, we actually do need this to deploy the GatewayChooser refactor. When I tried deploying it without this, we were wrongly denying a lot of South American PayPal donors.

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

[mediawiki/extensions/DonationInterface@master] Consider FallbackCurrency when choosing gateway

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

Change 804981 had a related patch set uploaded (by AndyRussG; author: AndyRussG):

[mediawiki/extensions/DonationInterface@master] GatewayChooser select_if_unsupported_currency

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

I'd like to suggest a different approach from the one in the first linked patch and in the task description.

tl;dr: It seems that the functionality currently controlled by the two FallbackCurrency globals is funky, is only partly used on production, and itself needs review. Instead of worrying about it, maybe for now let's just add a new yaml setting that only impacts GatewayChooser. Proposed patch is here.

In production settings, DonationInterfaceFallbackCurrency is only enabled on a per-gateway basis, never globally. DonationInterfaceFallbackCurrencyByCountry is not used on production at all. The two gateways with the first of these enabled on production are PayPal and Amazon.

Looking a the actual difference in functionality, for example, for paypal_ec:

  • If the user reaches the gateway page with an unsupported currency on the URL, and $wgPaypalExpressGatewayFallbackCurrency is set to USD (or some other currency), the form lets the user choose a different currency, and shows a message that says, "Your currency was unsupported. Processing will take place using USD, if you decide to continue." This is actually incorrect. As far as I can tell, the donation will be processed in whatever currency the user selects.
  • On the other hand, if the user reaches the gateway page with an unsupported currency on the URL, and $wgPaypalExpressGatewayFallbackCurrency is false (the default), the form still lets the user choose a different currency, and the message is, "Please select a valid currency." This seems more correct and indicative of what the donor should do.

Here is a local test URL. On fundraising-dev, the setting is in config-private/payments/LocalSettings-private.php. (Also, you might wish to pull down the latest change in that repo to get rid of the duplicate setting for that variable there.)

On production and locally, many gateways seem to work fine if you arrive at the gateway page with an unsupported currency on the URL. Here's what we get on production for Ingenico and Adyen, neither of which have the setting enabled. For Amazon, which does have the setting enabled on prod, you can see the "Processing will take place using USD, if you decide to continue" message flash briefly before you're redirected to Amazon, with no user interaction. (Amazon only supports USD, so it wouldn't make sense to let the user choose a different currency, though I imagine we should tell them about the conversion.)

The current (still old) behaviour on prod for GatewayChooser isn't the same as the what we'd get by following FallbackCurrency settings. In DonationInterface/DonationInterfaceFormSettings.php, the fallback behaviour is implemented just by omitting the currencies key from the form's array. In addition to PayPal and Amazon passing through links with unsupported currencies, there are country-specific Adyen form settings that do the same. So, you can't donate from the US via credit card with an unsupported currency, but you can from Canada.

In view of all this apparent jankiness, I'd suggest we address the immediate problem for PayPal donors with a simpler approach: add a new yaml setting to control only GatewayChooser behaviour for links with unsupported currencies. For the rest, maybe we should scope out what we behaviour really want, check details wtih stakeholders, etc.? Here's a new task for that: T310461.

Really hope this makes sense! Thanks so much!!!

Change 804981 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] GatewayChooser still_include_if_currency_is_not_supported

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

XenoRyet set Final Story Points to 2.