You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Fundraising/Development tools/Testing

From Wikitech-static
Jump to navigation Jump to search

Overview

There are many different software stacks and configurations involved with testing WMF fundraising code and its interactions with external services.

Unit Tests

Resources

Fundraising/Data and flow/Queues/Testing

Logging

PSP Specific Instructions

Adyen

Test Card Details

https://docs.adyen.com/development-resources/test-cards/test-card-numbers


Testing out Ayden Instant Payment Notifications(IPN) Messages

Adyen allows you to specify an endpoint to receive IPN messages generated in relation to transactions put through their https://test.adyen.com payment gateway. To allow Adyen to send IPNs to your local vagrant web server you need to give it a publicly accessible URL. You can do this with ngrok and capture the IPN messages locally using the following steps:

  1. Confirm your local payments-listener endpoint is working as expected by browsing to https://localhost:9006/adyen on your host machine (you should see a SOAP Bad Request warning when hitting that endpoint via a browser - which means the SoapServer is working)
  2. Signup, download & unzip ngrok to a location in your $PATH (e.g. /usr/local/bin)
  3. Launch ngrok on your host machine and point it to your local payments-listener endpoint using the following:
$ ngrok http https://localhost:9006
  1. Log into the Adyen Test console here https://ca-test.adyen.com/ca/ca/login.shtml
    1. Go to Accounts > Server Communication
    2. Add a new 'Standard Notification' profile (you should see existing profiles with URLs pointing to other test endpoints)
    3. Drop in your ngrok generated URL with the route for Adyen (e.g. http://6bb27a9c.ngrok.io/adyen)
    4. Set method to SOAP
    5. At this point you can scroll to the bottom and click the 'Test Configuration' button which should trigger a bunch of SOAP calls to your local payments listener via the ngrok URL. Check out the ngrok terminal display to see a list of received incoming requests e.g:
    6. If the above worked as expected. Save the configuration. You can also tweak the profile settings to suit your needs.
  2. Submit an Adyen test donation via your local Paymentswiki using the Test URL for vagrant users above. If you want to see the raw SOAP XML Adyen sends in the IPN after you donate, open a terminal window on your vagrant vm and drop in:
sudo tail -f /var/log/syslog | grep --color=always soap
  1. You should now have a message in your local redis jobs-adyen queue as a result of the IPN being received and processed. You can read more about the job messages generated and data flow of Adyen here
  2. (Optional Step) If the messages disappear from your queues too quickly for your liking it's because your Smashpig Adyen QueueJobRunner cron is processing those for you. Head over to /etc/cron.d/SmashPig and comment out the Adyen QueueJobRunner cron if you'd like to run it yourself and debug further. You can then run it manually by using:
/vagrant/srv/SmashPig$ php Maintenance/QueueJobRunner.php --queue jobs-adyen --config-node adyen
Adyen - iDEAL Recurring

iDEAL recurring uses the RECURRING_CONTRACT ipn to finish the original donation and setup the recurring donation.

Steps:

1. Create a new iDEAL recurring donation with country=NL, payment_method=rtbt, and currency=EUR https://localhost:9001/index.php?title=Special:AdyenCheckoutGateway&appeal=JimmyQuote&payment_method=rtbt&recurring=1&uselang=en&language=en&currency=EUR&amount=5.55&country=NL&ffname=adyen&first_name=Jimmy&last_name=Wales&street_address=1+Montgomery+Street&city=San+Francisco&state_province=CA&postal_code=94104&email=jwales%40example.com&debug=true

In Adyen's console the inital donation will be payment method iDEAL (subsequent recurrings will be SEPA Direct Debit) with Recurring contract=RECURRING,ONECLICK

2. Consume the pending queue, from the SmashPig container in `srv/smashpig` run `php maintenance/ConsumePendingQueue.php` This adds what was in the queue into SmashPig pending database

3. The incoming ipn messages are processed and put onto the jobs-adyen queue, you can consume that from the SmashPig container in `srv/smashpig` with `php Maintenance/QueueJobRunner.php --queue jobs-adyen --config-node adyen` The RECURRING_CONTRACT ipn does take ~1 minute to appear.

When the RECURRING_CONTRACT ipn is in the jobs-adyen queue, it will find the matching pending entry, create a donations queue message, and delete the pending entry.

Amazon

TODO

Astropay

TODO

Test URL: http://payments.wiki.local.wmftest.net:8080/wiki/Special:AstroPayGateway?appeal=JimmyQuote&payment_method=cc&recurring=&uselang=en&language=en&currency_code=BRL&amount=100&country=BR&ffname=astropay

GlobalCollect (Legacy Ingenico)

You must use the full vpn because they whitelist the source IP. $wgGlobalCollectGatewayMerchantID must be set to the correct value and the API endpoint should be the one with the .nl TLD.

Test URL: http://payments.wiki.local.wmftest.net:8080/wiki/Special:GlobalCollectGateway?appeal=JimmyQuote&ffname=cc-vmad&recurring=&payment_method=cc&utm_key=&referrer=&language=en&country=US&returnto=Thank_You%2525252Fen&amountGiven=&currency_code=USD&frequency=onetime&amount=3&uselang=en

IDEAL BPay Test URL (Netherlands bank transfer): http://payments.wiki.local.wmftest.net:8080/wiki/Special:GlobalCollectGateway?appeal=JimmyQuote&recurring=&payment_method=obt&utm_key=&language=en&country=AU&returnto=Thank_You%252Fen&amountGiven=&currency_code=AUD&frequency=onetime&amount=3&uselang=en

Ingenico Connect

No VPN needed! Note that account configuration lives in the SmashPig yaml files rather than in LocalSettings.php.

PayPal Express Checkout

TODO

Test URL: http://payments.wiki.local.wmftest.net:8080/wiki/Special:PaypalExpressGateway?country=JP&amount=500&payment_method=paypal