Common subdirectories: uc_payflowpro/cacert and /var/www/vhosts/james.kickball/htdocs/sites/all/modules/uc_payflowpro/cacert
Common subdirectories: uc_payflowpro/includes and /var/www/vhosts/james.kickball/htdocs/sites/all/modules/uc_payflowpro/includes
Only in /var/www/vhosts/james.kickball/htdocs/sites/all/modules/uc_payflowpro/: .svn
diff uc_payflowpro/uc_payflowpro.module /var/www/vhosts/james.kickball/htdocs/sites/all/modules/uc_payflowpro/uc_payflowpro.module
29c29
< 
---
> 	$items = array();
196c196,452
<   global $user, $response;
---
>   switch ($data['txn_type']) {
>     case UC_CREDIT_AUTH_ONLY:
>     case UC_CREDIT_PRIOR_AUTH_CAPTURE:
>       $result = _uc_payflowpro_transaction_auth_or_capture_only($order_id, $amount, $data);
>       break;
>     case UC_CREDIT_REFERENCE_TXN:
>       $result = _uc_payflowpro_transaction_reference($order_id, $amount, $data);
>       break;
>     default:
>       $result = _uc_payflowpro_transaction_authcapture($order_id, $amount, $data);
>       break;
>   }
>   return $result;
> }
> 
> /**
>  * _uc_payflowpro_transaction_auth_or_capture_only().
>  */
> function _uc_payflowpro_transaction_reference($order_id, $amount, $data) {
>   global $user, $response; 
> 
>   $order = uc_order_load($order_id);
>   $request = array(
>     'USER' => is_null(variable_get('uc_payflowpro_user', '')) ? variable_get('uc_payflowpro_vendor', '') : 
>       variable_get('uc_payflowpro_user', ''),
>     'VENDOR' => variable_get('uc_payflowpro_vendor', ''),
>     'PARTNER' => variable_get('uc_payflowpro_partner', ''),
>     'PWD' => variable_get('uc_payflowpro_password', ''),
>     'TENDER' => 'C',
>     'TRXTYPE' => 'S',
>     'ORIGID' => $data['ref_id'],
>     'AMT' => $amount,
>   );
> 
>   $response = _uc_payflowpro_submit_nvp($request);
> 
>   // Fail if we received a blank response from the gateway.
>   if (!$response) {
>     $message = t('Received blank response from the PayFlow Pro gateway.');
>     $result = array(
>       'success' => FALSE,
>       'comment' => $message,
>       'message' => $message,
>       'uid' => $user->uid,
>     );
>     return $result;
>   }
> 
>   $txn_result_code = $response['RESULT'];
>   $txn_message = $response['RESPMSG'];
> 
>   $payment_data = array(
>     'pnref' => (string) $response['PNREF'],
>     'authcode' => (string) $response['AUTHCODE'],
>     'result' => (string) $response['RESULT'],
>   );
> 
>   if ((int) $txn_result_code != 0) {
>     $message = t('<b>@type: @message</b><br />Error code: @return_code.', array('@type' => _uc_payflowpro_txn_name($data['txn_type']), '@message' => $txn_message, '@amount' => uc_currency_format($amount), '@return_code' => $txn_result_code));
>     $result = array(
>       'success' => FALSE,
>       'comment' => $message,
>       'message' => $message,
>       'uid' => $user->uid,
>       'data' => $payment_data,
>     );
>   }
>   else {
>     $message = t('<b>@type: @message</b><br />Approval code: @code<br />PNRef: @pnref', array('@type' => _uc_payflowpro_txn_name($data['txn_type']), '@message' => $txn_message, '@code' => $payment_data['authcode'], '@pnref' => $payment_data['pnref']));
>     $result = array(
>       'success' => TRUE,
>       'comment' => $message,
>       'message' => $message,
>       'uid' => $user->uid,
>       'data' => $payment_data,
>     );
>   }
> 
>   // Don't log this as a payment money wasn't actually captured.  uc_order_comment_save($order_id, $user->uid, $comment, 'admin');
>   if (in_array($data['txn_type'], array(UC_CREDIT_AUTH_ONLY, UC_CREDIT_REFERENCE_SET, UC_CREDIT_VOID))) {
>     $result['log_payment'] = FALSE;
>   }
> 
>   $comment = t('<b>@type: @message</b><br />Amount: @amount', array('@type' => _uc_payflowpro_txn_name($data['txn_type']), '@message' => $txn_message, '@amount' => uc_currency_format($amount)));
> 
>   // Add fraud check info if this wasn't a reference transaction.
>   if ($data['txn_type'] != UC_CREDIT_REFERENCE_TXN) {
>     if (!empty($response->AVSResult->ZipMatch)) {
>       $comment .= '<br />'. t('AVS Zip check: @avszip', array('@avszip' => $response->AVSResult->ZipMatch));
>     }
> 
>     // Add the CVV response if enabled.
>     if (variable_get('uc_credit_cvv_enabled', TRUE) && !empty($response->CVResult)) {
>       $comment .= '<br />'. t('CVV check: @cvv', array('@cvv' => $response->CVResult));
>     }
>   }
> 
>   uc_order_comment_save($order_id, $user->uid, $comment, 'admin');
> 
>   if (variable_get('uc_payflowpro_enable_recurring', FALSE)) {
>     uc_payflowpro_recurring_charge_process($order);
>   }
> 
>   return $result;
>  }
> 
> // Submits a NVP API request to PayFlow.
> function _uc_payflowpro_submit_nvp($nvp, $mode = NULL) {
>   $servers['test'] = 'https://pilot-payflowpro.paypal.com:443/';
>   $servers['live'] = 'https://payflowpro.paypal.com:443/';
> 
>   if ($mode == NULL) {
>     $url = $servers[variable_get('uc_payflowpro_mode', 'test')];
>   }
>   else {
>     $url = $servers[$mode];
>   }
> 
>   // Setup a post fields array to send to PayFlow.
>   $post = array();
> 
>   foreach ($nvp as $name => $value) {
>     $post[] = $name .'='. $value;
>   }
> 
>   // Send the actual request via SSL to PayPal.
>   $ch = curl_init();
>   curl_setopt($ch, CURLOPT_URL, $url);
>   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>   curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/namevalue'));
>   curl_setopt($ch, CURLOPT_HEADER, 1);
>   curl_setopt($ch, CURLOPT_TIMEOUT, 45);
>   curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $post));
>   curl_setopt($ch, CURLOPT_POST, 1);
>   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
>   $response = curl_exec($ch);
> 
>   // Log any errors to the watchdog.
>   if ($error = curl_error($ch)) {
>     watchdog('uc_payflowpro', t('cURL error: @error', array('@error' => $error)), WATCHDOG_ERROR);
>     return FALSE;
>   }
>   curl_close($ch);
> 
>   // Return FALSE if we didn't get a response.
>   if (empty($response)) {
>     return FALSE;
>   }
> 
>   // Prepare a data array to return with name-value pairs from the server.
>   $response = strstr($response, 'RESULT');
>   $data = array();
> 
>   foreach (explode('&', $response) as $val) {
>     $val2 = explode('=', $val);
>     $data[$val2[0]] = $val2[1];
>   }
> 
>   return $data;
> }
> 
> /**
>  * _uc_payflowpro_transaction_auth_or_capture_only().
>  */
> function _uc_payflowpro_transaction_auth_or_capture_only($order_id, $amount, $data) {
>   global $user, $response; 
> 
>   $order = uc_order_load($order_id);
>   $request = _uc_payflowpro_cc_auth_or_capture_xml($order_id, $amount, $data);
>   $response = _uc_payflowpro_submit_xml($request);
> 
>   // Fail if we received a blank response from the gateway.
>   if (!$response) {
>     $message = t('Received blank response from the PayFlow Pro gateway.');
>     $result = array(
>       'success' => FALSE,
>       'comment' => $message,
>       'message' => $message,
>       'uid' => $user->uid,
>     );
>     return $result;
>   }
> 
>   $txn_result_code = $response->Result;
>   $txn_message = $response->Message;
> 
>   $payment_data = array(
>     'pnref' => (string) $response->PNRef,
>     'authcode' => (string) $response->AuthCode,
>     'result' => (string) $response->Result,
>   );
> 
>   if ((int) $txn_result_code != 0) {
>     $message = t('<b>@type: @message</b><br />Error code: @return_code.', array('@type' => _uc_payflowpro_txn_name($data['txn_type']), '@message' => $txn_message, '@amount' => uc_currency_format($amount), '@return_code' => $txn_result_code));
>     $result = array(
>       'success' => FALSE,
>       'comment' => $message,
>       'message' => $message,
>       'uid' => $user->uid,
>       'data' => $payment_data,
>     );
>   }
>   else {
>     $message = t('<b>@type: @message</b><br />Approval code: @code<br />PNRef: @pnref', array('@type' => _uc_payflowpro_txn_name($data['txn_type']), '@message' => $txn_message, '@code' => $payment_data['authcode'], '@pnref' => $payment_data['pnref']));
>     $result = array(
>       'success' => TRUE,
>       'comment' => $message,
>       'message' => $message,
>       'uid' => $user->uid,
>       'data' => $payment_data,
>     );
> 
>     // If this was an authorization only transaction...
>     if ($data['txn_type'] == UC_CREDIT_AUTH_ONLY) {
>       // Log the authorization to the order.
>       uc_credit_log_authorization($order_id, $payment_data['pnref'], $amount);
>     }
>     elseif ($data['txn_type'] == UC_CREDIT_PRIOR_AUTH_CAPTURE) {
>       uc_credit_log_prior_auth_capture($order_id, $data['auth_id']);
>     }
> 
>     // Log the PNRef as a reference for future transactions.
>     if ($data['txn_type'] != UC_CREDIT_AUTH_ONLY && $data['txn_type'] != UC_CREDIT_REFERENCE_TXN) {
>       uc_credit_log_reference($order_id, $payment_data['pnref'], $order->payment_details['cc_number']);
>     }
>   }
> 
>   // Don't log this as a payment money wasn't actually captured.
>   if (in_array($data['txn_type'], array(UC_CREDIT_AUTH_ONLY, UC_CREDIT_REFERENCE_SET, UC_CREDIT_VOID))) {
>     $result['log_payment'] = FALSE;
>   }
> 
>   $comment = t('<b>@type: @message</b><br />Amount: @amount<br />PNREF: @pnref', array('@type' => _uc_payflowpro_txn_name($data['txn_type']), '@message' => $txn_message, '@amount' => uc_currency_format($amount), '@pnref' => $payment_data['pnref']));
> 
>   // Add fraud check info if this wasn't a reference transaction.
>   if ($data['txn_type'] != UC_CREDIT_REFERENCE_TXN) {
>     if (!empty($response->AVSResult->ZipMatch)) {
>       $comment .= '<br />'. t('AVS Zip check: @avszip', array('@avszip' => $response->AVSResult->ZipMatch));
>     }
> 
>     // Add the CVV response if enabled.
>     if (variable_get('uc_credit_cvv_enabled', TRUE) && !empty($response->CVResult)) {
>       $comment .= '<br />'. t('CVV check: @cvv', array('@cvv' => $response->CVResult));
>     }
>   }
> 
>   uc_order_comment_save($order_id, $user->uid, $comment, 'admin');
> 
>   if (variable_get('uc_payflowpro_enable_recurring', FALSE)) {
>     uc_payflowpro_recurring_charge_process($order);
>   }
> 
>   return $result;
> }
> 
> // Generate XML for credit card sale
> function _uc_payflowpro_cc_auth_or_capture_xml($order_id, $amount, $data) {
198a455,500
>   // Determine the payment action from the data array.
>   $payment_action = _uc_payflowpro_txn_name($data['txn_type']);
> 
>   // Build the appropriate XML output for the payment action.
>   switch ($payment_action) {
>     case 'Authorization':
>       $xml = '         <' . $payment_action . '>
>           <PayData>
> ' . _uc_payflowpro_invoice_xml($order) . '
>             <Tender>
> ' . _uc_payflowpro_cc_info_xml($order_id) . '
>             </Tender>
>           </PayData>
>         </' . $payment_action . '>';
>         break;
>     case 'Capture':
>       $xml = '         <'. $payment_action .'>
>           <PNRef>'. $data['auth_id'] .'</PNRef>
> '. _uc_payflowpro_invoice_xml($order) .'
>         </'. $payment_action .'>';
>       break;
>   }
>   return _uc_payflowpro_wrap_xml($xml);
> }
> 
> // Returns the PayFlow Pro name for a transaction type.
> function _uc_payflowpro_txn_name($txn_type) {
>   switch ($txn_type) {
>     case UC_CREDIT_AUTH_ONLY:
>       return 'Authorization';
>     case UC_CREDIT_PRIOR_AUTH_CAPTURE:
>       return 'Capture';
>     case UC_CREDIT_AUTH_CAPTURE:
>       return 'Sale';
>     case UC_CREDIT_REFERENCE_TXN:
>       return 'Reference Sale';
>   }
> }
> 
> /**
>  * _uc_payflowpro_transaction_authcapture().
>  */
> function _uc_payflowpro_transaction_authcapture($order_id, $amount, $data) {
>   global $user, $response;
>   
>   $order = uc_order_load($order_id);
259d560
< 
