You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org
Fundraising/Data and flow/PSP integrations/Form Chooser
We use form chooser as a middleware to select payment gateway for donor based on their country, and selected payment method, then prioritize the final gateway base on certain rule.
This is been used from our https://donate.wikimedia.org/ we choose the corespondent currency for country and gateway based on both country and payment method like cc or apple, stands for credit card and apple pay, and other params like payment submethod as visa amex and so on.
Then after select the target gateway like ingenico or adyen, return payment form and update the url to the target gateway.
For each payment gateway we have countries.yaml file that contains all the supported countries, this would be the first thing to check for supported gateway
Then check if support recurring, or sub-method supported ...
Then finally use rule (extension.json as DonationInterfaceGatewayPriorityRules) to select the target gateway
We can go to DI box
docker-compose exec -w "/var/www/html/" payments /bin/bash
then test testAssertExpectedGateway to test all the target gateway
php tests/phpunit/phpunit.php --filter testAssertExpectedGateway