Commit 7d558e2d authored by rubofvil's avatar rubofvil
Browse files

Apply phpcs over file CRM/Core/Payment/Redsys.php

parent 23ee0877
<?php
use CRM_Redsys_ExtensionUtil as E;
require_once 'includes/apiRedsys.php';
......@@ -24,7 +25,7 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
static private $_singleton = NULL;
/**
* mode of operation: live or test
* Mode of operation: live or test.
*
* @var object
*/
......@@ -42,10 +43,12 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
public $_processorName = NULL;
/**
* Constructor
* Constructor.
*
* @param string $mode the mode of operation: live or test
* @param int $paymentProcessor paymentProcessor id
* @param string $mode
* the mode of operation: live or test.
* @param int $paymentProcessor
* paymentProcessor id.
*
* @return void
*/
......@@ -56,14 +59,16 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
}
/**
* Singleton function used to manage this object
* Singleton function used to manage this object.
*
* @param string $mode the mode of operation: live or test
* @param int $paymentProcessor paymentProcessor id
* @param string $mode
* the mode of operation: live or test.
* @param int $paymentProcessor
* paymentProcessor id.
*
* @return object
* @static
*
* @static
*/
public static function &singleton($mode, &$paymentProcessor) {
$processorName = $paymentProcessor["name"];
......@@ -74,13 +79,13 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
}
/**
* This function checks to see if we have the right config values
* This function checks to see if we have the right config values.
*
* @return string the error message if any
*
* @public
*/
public function checkConfig() {
$config = CRM_Core_Config::singleton();
$error = [];
if (empty($this->_paymentProcessor["user_name"])) {
......@@ -102,7 +107,7 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
* This function is not implemented, as long as this payment
* procesor is notify mode only.
*
* @param type $params
* @param mixed $params
*/
public function doDirectPayment(&$params) {
CRM_Core_Error::fatal(E::ts("This function is not implemented"));
......@@ -121,16 +126,15 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
$returnURL = $this->successUrl ?? $params['webform_redirect_success'];
$cancelURL = $this->cancelUrl ?? $params['webform_redirect_cancel'];
// Drupal Webform CiviCRM workflow
// Drupal Webform CiviCRM workflow.
if ($returnURL && $cancelURL) {
// Avoid issues with relative paths
// Avoid issues with relative paths.
$config = CRM_Core_Config::singleton();
$returnURL = (strpos($returnURL, '/') === 0) ? $config->userFrameworkBaseURL . $returnURL : $returnURL;
$cancelURL = (strpos($returnURL, '/') === 0) ? $config->userFrameworkBaseURL . $cancelURL : $cancelURL;
}
// CiviCRM Core Workflow, Contribution Pages / Events
else if (!$returnURL && !$cancelURL) {
elseif (!$returnURL && !$cancelURL) {
$url = ($component == 'event') ? 'civicrm/event/register' : 'civicrm/contribute/transact';
$cancel = ($component == 'event') ? '_qf_Register_display' : '_qf_Main_display';
$returnURL = CRM_Utils_System::url($url,
......@@ -149,7 +153,7 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
TRUE, NULL, FALSE
);
}
else {
else {
throw new CRM_Core_Exception(E::ts("Redsys payment processor - Missing vars to launch full process of redirects."));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment