From fa2c4d0b3b0ca71e004898706b2dd9f226476c62 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 17 Apr 2018 10:43:48 +1200 Subject: [PATCH] E-notice fix --- CRM/Core/Payment/PayPalImpl.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index 80b01dba57..f70a2cace1 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -994,6 +994,14 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { $url = $this->_paymentProcessor['url_api'] . 'nvp'; } + $p = array(); + foreach ($args as $n => $v) { + $p[] = "$n=" . urlencode($v); + } + + //NVPRequest for submitting to server + $nvpreq = implode('&', $p); + if (!function_exists('curl_init')) { CRM_Core_Error::fatal("curl functions NOT available."); } @@ -1010,14 +1018,6 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); - $p = array(); - foreach ($args as $n => $v) { - $p[] = "$n=" . urlencode($v); - } - - //NVPRequest for submitting to server - $nvpreq = implode('&', $p); - //setting the nvpreq as POST FIELD to curl curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq); @@ -1039,9 +1039,9 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { curl_close($ch); } - if (strtolower($result['ack']) != 'success' && - strtolower($result['ack']) != 'successwithwarning' - ) { + $outcome = strtolower(CRM_Utils_Array::value('ack', $result)); + + if ($outcome != 'success' && $outcome != 'successwithwarning') { throw new PaymentProcessorException("{$result['l_shortmessage0']} {$result['l_longmessage0']}"); $e = CRM_Core_Error::singleton(); $e->push($result['l_errorcode0'], -- 2.25.1