From 7e9cce8369a56f05f3b9ca70aac577f913e2241b Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Sun, 7 Apr 2019 13:50:09 -0400 Subject: [PATCH] Changes for ipv6 fraud management --- CRM/Core/Payment/TrustCommerce.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/CRM/Core/Payment/TrustCommerce.php b/CRM/Core/Payment/TrustCommerce.php index 64a7545..24502c8 100644 --- a/CRM/Core/Payment/TrustCommerce.php +++ b/CRM/Core/Payment/TrustCommerce.php @@ -372,16 +372,11 @@ class CRM_Core_Payment_TrustCommerce extends CRM_Core_Payment { // TODO: fix DB calls to be more the CiviCRM way $ip = $_SERVER['REMOTE_ADDR']; $agent = $_SERVER['HTTP_USER_AGENT']; - # Disable on IPv6 - if ( strpos(":", $ip) !== false ){ - return TRUE; - } - $ip = ip2long($ip); $blacklist = array(); $dao = CRM_Core_DAO::executeQuery('SELECT * FROM `trustcommerce_blacklist`'); while($dao->fetch()) { - if($ip >= $dao->start && $ip <= $dao->end) { - error_log('[client '.long2ip($ip).'] [agent '.$agent.'] Blacklisted by IP rule #'.$dao->id); + if($ip == $dao->ip) { + error_log('[client '.$ip.'] [agent '.$agent.'] Blacklisted by IP rule #'.$dao->id); return TRUE; } } @@ -487,7 +482,7 @@ class CRM_Core_Payment_TrustCommerce extends CRM_Core_Payment { switch($reply['status']) { case self::AUTH_BLACKLIST: - return self::error(9001, "Your transaction was declined for address verification reasons. If your address was correct please contact us at donate@fsf.org before attempting to retry your transaction."); + return self::error(9009, "Your transaction was declined. Please check the correctness of your credit card information, including CC number, expiration date and CVV code. "); break; case self::AUTH_APPROVED: break; -- 2.25.1