Ejegg has uploaded a new change for review.

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

Change subject: Fix WorldPay AVS settings to work with non-(US|UK|CA)
......................................................................

Fix WorldPay AVS settings to work with non-(US|UK|CA)

WP AVS settings were giving 50 pts for address match not performed
and another 50 pts for zip match not performed, leading to donations
from anywhere with no address fields failing the antifraud check.

Change-Id: Ia7db5a1120b1dff6b4c2894a96b4889e8c81adad
---
M DonationInterface.php
M tests/Adapter/WorldPay/WorldPayTestCase.php
A tests/includes/Responses/worldpay/AuthorizePaymentForFraud_9000.testresponse
3 files changed, 39 insertions(+), 2 deletions(-)


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

diff --git a/DonationInterface.php b/DonationInterface.php
index c73a1b4..56d877f 100644
--- a/DonationInterface.php
+++ b/DonationInterface.php
@@ -522,7 +522,7 @@
                '2' => 12, //Not Checked/Not Available
                '3' => 50, //Issuer is Not Certified or Unregistered
                '4' => 12, //Not Supported
-               '9' => 50, //Not Performed (occurs when Address1, Address2 and 
Address3 values were not present in the STN string or when transaction was not 
sent to the acquiring bank)
+               '9' => 12, //Not Performed (occurs when Address1, Address2 and 
Address3 values were not present in the STN string or when transaction was not 
sent to the acquiring bank)
                '' => 50, //No code returned. All the points.
        );
 
@@ -533,7 +533,7 @@
                '3' => 0, //9 digit zipcode match
                '4' => 0, //5 digit zipcode match
                '5' => 12, //Not Supported
-               '9' => 50, //Not Performed (occurs when ZipCode value was not 
present in the STN string or when transaction was not sent to the acquiring 
bank)
+               '9' => 12, //Not Performed (occurs when ZipCode value was not 
present in the STN string or when transaction was not sent to the acquiring 
bank)
                '' => 50, //No code returned. All the points.
        );
 }
diff --git a/tests/Adapter/WorldPay/WorldPayTestCase.php 
b/tests/Adapter/WorldPay/WorldPayTestCase.php
index 9dcf7a7..8e18e78 100644
--- a/tests/Adapter/WorldPay/WorldPayTestCase.php
+++ b/tests/Adapter/WorldPay/WorldPayTestCase.php
@@ -257,6 +257,21 @@
        }
 
        /**
+        * Ensure we don't give too high a risk score when AVS address / zip 
match was not performed 
+        */
+       function testAntifraudAllowsAvsNotPerformed() {
+               $options = $this->getDonorTestData('FR'); //don't really care: 
We'll be using the dummy response directly.
+
+               $gateway = $this->getFreshGatewayObject( $options );
+               $gateway->setDummyGatewayResponseCode( 9000 );
+               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
+
+               $this->assertEquals( '9', $gateway->getData_Unstaged_Escaped( 
'avs_address' ), 'avs_address was not set after AuthorizePaymentForFraud' );
+               $this->assertEquals( '9', $gateway->getData_Unstaged_Escaped( 
'avs_zip' ), 'avs_zip was not set after AuthorizePaymentForFraud' );            
  
+               $this->assertTrue( $gateway->getAVSResult() < 25, 'getAVSResult 
returning too high a score for AVS not performed.' );
+       }
+
+       /**
         * Ensure we're staging a punctuation-stripped version of the email 
address in merchant_reference_2
         */
        function testMerchantReference2() {
diff --git 
a/tests/includes/Responses/worldpay/AuthorizePaymentForFraud_9000.testresponse 
b/tests/includes/Responses/worldpay/AuthorizePaymentForFraud_9000.testresponse
new file mode 100644
index 0000000..bfa15c9
--- /dev/null
+++ 
b/tests/includes/Responses/worldpay/AuthorizePaymentForFraud_9000.testresponse
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--AuthorizePaymentForFraud with AVS returning 'not performed' code-->
+<TMSTN>
+       <MerchantId>123456</MerchantId>
+       <TransactionType>PT</TransactionType>
+       <OrderNumber>000000000</OrderNumber>
+       <StrId>111111111</StrId>
+       <PTTID>222222222</PTTID>
+       <MOP>CC</MOP>
+       <CurrencyId>978</CurrencyId>
+       <Amount>1.12</Amount>
+       <AuthCode>BF9C8D</AuthCode>
+       <RequestType>A</RequestType>
+       <MessageCode>2100</MessageCode>
+       <Message>Transaction Approved</Message>
+       <CVNMessageCode>0</CVNMessageCode>
+       <CVNMessage>Security/Address Matched</CVNMessage>
+       <CVNMatch>1</CVNMatch>
+       <AddressMatch>9</AddressMatch>
+       <PostalCodeMatch>9</PostalCodeMatch>
+       <UTC>20140409220405</UTC>
+</TMSTN>
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7db5a1120b1dff6b4c2894a96b4889e8c81adad
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