Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payflow Pro not payflo #12083

Merged
merged 3 commits into from
May 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 23 additions & 46 deletions CRM/Core/Payment/PayflowPro.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
+----------------------------------------------------------------------------+
| PayflowPro Core Payment Module for CiviCRM version 5 |
| Payflow Pro Core Payment Module for CiviCRM version 5 |
+----------------------------------------------------------------------------+
| Licensed to CiviCRM under the Academic Free License version 3.0 |
| |
Expand Down Expand Up @@ -57,7 +57,7 @@ public function __construct($mode, &$paymentProcessor) {
*/
public function doDirectPayment(&$params) {
if (!defined('CURLOPT_SSLCERT')) {
CRM_Core_Error::fatal(ts('PayFlowPro requires curl with SSL support'));
CRM_Core_Error::fatal(ts('Payflow Pro requires curl with SSL support'));
}

/*
Expand Down Expand Up @@ -303,7 +303,7 @@ public function doDirectPayment(&$params) {

/*******************************************************
* Success !
* This is a successful transaction. PayFlow Pro does return further information
* This is a successful transaction. Payflow Pro does return further information
* about transactions to help you identify fraud including whether they pass
* the cvv check, the avs check. This is stored in
* CiviCRM as part of the transact
Expand Down Expand Up @@ -344,10 +344,9 @@ public function doDirectPayment(&$params) {
return self::errorExit(9014, "Check the code - all transactions should have been headed off before they got here. Something slipped through the net");
}

/*
* Produces error message and returns from class
*/
/**
* Produces error message and returns from class
*
* @param null $errorCode
* @param null $errorMessage
*
Expand All @@ -365,10 +364,9 @@ public function &errorExit($errorCode = NULL, $errorMessage = NULL) {
}


/*
* NOTE: 'doTransferCheckout' not implemented
*/
/**
* NOTE: 'doTransferCheckout' not implemented
*
* @param array $params
* @param $component
*
Expand All @@ -378,28 +376,14 @@ public function doTransferCheckout(&$params, $component) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}

/*
/**
* This public function checks to see if we have the right processor config values set
*
* NOTE: Called by Events and Contribute to check config params are set prior to trying
* register any credit card details
*
* @param string $mode
* The mode we are operating in (live or test) - not used.
*
* returns string $errorMsg if any errors found - null if OK
*/

// function checkConfig( $mode ) // CiviCRM V1.9 Declaration

/**
* CiviCRM V2.0 Declaration
* This function checks to see if we have the right config values
*
* @internal param string $mode the mode we are operating in (live or test)
*
* @return string
* the error message if any
* @return string|null
* the error message if any, null if OK
*/
public function checkConfig() {
$errorMsg = array();
Expand All @@ -418,12 +402,10 @@ public function checkConfig() {
return NULL;
}
}
//end check config

/*
* convert to a name/value pair (nvp) string
*/
/**
* convert to a name/value pair (nvp) string
*
* @param $payflow_query_array
*
* @return array|string
Expand All @@ -437,22 +419,15 @@ public function convert_to_nvp($payflow_query_array) {
return $payflow_query;
}

/*
* Submit transaction using CuRL
* @submiturl string Url to direct HTTPS GET to
* @payflow_query value string to be posted
*/
/**
* @param $submiturl
* @param $payflow_query
* Submit transaction using cURL
*
* @param string $submiturl Url to direct HTTPS GET to
* @param $payflow_query value string to be posted
*
* @return mixed|object
*/
public function submit_transaction($submiturl, $payflow_query) {
/*
* Submit transaction using CuRL
*/

// get data ready for API
$user_agent = $_SERVER['HTTP_USER_AGENT'];
// Here's your custom headers; adjust appropriately for your setup:
Expand All @@ -467,7 +442,7 @@ public function submit_transaction($submiturl, $payflow_query) {
$headers[] = "X-VPS-Timeout: 45";
//random unique number - the transaction is retried using this transaction ID
// in this function but if that doesn't work and it is re- submitted
// it is treated as a new attempt. PayflowPro doesn't allow
// it is treated as a new attempt. Payflow Pro doesn't allow
// you to change details (e.g. card no) when you re-submit
// you can only try the same details
$headers[] = "X-VPS-Request-ID: " . rand(1, 1000000000);
Expand Down Expand Up @@ -529,7 +504,7 @@ public function submit_transaction($submiturl, $payflow_query) {
}
}
if ($responseHeaders['http_code'] != 200) {
return self::errorExit(9015, "Error connecting to the payflo API server.");
return self::errorExit(9015, "Error connecting to the Payflow Pro API server.");
}

/*
Expand Down Expand Up @@ -591,7 +566,6 @@ public function submit_transaction($submiturl, $payflow_query) {
curl_close($ch);
return $responseData;
}
//end submit_transaction

/**
* @param int $recurringProfileID
Expand All @@ -601,7 +575,7 @@ public function submit_transaction($submiturl, $payflow_query) {
*/
public function getRecurringTransactionStatus($recurringProfileID, $processorID) {
if (!defined('CURLOPT_SSLCERT')) {
CRM_Core_Error::fatal(ts('PayFlowPro requires curl with SSL support'));
CRM_Core_Error::fatal(ts('Payflow Pro requires curl with SSL support'));
}

/*
Expand Down Expand Up @@ -663,7 +637,10 @@ public function getRecurringTransactionStatus($recurringProfileID, $processorID)
$nvpArray[$keyval] = $valval;
$result = substr($result, $valuepos + 1, strlen($result));
}
// get the result code to validate.

// @TODO Function is named getRecurringTransactionStatus() which
// suggests it returns a result. It sets a $result_code but doesn't return
// it, printing output instead?
$result_code = $nvpArray['RESULT'];
print_r($responseData);

Expand Down