Ejegg has uploaded a new change for review.

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

Change subject: Add risk score to Adyen queue messages.
......................................................................

Add risk score to Adyen queue messages.

It will be used by the IPN listener to decide whether to capture
authorized payments or leave them for manual review.

Bug: T122244
Change-Id: Ieb45af0c2047dce460cb3c7bb76c0d6ca301b5d9
---
M adyen_gateway/adyen.adapter.php
M tests/Adapter/Adyen/AdyenTest.php
2 files changed, 22 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/95/266295/1

diff --git a/adyen_gateway/adyen.adapter.php b/adyen_gateway/adyen.adapter.php
index c880fda..fbd4dda 100644
--- a/adyen_gateway/adyen.adapter.php
+++ b/adyen_gateway/adyen.adapter.php
@@ -264,6 +264,19 @@
                return $this->transaction_response;
        }
 
+       /**
+        * Adds risk score to the message we send to the limbo queue.
+        * The IPN listener will combine this with scores based on CVV and AVS
+        * results returned with the authorization notification and determine
+        * whether to capture the payment or leave it for manual review.
+        * @return array
+        */
+       protected function getStompTransaction() {
+               $transaction = parent::getStompTransaction();
+               $transaction['risk_score'] = $this->risk_score;
+               return $transaction;
+       }
+
        static function getCurrencies() {
                // See 
http://www.adyen.com/platform/all-countries-all-currencies/
                // This should be the list of all global "acceptance 
currencies".  Not
diff --git a/tests/Adapter/Adyen/AdyenTest.php 
b/tests/Adapter/Adyen/AdyenTest.php
index d3e0be9..5cd6975 100644
--- a/tests/Adapter/Adyen/AdyenTest.php
+++ b/tests/Adapter/Adyen/AdyenTest.php
@@ -90,4 +90,13 @@
                $this->assertNotNull( $gateway->getData_Unstaged_Escaped( 
'order_id' ), "Adyen order_id is null, and we need one for 'merchantReference'" 
);
        }
 
+       function testRiskScoreAddedToQueueMessage() {
+               $init = $this->getDonorTestData();
+               $gateway = $this->getFreshGatewayObject( $init );
+
+               $exposed = TestingAccessWrapper::newFromObject( $gateway );
+               $exposed->risk_score = 57;
+               $message = $exposed->getStompTransaction();
+               $this->assertEquals( 57, $message['risk_score'], 'Risk score 
was not correctly added to queue message.' );
+       }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieb45af0c2047dce460cb3c7bb76c0d6ca301b5d9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
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