[MediaWiki-commits] [Gerrit] Fail on any unrecognized CVV return codes - change (mediawiki...DonationInterface)

2015-04-17 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review.

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

Change subject: Fail on any unrecognized CVV return codes
..

Fail on any unrecognized CVV return codes

And log a warning.

Cherry-picked 3cd38258731873e5 to deployment and deleted tests.

Bug: T96393
Change-Id: I3a971a41ad00cc43873dc95471277ad651e45470
---
M globalcollect_gateway/globalcollect.adapter.php
M worldpay_gateway/worldpay.adapter.php
2 files changed, 13 insertions(+), 2 deletions(-)


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

diff --git a/globalcollect_gateway/globalcollect.adapter.php 
b/globalcollect_gateway/globalcollect.adapter.php
index 74a8776..13dfb32 100644
--- a/globalcollect_gateway/globalcollect.adapter.php
+++ b/globalcollect_gateway/globalcollect.adapter.php
@@ -2381,13 +2381,19 @@
 * determine if we want to fail the transaction ourselves or not.
 */
public function getCVVResult(){
-   if ( is_null( $this-getData_Unstaged_Escaped( 'cvv_result' ) ) 
){
+   $from_processor = $this-getData_Unstaged_Escaped( 'cvv_result' 
);
+   if ( is_null( $from_processor ) ){
return null;
}
 
$cvv_map = $this-getGlobal( 'CvvMap' );
 
-   $result = $cvv_map[$this-getData_Unstaged_Escaped( 
'cvv_result' )];
+   if ( !isset( $cvv_map[$from_processor] ) ) {
+   $this-logger-warning( Unrecognized cvv_result 
'$from_processor' );
+   return false;
+   }
+
+   $result = $cvv_map[$from_processor];
return $result;
 
}
diff --git a/worldpay_gateway/worldpay.adapter.php 
b/worldpay_gateway/worldpay.adapter.php
index db315d0..0aa87c8 100644
--- a/worldpay_gateway/worldpay.adapter.php
+++ b/worldpay_gateway/worldpay.adapter.php
@@ -1088,6 +1088,11 @@
 
$cvv_map = $this-getGlobal( 'CvvMap' );
 
+   if ( !isset( $cvv_map[$cvv_result] ) ) {
+   $this-logger-warning( Unrecognized cvv_result 
'$cvv_result' );
+   return false;
+   }
+
$result = $cvv_map[$cvv_result];
return $result;
}

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

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


[MediaWiki-commits] [Gerrit] Fail on any unrecognized CVV return codes - change (mediawiki...DonationInterface)

2015-04-17 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Fail on any unrecognized CVV return codes
..


Fail on any unrecognized CVV return codes

And log a warning.

Bug: T96393
Change-Id: Id0b0e9e0673a80658c01a491ebb55c1b608166bb
---
M globalcollect_gateway/globalcollect.adapter.php
M tests/Adapter/GlobalCollect/GlobalCollectTest.php
A tests/includes/Responses/globalcollect/GET_ORDERSTATUS_800.testresponse
M worldpay_gateway/worldpay.adapter.php
4 files changed, 77 insertions(+), 2 deletions(-)

Approvals:
  Katie Horn: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/globalcollect_gateway/globalcollect.adapter.php 
b/globalcollect_gateway/globalcollect.adapter.php
index ec55261..8efc5e7 100644
--- a/globalcollect_gateway/globalcollect.adapter.php
+++ b/globalcollect_gateway/globalcollect.adapter.php
@@ -2387,13 +2387,19 @@
 * determine if we want to fail the transaction ourselves or not.
 */
public function getCVVResult(){
-   if ( is_null( $this-getData_Unstaged_Escaped( 'cvv_result' ) ) 
){
+   $from_processor = $this-getData_Unstaged_Escaped( 'cvv_result' 
);
+   if ( is_null( $from_processor ) ){
return null;
}
 
$cvv_map = $this-getGlobal( 'CvvMap' );
 
-   $result = $cvv_map[$this-getData_Unstaged_Escaped( 
'cvv_result' )];
+   if ( !isset( $cvv_map[$from_processor] ) ) {
+   $this-logger-warning( Unrecognized cvv_result 
'$from_processor' );
+   return false;
+   }
+
+   $result = $cvv_map[$from_processor];
return $result;
 
}
diff --git a/tests/Adapter/GlobalCollect/GlobalCollectTest.php 
b/tests/Adapter/GlobalCollect/GlobalCollectTest.php
index d0d4159..60f26d4 100644
--- a/tests/Adapter/GlobalCollect/GlobalCollectTest.php
+++ b/tests/Adapter/GlobalCollect/GlobalCollectTest.php
@@ -183,6 +183,29 @@
}
 
