Jump to content

Fundraising/Data and flow/Queues/Testing

From Wikitech

First steps for all

  • CentralNotice banner or donatewiki (later)
  • watch for messages being pushed to redis:
/vagrant$ redis-cli monitor | grep RPUSH
  • submit donation form, which adds messages to pending queue
    • Works for Amazon as long as you are using https (vagrant roles enable https), returnURL is https://payments.wiki.local.wmftest.net:4430/w/index.php?title=Special:AmazonGateway and you are in test mode. Need to use test accounts from Amazon payments console
    • AstroPay: need VPN, and need to use credit card 'GNB', only enabled for BR when $wgAstroPayGatewayTest = true 
      • Name: ASTROPAY TESTING
      • Cpf: 00003456789
      • Email: testing@astropaycard.com
  • Consume pending to db
/vagrant/srv/SmashPig$ php Maintenance/ConsumePendingQueue.php

if docker

docker@smashpig:/srv/smashpig$ php Maintenance/ConsumePendingQueue.php
  • clear pending transactions from smashpig pending db with certain payment methods and already pending more than certain days

if docker

docker@smashpig: php Maintenance/DeleteExpiredPendingMessages.php --gateway=ingenico --days=1
  • consume antifraud and payments-init queue messages
drush --user=1 -v -r /vagrant/srv/org.wikimedia.civicrm/drupal afqc
drush --user=1 -v -r /vagrant/srv/org.wikimedia.civicrm/drupal piqc

if docker

docker@civicrm:/srv/civi-sites/wmff/drupal$ drush --user=1 -v -r afqc 
docker@civicrm:/srv/civi-sites/wmff/drupal$ drush --user=1 -v -r piqc

if want to check the contribution tracking then run

docker@civicrm:/srv/civi-sites/wmff/drupal$ drush --user=1 -v -r ctqc

Adyen

( To test Redis job queue, make data-store/jobs config look like data-store/pending-new, with queue name changed to 'jobs', and replace StompJobRunner.php below with QueueJobRunner.php )

  • Create fake IPN messages matching pending queue messages
/vagrant/srv/SmashPig$ php Maintenance/CreateIpnMessagesFromPendingDb.php adyen
  • Simulate auth IPN listener hits
/vagrant/srv/SmashPig$ Tests/SoapInjector/soapinject.py payments-listener.local.wmftest.net '/smashpig_http_handler.php?p=adyen/listener' auth_success.10.1.xml
  • run JobRunner to perform mock capture requests and send more antifraud queue messages
    • You can set your SmashPig.yaml to use a mock API endpoint to avoid hitting even the adyen test system, see PaymentProviders/Adyen/Tests/config_test_success.yaml
/vagrant/srv/SmashPig$ php Maintenance/StompJobRunner.php --config-node adyen
  • consume antifraud queue messages
drush --user=1 -v -r /vagrant/srv/org.wikimedia.civicrm/drupal fqc
  • Simulate capture IPN listener hits
/vagrant/srv/SmashPig/Tests$ ./soapinject.py payments-listener.local.wmftest.net '/smashpig_http_handler.php?p=adyen/listener' ../../adyen-12345-captures.xml
  • run JobRunner to combine pending messages and send to completed queue
/vagrant/srv/SmashPig$ php Maintenance/StompJobRunner.php --config-node adyen

Amazon

  • Create fake IPN messages matching pending queue messages
/vagrant/srv/SmashPig$ php Maintenance/CreateIpnMessagesFromPendingDb.php amazon
  • Simulate capture completed IPN listener hit - listener will add completed queue message with indication to look in pending queue for missing details
    • Maybe need to create a MockIpnHandler
/vagrant/srv/SmashPig$ PaymentProviders/Amazon/Tests/inject.py payments-listener.local.wmftest.net '/smashpig_http_handler.php?p=amazon/listener' CaptureCompleted.7-0.json

AstroPay

  • Create fake IPN messages matching pending queue messages
/vagrant/srv/SmashPig$ php Maintenance/CreateIpnMessagesFromPendingDb.php --config-node astropay astropay
  • Simulate successful payment IPN listener hit - listener will add completed queue message with indication to look in pending queue for missing details
/vagrant/srv/SmashPig$ curl -d @success.37956.2.curl http://payments-listener.local.wmftest.net/smashpig_http_handler.php?p=astropay/listener

Ingenico

PayPal

Last steps for all

(if already in the right dir do not need -r xxxx)

  • Run donations queue consumer
drush --user=1 -v -r /srv/civi-sites/wmff/drupal qc
  • Run recurring queue consumer
drush --user=1 -v -r /srv/civi-sites/wmff/drupal rqc
  • Run unsubscribe/optin queue consumer
drush --user=1 -v -r /srv/civi-sites/wmff/drupal unsubqc
  • Run TY mail sender (is vagrant configured to fake email safely?) -
drush eval --user=1 -v -r /vagrant/srv/org.wikimedia.civicrm/drupal 'drush_thank_you();'

Refunds

drush --user=1 -v -r /srv/civi-sites/wmff/drupal rfdqc