jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/360346 )
Change subject: Revert "Add gateway_session_id to pending table" ...................................................................... Revert "Add gateway_session_id to pending table" This reverts commit a1d631e5141b04464ffbe10b1b7615304fef9e88. Change-Id: I4e1528bf71f7e72f83ca54741d6f1938a52a8819 --- M Core/DataStores/PendingDatabase.php M Schema/mysql/001_CreatePendingTable.sql M Schema/sqlite/001_CreatePendingTable.sql M Tests/PendingDatabaseTest.php 4 files changed, 2 insertions(+), 54 deletions(-) Approvals: Mepps: Looks good to me, approved jenkins-bot: Verified diff --git a/Core/DataStores/PendingDatabase.php b/Core/DataStores/PendingDatabase.php index 81c82fb..dde9bd5 100644 --- a/Core/DataStores/PendingDatabase.php +++ b/Core/DataStores/PendingDatabase.php @@ -17,8 +17,7 @@ empty( $message['gateway'] ) || ( // need at least one transaction ID empty( $message['gateway_txn_id'] ) && - empty( $message['order_id'] ) && - empty( $message['gateway_session_id'] ) + empty( $message['order_id'] ) ) ) { throw new SmashPigException( 'Message missing required fields' ); @@ -38,11 +37,7 @@ // These fields (and date) have their own columns in the database // Copy the values from the message to the record $indexedFields = array( - 'gateway', - 'gateway_account', - 'gateway_txn_id', - 'order_id', - 'gateway_session_id' + 'gateway', 'gateway_account', 'gateway_txn_id', 'order_id' ); foreach ( $indexedFields as $fieldName ) { @@ -80,31 +75,6 @@ $params = array( 'gateway' => $gatewayName, 'order_id' => $orderId, - ); - $executed = $this->prepareAndExecute( $sql, $params ); - $row = $executed->fetch( PDO::FETCH_ASSOC ); - if ( !$row ) { - return null; - } - return $this->messageFromDbRow( $row ); - } - - /** - * Return record matching a (gateway, gateway_session_id), or null - * - * @param $gatewayName string - * @param $gatewaySessionId string - * @return array|null Record related to a transaction, or null if nothing matches - */ - public function fetchMessageByGatewaySessionId( $gatewayName, $gatewaySessionId ) { - $sql = 'select * from pending - where gateway = :gateway - and gateway_session_id = :gateway_session_id - limit 1'; - - $params = array( - 'gateway' => $gatewayName, - 'gateway_session_id' => $gatewaySessionId, ); $executed = $this->prepareAndExecute( $sql, $params ); $row = $executed->fetch( PDO::FETCH_ASSOC ); diff --git a/Schema/mysql/001_CreatePendingTable.sql b/Schema/mysql/001_CreatePendingTable.sql index 2d70fb2..76dd361 100644 --- a/Schema/mysql/001_CreatePendingTable.sql +++ b/Schema/mysql/001_CreatePendingTable.sql @@ -5,12 +5,10 @@ `gateway_account` varchar(255) NULL, `order_id` varchar(255) NULL, `gateway_txn_id` varchar(255) NULL, - `gateway_session_id` varchar(255) NULL, `message` text NOT NULL, INDEX `idx_pending_date` (`date`), INDEX `idx_pending_date_gateway` (`date`, `gateway`), INDEX `idx_pending_order_id_gateway` (`order_id`, `gateway`), INDEX `idx_pending_gateway_txn_id_gateway` (`gateway_txn_id`, `gateway`), - INDEX `idx_pending_gateway_session_id_gateway` (`gateway_session_id`, `gateway`), PRIMARY KEY `pk_pending_id` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; diff --git a/Schema/sqlite/001_CreatePendingTable.sql b/Schema/sqlite/001_CreatePendingTable.sql index 758a8f6..0edcd69 100644 --- a/Schema/sqlite/001_CreatePendingTable.sql +++ b/Schema/sqlite/001_CreatePendingTable.sql @@ -5,6 +5,5 @@ `gateway_account` varchar(255) NULL, `order_id` varchar(255) NULL, `gateway_txn_id` varchar(255) NULL, - `gateway_session_id` varchar(255) NULL, `message` text NOT NULL ); diff --git a/Tests/PendingDatabaseTest.php b/Tests/PendingDatabaseTest.php index baf3ad7..8382eeb 100644 --- a/Tests/PendingDatabaseTest.php +++ b/Tests/PendingDatabaseTest.php @@ -32,7 +32,6 @@ 'gateway' => 'test', 'gateway_txn_id' => "txn-{$uniq}", 'order_id' => "order-{$uniq}", - 'gateway_session_id' => "session-{$uniq}", 'gateway_account' => 'default', 'date' => 1468973648, 'amount' => 123, @@ -62,7 +61,6 @@ 'gateway_account' => 'default', 'order_id' => $message['order_id'], 'gateway_txn_id' => $message['gateway_txn_id'], - 'gateway_session_id' => $message['gateway_session_id'], 'message' => json_encode( $message ), ); $this->assertEquals( $expected, $rows[0], @@ -80,23 +78,6 @@ $expected = $message + array( 'pending_id' => 1, ); - $this->assertEquals( $expected, $fetched, - 'Fetched record matches stored message.' ); - } - - public function testFetchMessageByGatewaySessionId() { - $message = self::getTestMessage(); - $this->db->storeMessage( $message ); - - $fetched = $this->db->fetchMessageByGatewaySessionId( - 'test', $message['gateway_session_id'] ); - - $this->assertNotNull( $fetched, - 'Record retrieved by fetchMessageByGatewaySessionId.' ); - - $expected = $message + array( - 'pending_id' => 1, - ); $this->assertEquals( $expected, $fetched, 'Fetched record matches stored message.' ); } -- To view, visit https://gerrit.wikimedia.org/r/360346 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4e1528bf71f7e72f83ca54741d6f1938a52a8819 Gerrit-PatchSet: 2 Gerrit-Project: wikimedia/fundraising/SmashPig Gerrit-Branch: master Gerrit-Owner: Ejegg <ej...@ejegg.com> Gerrit-Reviewer: AndyRussG <andrew.green...@gmail.com> Gerrit-Reviewer: Awight <awi...@wikimedia.org> Gerrit-Reviewer: Cdentinger <cdentin...@wikimedia.org> Gerrit-Reviewer: Eileen <emcnaugh...@wikimedia.org> Gerrit-Reviewer: Katie Horn <kh...@wikimedia.org> Gerrit-Reviewer: Mepps <me...@wikimedia.org> Gerrit-Reviewer: XenoRyet <dkozlow...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits