Commit 23ee0877 authored by rubofvil's avatar rubofvil
Browse files

webform_civicrm - Make less nested conditionals

parent 4e923d1a
......@@ -122,19 +122,15 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
$cancelURL = $this->cancelUrl ?? $params['webform_redirect_cancel'];
// Drupal Webform CiviCRM workflow
if ($returnURL || $cancelURL) {
if ($returnURL && $cancelURL) {
// 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;
}
else {
throw new CRM_Core_Exception(E::ts("Redsys payment processor - Missing vars to launch full process of redirects."));
}
if ($returnURL && $cancelURL) {
// 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 {
else if (!$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,
......@@ -153,6 +149,9 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
TRUE, NULL, FALSE
);
}
else {
throw new CRM_Core_Exception(E::ts("Redsys payment processor - Missing vars to launch full process of redirects."));
}
$merchantUrlParams = "contactID={$params['contactID']}&contributionID={$params['contributionID']}";
if ($component == 'event') {
......
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