Commit 4e923d1a authored by rubofvil's avatar rubofvil
Browse files

webform-civicrm - simplify conditionals where are incoming by webform

parent 582ab628
......@@ -118,21 +118,19 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
CRM_Core_Error::fatal(E::ts('Component is invalid'));
}
// Drupal Webform CiviCRM workflow
if (!empty($this->successUrl) || !empty($params['webform_redirect_success'])) {
if ((!empty($this->successUrl) && !empty($this->successUrl)) ||
(!empty($params['webform_redirect_success']) && !empty($params['webform_redirect_cancel']))
) {
$returnURL = $this->successUrl ? $this->successUrl : $params['webform_redirect_success'];
$cancelURL = $this->cancelUrl ? $this->cancelUrl : $params['webform_redirect_cancel'];
$returnURL = $this->successUrl ?? $params['webform_redirect_success'];
$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 process of redirects."));
throw new CRM_Core_Exception(E::ts("Redsys payment processor - Missing vars to launch full process of redirects."));
}
}
// CiviCRM Core Workflow, Contribution Pages / Events
......
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