/**
+* If CVVRESULT is unrecognized, fraud-fail and warn
+* @group CvvResult
+*/
+   function testConfirmCreditCardBadCVVResult() {
+   $init = $this-getDonorTestData();
+   $init['payment_method'] = 'cc';
+   $init['payment_submethod'] = 'visa';
+   $init['email'] = 'innoc...@safedomain.org';
+
+   $this-setMwGlobals( 'wgRequest',
+   new FauxRequest( array( 'CVVRESULT' = ' ' ), false ) );
+
+   $gateway = $this-getFreshGatewayObject( $init );
+   $gateway-setDummyGatewayResponseCode( '800' );
+
+   $gateway-do_transaction( 'Confirm_CreditCard' );
+   $result = $gateway-getCvvResult();
+   $this-assertEquals( false, $result, 'Gateway should fraud fail 
if CVVRESULT is not mapped' );
+   $matches = $this-getLogMatches( LogLevel::WARNING, 
/Unrecognized cvv_result ' '$/ );
+   $this-assertNotEmpty( $matches, 'Did not log expected warning 
on unmapped CVVRESULT' );
+   }
+
+   /**
 * We should skip the API call if we're already suspicious
 */
function testGetOrderStatusSkipsIfFail() {
diff --git 
a/tests/includes/Responses/globalcollect/GET_ORDERSTATUS_800.testresponse 
b/tests/includes/Responses/globalcollect/GET_ORDERSTATUS_800.testresponse
new file mode 100644
index 000..72f0695
--- /dev/null
+++ b/tests/includes/Responses/globalcollect/GET_ORDERSTATUS_800.testresponse
@@ -0,0 +1,41 @@
+XML
+   REQUEST
+   ACTIONGET_ORDERSTATUS/ACTION
+   META
+   MERCHANTID1/MERCHANTID
+   IPADDRESS123.123.123.123/IPADDRESS
+   VERSION2.0/VERSION
+   REQUESTIPADDRESS123.123.123.123/REQUESTIPADDRESS
+   /META
+   PARAMS
+   ORDER
+   ORDERID9998890004/ORDERID
+   /ORDER
+   /PARAMS
+   RESPONSE
+   RESULTOK/RESULT
+   META
+   REQUESTID245/REQUESTID
+   
RESPONSEDATETIME20100419133351/RESPONSEDATETIME
+   /META
+   STATUS
+   PAYMENTMETHODID1/PAYMENTMETHODID
+   STATUSID800/STATUSID
+   CURRENCYCODEEUR/CURRENCYCODE
+   FRAUDRESULTN/FRAUDRESULT
+   EFFORTID1/EFFORTID
+   
CREDITCARDNUMBER7977/CREDITCARDNUMBER
+   AUTHORISATIONCODE654321/AUTHORISATIONCODE
+   
PAYMENTREFERENCE90010010/PAYMENTREFERENCE
+   ATTEMPTID2/ATTEMPTID
+   

[MediaWiki-commits] [Gerrit] Fail on any unrecognized CVV return codes - change (mediawiki...DonationInterface)

2015-04-17 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review.

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

Change subject: Fail on any unrecognized CVV return codes
..

Fail on any unrecognized CVV return codes

Bug: T96393
Change-Id: Id0b0e9e0673a80658c01a491ebb55c1b608166bb
---
M globalcollect_gateway/globalcollect.adapter.php
M worldpay_gateway/worldpay.adapter.php
2 files changed, 11 insertions(+), 2 deletions(-)


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

diff --git a/globalcollect_gateway/globalcollect.adapter.php 
b/globalcollect_gateway/globalcollect.adapter.php
index ec55261..11a1dc8 100644
--- a/globalcollect_gateway/globalcollect.adapter.php
+++ b/globalcollect_gateway/globalcollect.adapter.php
@@ -2387,13 +2387,18 @@
 * determine if we want to fail the transaction ourselves or not.
 */
public function getCVVResult(){
-   if ( is_null( $this-getData_Unstaged_Escaped( 'cvv_result' ) ) 
){
+   $from_processor = $this-getData_Unstaged_Escaped( 'cvv_result' 
);
+   if ( is_null( $from_processor ) ){
return null;
}
 
$cvv_map = $this-getGlobal( 'CvvMap' );
 
-   $result = $cvv_map[$this-getData_Unstaged_Escaped( 
'cvv_result' )];
+   if ( !isset( $cvv_map[$from_processor] ) ) {
+   return false;
+   }
+
+   $result = $cvv_map[$from_processor];
return $result;
 
}
diff --git a/worldpay_gateway/worldpay.adapter.php 
b/worldpay_gateway/worldpay.adapter.php
index 87daf6c..741516f 100644
--- a/worldpay_gateway/worldpay.adapter.php
+++ b/worldpay_gateway/worldpay.adapter.php
@@ -1091,6 +1091,10 @@
 
$cvv_map = $this-getGlobal( 'CvvMap' );
 
+   if ( !isset( $cvv_map[$cvv_result] ) ) {
+   return false;
+   }
+
$result = $cvv_map[$cvv_result];
return $result;
}

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

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


[MediaWiki-commits] [Gerrit] Fail on any unrecognized CVV return codes - change (mediawiki...DonationInterface)

2015-04-17 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Fail on any unrecognized CVV return codes
..


Fail on any unrecognized CVV return codes

And log a warning.

Cherry-picked 3cd38258731873e5 to deployment and deleted tests.

Bug: T96393
Change-Id: I3a971a41ad00cc43873dc95471277ad651e45470
---
M globalcollect_gateway/globalcollect.adapter.php
M worldpay_gateway/worldpay.adapter.php
2 files changed, 13 insertions(+), 2 deletions(-)

Approvals:
  Ejegg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/globalcollect_gateway/globalcollect.adapter.php 
b/globalcollect_gateway/globalcollect.adapter.php
index 74a8776..13dfb32 100644
--- a/globalcollect_gateway/globalcollect.adapter.php
+++ b/globalcollect_gateway/globalcollect.adapter.php
@@ -2381,13 +2381,19 @@
 * determine if we want to fail the transaction ourselves or not.
 */
public function getCVVResult(){
-   if ( is_null( $this-getData_Unstaged_Escaped( 'cvv_result' ) ) 
){
+   $from_processor = $this-getData_Unstaged_Escaped( 'cvv_result' 
);
+   if ( is_null( $from_processor ) ){
return null;
}
 
$cvv_map = $this-getGlobal( 'CvvMap' );
 
-   $result = $cvv_map[$this-getData_Unstaged_Escaped( 
'cvv_result' )];
+   if ( !isset( $cvv_map[$from_processor] ) ) {
+   $this-logger-warning( Unrecognized cvv_result 
'$from_processor' );
+   return false;
+   }
+
+   $result = $cvv_map[$from_processor];
return $result;
 
}
diff --git a/worldpay_gateway/worldpay.adapter.php 
b/worldpay_gateway/worldpay.adapter.php
index db315d0..0aa87c8 100644
--- a/worldpay_gateway/worldpay.adapter.php
+++ b/worldpay_gateway/worldpay.adapter.php
@@ -1088,6 +1088,11 @@
 
$cvv_map = $this-getGlobal( 'CvvMap' );
 
+   if ( !isset( $cvv_map[$cvv_result] ) ) {
+   $this-logger-warning( Unrecognized cvv_result 
'$cvv_result' );
+   return false;
+   }
+
$result = $cvv_map[$cvv_result];
return $result;
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3a971a41ad00cc43873dc95471277ad651e45470
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg eeggles...@wikimedia.org
Gerrit-Reviewer: Awight awi...@wikimedia.org
Gerrit-Reviewer: Ejegg eeggles...@wikimedia.org
Gerrit-Reviewer: Ssmith ssm...@wikimedia.org
Gerrit-Reviewer: jenkins-bot 

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