jenkins-bot has submitted this change and it was merged.
Change subject: Don't delete pending data for failed:review
......................................................................
Don't delete pending data for failed:review
'Failed' is correct as far as the front-end goes, but when the
payment is in review, Donor Services might push it through manually.
We should leave donor details unless it's been rejected with finality.
TODO: reuse this logic in CRM's payments-init queue consumer.
Bug: T148859
Change-Id: If8d251c92603e9f97d5cd54d69f561040677a62a
---
M Core/DataStores/PaymentsInitialDatabase.php
M Tests/PendingQueueConsumerTest.php
2 files changed, 17 insertions(+), 3 deletions(-)
Approvals:
Cdentinger: Looks good to me, approved
jenkins-bot: Verified
diff --git a/Core/DataStores/PaymentsInitialDatabase.php
b/Core/DataStores/PaymentsInitialDatabase.php
index dbd33e2..47a2113 100644
--- a/Core/DataStores/PaymentsInitialDatabase.php
+++ b/Core/DataStores/PaymentsInitialDatabase.php
@@ -10,7 +10,7 @@
/**
* Return true if the message already exists in the payments-init table,
- * and is marked as having failed.
+ * and is marked as having failed and been rejected.
*
* @param array $message Payments initial message
* FIXME: Or pass ID parameters explicitly and call this
@@ -23,12 +23,25 @@
if ( $message === null ) {
return false;
}
- if ( $message['payments_final_status'] === 'failed' ) {
+ return $this->isMessageFailed( $message );
+ }
+
+ /**
+ * @param array $message a payments-init message
+ * @return bool true if the message indicates that the payment has been
+ * definitively failed and won't come up again
+ */
+ public function isMessageFailed( $message ) {
+ if (
+ $message['payments_final_status'] === 'failed' &&
+ $message['validation_action'] === 'reject'
+ ) {
return true;
}
return false;
}
+
/**
* Return record matching a (gateway, order_id), or null if none is
found
*
diff --git a/Tests/PendingQueueConsumerTest.php
b/Tests/PendingQueueConsumerTest.php
index d39ce74..8836f6b 100644
--- a/Tests/PendingQueueConsumerTest.php
+++ b/Tests/PendingQueueConsumerTest.php
@@ -95,9 +95,10 @@
* We refuse to consume a message and drop it if the corresponding
* payments_initial row is failed.
*/
- public function testPendingMessageInitialFailed() {
+ public function testPendingMessageInitialFailed() {
$initRow = PaymentsInitialDatabaseTest::generateTestMessage();
$initRow['payments_final_status'] = 'failed';
+ $initRow['validation_action'] = 'reject';
$this->paymentsInitialDb->storeMessage( $initRow );
--
To view, visit https://gerrit.wikimedia.org/r/317190
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If8d251c92603e9f97d5cd54d69f561040677a62a
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits