Ejegg has uploaded a new change for review.

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

Change subject: Merge branch 'master' into deployment
......................................................................

Merge branch 'master' into deployment

And delete tests

e62d0dd Check payments_init for 'failed' in pending QC
e90d0fa stop mirroring verified
2597741 Don't log an error when delaying a message
dabacb4 Robustify original date logic
1b9669a Quick fix to turn off Stomp mirroring
c90adf1 Use redis for Adyen jobs
f442b36 Some logging in PP listener

Change-Id: I5378b85dd693b6923df5a095e7929181df7caf3d
---
D PaymentProviders/Adyen/Tests/config_test.yaml
D PaymentProviders/Adyen/Tests/phpunit/CaptureResponseActionTest.php
D PaymentProviders/Adyen/Tests/phpunit/PaymentCaptureActionTest.php
D PaymentProviders/PayPal/Tests/Data/refund.json
D Tests/PendingQueueConsumerTest.php
5 files changed, 0 insertions(+), 381 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/69/315569/1

diff --git a/PaymentProviders/Adyen/Tests/config_test.yaml 
b/PaymentProviders/Adyen/Tests/config_test.yaml
deleted file mode 100644
index b25fb6f..0000000
--- a/PaymentProviders/Adyen/Tests/config_test.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
-<<<<<<< HEAD   (fa0267 Merge branch 'master' into deployment)
-=======
-adyen:
-    data-store:
-
-        payments-antifraud:
-            class: PHPQueue\Backend\PDO
-            constructor-parameters:
-                -
-                    connection_string: 'sqlite::memory:'
-
-        verified:
-            class: PHPQueue\Backend\PDO
-            constructor-parameters:
-                -
-                    connection_string: 'sqlite::memory:'
-
-        jobs-adyen:
-            class: PHPQueue\Backend\PDO
-            constructor-parameters:
-                -
-                    connection_string: 'sqlite::memory:'
-
-        pending-db:
-            class: PDO
-            constructor-parameters:
-                - 'sqlite::memory:'
-
-    payment-provider:
-        adyen:
-            api:
-                class: 
SmashPig\PaymentProviders\Adyen\Tests\MockAdyenPaymentsAPI
->>>>>>> BRANCH (f442b3 Some logging in PP listener)
diff --git a/PaymentProviders/Adyen/Tests/phpunit/CaptureResponseActionTest.php 
b/PaymentProviders/Adyen/Tests/phpunit/CaptureResponseActionTest.php
deleted file mode 100644
index 1977ca4..0000000
--- a/PaymentProviders/Adyen/Tests/phpunit/CaptureResponseActionTest.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-namespace SmashPig\PaymentProviders\Adyen\Tests;
-
-use PHPQueue\Interfaces\FifoQueueStore;
-use SmashPig\Core\Configuration;
-use SmashPig\Core\Context;
-use SmashPig\PaymentProviders\Adyen\Actions\CaptureResponseAction;
-use SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Capture;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-class CaptureResponseActionTest extends BaseSmashPigUnitTestCase {
-       /**
-        * @var Configuration
-        */
-       protected $config;
-
-       /**
-        * @var FifoQueueStore
-        */
-       protected $jobQueue;
-
-       public function setUp() {
-               parent::setUp();
-               $this->config = 
AdyenTestConfiguration::createWithSuccessfulApi();
-               Context::initWithLogger( $this->config );
-               $this->jobQueue = $this->config->object( 
'data-store/jobs-adyen' );
-               $this->jobQueue->createTable( 'jobs-adyen' );
-       }
-
-       public function testSuccessfulCapture() {
-               $capture = new Capture();
-               $capture->success = true;
-
-               $capture->correlationId = 'adyen-' . mt_rand();
-               $capture->merchantAccountCode = 'WikimediaTest';
-               $capture->currency = 'USD';
-               $capture->amount = 10.00;
-               $capture->originalReference = mt_rand();
-               $capture->merchantReference = mt_rand();
-
-               $action = new CaptureResponseAction();
-               $action->execute( $capture );
-
-               $job = $this->jobQueue->pop();
-
-               $this->assertEquals(
-                       'SmashPig\PaymentProviders\Adyen\Jobs\RecordCaptureJob',
-                       $job['php-message-class']
-               );
-               $sameProps = array(
-                       'currency', 'amount', 'originalReference', 
'merchantReference'
-               );
-               foreach ( $sameProps as $prop ) {
-                       $this->assertEquals(
-                               $capture->$prop,
-                               $job[$prop],
-                               "Job property $prop does not match capture"
-                       );
-               }
-       }
-
-       public function testFailedCapture() {
-               $capture = new Capture();
-               $capture->success = false;
-
-               $action = new CaptureResponseAction();
-               $action->execute( $capture );
-
-               $job = $this->jobQueue->pop();
-
-               $this->assertNull( $job, 'Should not have queued a job' );
-       }
-
-}
diff --git a/PaymentProviders/Adyen/Tests/phpunit/PaymentCaptureActionTest.php 
b/PaymentProviders/Adyen/Tests/phpunit/PaymentCaptureActionTest.php
deleted file mode 100644
index 518346f..0000000
--- a/PaymentProviders/Adyen/Tests/phpunit/PaymentCaptureActionTest.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-namespace SmashPig\PaymentProviders\Adyen\Tests;
-
-use PHPQueue\Interfaces\FifoQueueStore;
-use SmashPig\Core\Configuration;
-use SmashPig\Core\Context;
-use SmashPig\Core\QueueConsumers\BaseQueueConsumer;
-use SmashPig\PaymentProviders\Adyen\Actions\PaymentCaptureAction;
-use SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Authorisation;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-class PaymentCaptureActionTest extends BaseSmashPigUnitTestCase  {
-       /**
-        * @var Configuration
-        */
-       protected $config;
-
-       /**
-        * @var FifoQueueStore
-        */
-       protected $jobQueue;
-
-       public function setUp() {
-               parent::setUp();
-               $this->config = 
AdyenTestConfiguration::createWithSuccessfulApi();
-               Context::initWithLogger( $this->config );
-               $this->jobQueue = $this->config->object( 
'data-store/jobs-adyen' );
-               $this->jobQueue->createTable( 'jobs-adyen' );
-       }
-
-       public function testSuccessfulAuth() {
-               $auth = new Authorisation();
-               $auth->success = true;
-               $auth->correlationId = 'adyen-' . mt_rand();
-               $auth->merchantAccountCode = 'WikimediaTest' ;
-               $auth->currency = 'USD';
-               $auth->amount = '10';
-               $auth->merchantReference = mt_rand();
-               $auth->pspReference = mt_rand();
-               $auth->cvvResult = 1;
-               $auth->avsResult = 19;
-
-               $action = new PaymentCaptureAction();
-               $action->execute( $auth );
-
-               $job = $this->jobQueue->pop();
-
-               $this->assertEquals(
-                       
'SmashPig\PaymentProviders\Adyen\Jobs\ProcessCaptureRequestJob',
-                       $job['php-message-class']
-               );
-               $sameProps = array(
-                       'currency', 'amount', 'pspReference', 
'merchantReference',
-                       'avsResult', 'cvvResult',
-
-               );
-               foreach ( $sameProps as $prop ) {
-                       $this->assertEquals(
-                               $auth->$prop,
-                               $job[$prop],
-                               "Job property $prop does not match capture"
-                       );
-               }
-       }
-
-       public function testFailedAuth() {
-               $auth = new Authorisation();
-               $auth->success = false;
-               $auth->correlationId = 'adyen-' . mt_rand();
-               $auth->merchantAccountCode = 'WikimediaTest' ;
-               $auth->merchantReference = mt_rand();
-
-               $action = new PaymentCaptureAction();
-               $action->execute( $auth );
-
-               $job = $this->jobQueue->pop();
-
-               $this->assertEquals(
-                       'SmashPig\Core\Jobs\DeletePendingJob',
-                       $job['php-message-class']
-               );
-               $this->assertEquals(
-                       $auth->merchantReference,
-                       $job['order_id']
-               );
-               $this->assertEquals( 'adyen', $job['gateway'] );
-       }
-}
diff --git a/PaymentProviders/PayPal/Tests/Data/refund.json 
b/PaymentProviders/PayPal/Tests/Data/refund.json
deleted file mode 100644
index ed3f61b..0000000
--- a/PaymentProviders/PayPal/Tests/Data/refund.json
+++ /dev/null
@@ -1,39 +0,0 @@
-{
-    "mc_gross":"-1.00",
-    "protection_eligibility":"Eligible",
-    "payer_id":"4ZXYASBQ9POIU",
-    "address_street":"1234 Outlaw Ave",
-    "payment_date":"11:55:22 Sep 28, 2016 PDT",
-    "payment_status":"Refunded",
-    "charset":"UTF-8",
-    "address_zip":"75119",
-    "first_name":"Clyde",
-    "mc_fee":"-0.27",
-    "address_country_code":"US",
-    "address_name":"Clyde Barrow",
-    "notify_version":"3.8",
-    "reason_code":"refund",
-    "custom":"93731212",
-    "business":"gimmedoll...@wikimedia.org",
-    "address_country":"United States",
-    "address_city":"Telico",
-    "verify_sign":"lASd8asdAsd8YASdkashda9s8dYSldasda9sdAHSd8h2",
-    "payer_email":"cl...@barrowgang.org",
-    "parent_txn_id":"22b55555YY4499222",
-    "txn_id":"99E56789RR1234222",
-    "payment_type":"instant",
-    "last_name":"Barrow",
-    "address_state":"TX",
-    "receiver_email":"gimmedoll...@wikimedia.org",
-    "payment_fee":"-0.27",
-    "receiver_id":"DD555ASDFGASW8",
-    "item_name":"Donation to the Wikimedia Foundation",
-    "mc_currency":"USD",
-    "item_number":"DONATE",
-    "residence_country":"US",
-    "handling_amount":"0.00",
-    "transaction_subject":"312938761",
-    "payment_gross":"-1.00",
-    "shipping":"0.00",
-    "ipn_track_id":"b876d786f8ae768"
-}
diff --git a/Tests/PendingQueueConsumerTest.php 
b/Tests/PendingQueueConsumerTest.php
deleted file mode 100644
index 3af747f..0000000
--- a/Tests/PendingQueueConsumerTest.php
+++ /dev/null
@@ -1,147 +0,0 @@
-<<<<<<< HEAD   (fa0267 Merge branch 'master' into deployment)
-=======
-<?php
-
-namespace SmashPig\Tests;
-
-use SmashPig\Core\Context;
-use SmashPig\Core\DataStores\PaymentsInitialDatabase;
-use SmashPig\Core\DataStores\PendingDatabase;
-use SmashPig\Core\QueueConsumers\PendingQueueConsumer;
-
-class PendingQueueConsumerTest extends BaseSmashPigUnitTestCase {
-
-       /**
-        * @var PendingDatabase
-        */
-       protected $pendingDb;
-
-       /**
-        * @var PaymentsInitialDatabase
-        */
-       protected $paymentsInitialDb;
-
-       public function setUp() {
-               parent::setUp();
-               // Merge db and queue test configs.
-               $config = TestingConfiguration::loadConfigWithFileOverrides( 
array(
-                       __DIR__ . '/data/config_smashpig_db.yaml',
-                       __DIR__ . '/data/config_queue.yaml',
-               ) );
-               Context::initWithLogger( $config );
-
-               $this->pendingDb = PendingDatabase::get();
-               $this->pendingDb->createTable();
-               $this->paymentsInitialDb = PaymentsInitialDatabase::get();
-               $this->paymentsInitialDb->createTable();
-       }
-
-       public function tearDown() {
-               // FIXME: huh.  I guess we should use class names to avoid 
possible
-               // incomplete destruction in the case that paymentsInitialDb 
was never
-               // initialized.
-               TestingDatabase::clearStatics( $this->paymentsInitialDb );
-               TestingDatabase::clearStatics( $this->pendingDb );
-
-               parent::tearDown();
-       }
-
-       /**
-        * We consume a message normally if there's nothing in the 
payments_initial
-        * table.
-        */
-       public function testPendingMessageNotInInitial() {
-               $consumer = new PendingQueueConsumer( 'pending', 1000, 1000 );
-               $message = self::generateRandomPendingMessage();
-
-               $consumer->processMessage( $message );
-
-               $fetched = $this->pendingDb->fetchMessageByGatewayOrderId(
-                       $message['gateway'], $message['order_id'] );
-
-               $this->assertNotNull( $fetched,
-                       'Message was consumed and stored in the pending 
database.' );
-
-               unset( $fetched['pending_id'] );
-               $this->assertEquals( $message, $fetched,
-                       'Stored message is equal to the consumed message.' );
-       }
-
-       /**
-        * We consume a message normally if the corresponding payments_initial 
row
-        * is still pending.
-        */
-       public function testPendingMessageInitialPending() {
-               $initRow = PaymentsInitialDatabaseTest::generateTestMessage();
-               $initRow['payments_final_status'] = 'pending';
-
-               $this->paymentsInitialDb->storeMessage( $initRow );
-
-               $message = self::generatePendingMessageFromInitial( $initRow );
-               $consumer = new PendingQueueConsumer( 'pending', 1000, 1000 );
-
-               $consumer->processMessage( $message );
-
-               $fetched = $this->pendingDb->fetchMessageByGatewayOrderId(
-                       $message['gateway'], $message['order_id'] );
-
-               $this->assertNotNull( $fetched,
-                       'Message was consumed and stored in the pending 
database.' );
-
-               unset( $fetched['pending_id'] );
-               $this->assertEquals( $message, $fetched,
-                       'Stored message is equal to the consumed message.' );
-       }
-
-       /**
-        * We refuse to consume a message and drop it if the corresponding
-        * payments_initial row is failed.
-        */
-        public function testPendingMessageInitialFailed() {
-               $initRow = PaymentsInitialDatabaseTest::generateTestMessage();
-               $initRow['payments_final_status'] = 'failed';
-
-               $this->paymentsInitialDb->storeMessage( $initRow );
-
-               $message = self::generatePendingMessageFromInitial( $initRow );
-               $consumer = new PendingQueueConsumer( 'pending', 1000, 1000 );
-
-               $consumer->processMessage( $message );
-
-               $fetched = $this->pendingDb->fetchMessageByGatewayOrderId(
-                       $message['gateway'], $message['order_id'] );
-
-               $this->assertNull( $fetched,
-                       'Message consumed and not stored in the pending 
database.' );
-       }
-
-       public static function generateRandomPendingMessage() {
-               $message = array(
-                       'gateway' => 'test',
-                       'date' => time(),
-                       'order_id' => mt_rand(),
-                       'cousin' => 'itt',
-                       'kookiness' => mt_rand(),
-               );
-               return $message;
-       }
-
-       /**
-        * Create an incoming pending message corresponding to a given
-        * payments_initial row.
-        *
-        * @param array $initialRow
-        * @return array Message suitable for the pending queue.
-        */
-       public static function generatePendingMessageFromInitial( $initialRow ) 
{
-               $message = array(
-                       'gateway' => $initialRow['gateway'],
-                       'date' => $initialRow['date'],
-                       'order_id' => $initialRow['order_id'],
-                       'cousin' => 'itt',
-                       'kookiness' => mt_rand(),
-               );
-               return $message;
-       }
-}
->>>>>>> BRANCH (f442b3 Some logging in PP listener)

-- 
To view, visit https://gerrit.wikimedia.org/r/315569
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5378b85dd693b6923df5a095e7929181df7caf3d
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to