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

From Wikitech-static
< Fundraising‎ | Data and flow‎ | PSP integrations
Revision as of 23:29, 1 September 2022 by imported>Wfan (→‎Overview)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

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

Testing

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