Page MenuHomePhabricator

Add multiple currency support to Braintree
Closed, ResolvedPublic

Description

Looks like we might need separate merchant accounts for each currency.

Verify that we do, and if so, add code to support it.

Should be done at the SmashPig layer so that the calling code can just pass currency normally and the SmashPig layer can decide which credentials based on a map in settings.

Event Timeline

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

[wikimedia/fundraising/SmashPig@master] Add merchantId if currency is not USD and has account to support it

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

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

[mediawiki/extensions/DonationInterface@master] Check if currency supported by braintree merchant account

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

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

[wikimedia/fundraising/dev@master] Add extra braintree test link for recurring and CAD GBP

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

Based on this currency supported list. (https://developer.paypal.com/reference/currency-codes/#paypal-account-payments provided by braintree), need to have an extra AC as do not pass decimal for those countries HUF, JPY and TWD and we will not accept BRL, CNY, MYR since those accounts required local paypal account to receive money while we want to maintain only one paypal account.

So test steps will be:

make sure you have the unique order id by go to smashpig box, then run
docker@smashpig:/srv/smashpig$
php Maintenance/InitializeSequence.php contribution-tracking <unique id you want to have>

then test with link (which HUB JPY and TWD will remove decimal):
AUD: WMF-AUD
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=AUD&amount=2.5&country=US

CAD: WMF-CAD
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=CAD&amount=2.5&country=US

CHF: WMF-CHF
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=AUD&amount=2.5&country=US

CZK: WMF-CZK
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=AUD&amount=2.5&country=US

DKK: WMF-DKK
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=AUD&amount=2.5&country=US

EUR: WMF-EUR
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=EUR&amount=2.5&country=US

GBP: WMF-GBP
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=GBP&amount=2.5&country=US

HKD: WMF-HKD
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=HKD&amount=7.77&country=US

HUF: WMF-HUF
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=HUF&amount=315.77&country=US

ILS: WMF-ILS
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=ILS&amount=3.5&country=US

JPY: WMF-JPY
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=JPY&amount=115.6&country=US

MXN: WMF-MXN
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=MXN&amount=20.6&country=US

NOK: WMF-NOK
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=NOK&amount=8.5&country=US

NZD: WMF-NZD
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=NZD&amount=8.5&country=US

PHP: WMF-PHP
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=PHP&amount=51.5&country=US

PLN: WMF-PLN
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=PLN&amount=5.5&country=US

RUB: WMF-RUB
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=RUB&amount=70.5&country=US

SEK: WMF-SEK
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=SEK&amount=9.5&country=US

SGD: WMF-SGD
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=SGD&amount=2.5&country=US

THB: WMF-THB
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=THB&amount=33.5&country=US

TWD: WMF-TWD
https://localhost:9001/index.php?title=Special:BraintreeGateway&appeal=JimmyQuote&payment_method=paypal&recurring=0&uselang=en&language=en&currency=TWD&amount=28.5&country=US

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

[mediawiki/extensions/DonationInterface@master] Add more invalid error translation currency, order_id and payment_token

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

Change 822195 merged by Ejegg:

[wikimedia/fundraising/dev@master] Add extra braintree test link for recurring and CAD GBP, round HUF

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

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

[wikimedia/fundraising/SmashPig@master] Braintree multi-currency minor tweaks

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

Change 828131 merged by jenkins-bot:

[wikimedia/fundraising/SmashPig@master] Braintree multi-currency minor tweaks

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

Change 826653 abandoned by Wfan:

[mediawiki/extensions/DonationInterface@master] Add more invalid error translation currency, order_id and payment_token

Reason:

no need to show message for error client not able to fix

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

Change 822191 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Check if currency supported by braintree merchant account

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

Ejegg set Final Story Points to 8.