Commit 7b0d521d authored by sluc23's avatar sluc23 Committed by GitHub
Browse files

Merge pull request #12 from babu-cat/merchant-terminal

More settings to customize Merchant Terminal number if it is not "1"
parents 8d687e57 31586918
......@@ -170,6 +170,8 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
$redsys_settings = CRM_Core_BAO_Setting::getItem("Redsys Settings", 'redsys_settings');
if($redsys_settings['ipn_http'] == '1')
$merchantUrl = preg_replace('/^https:/i', 'http:', $merchantUrl);
$merchantTerminal = empty($redsys_settings['merchant_terminal']) ? 1 : $redsys_settings['merchant_terminal'];
$miObj = new RedsysAPI;
$miObj->setParameter("Ds_Merchant_Amount", $params["amount"] * 100);
......@@ -177,7 +179,7 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
$miObj->setParameter("Ds_Merchant_MerchantCode", $this->_paymentProcessor["user_name"]);
$miObj->setParameter("Ds_Merchant_Currency", self::REDSYS_CURRENCY_EURO);
$miObj->setParameter("Ds_Merchant_TransactionType", self::REDSYS_TRANSACTION_TYPE_OPERATION_STANDARD);
$miObj->setParameter("Ds_Merchant_Terminal", 1);
$miObj->setParameter("Ds_Merchant_Terminal", $merchantTerminal);
$miObj->setParameter("Ds_Merchant_MerchantURL", $merchantUrl);
$miObj->setParameter("Ds_Merchant_UrlOK", $returnURL);
$miObj->setParameter("Ds_Merchant_UrlKO", $cancelURL);
......
......@@ -5,6 +5,7 @@ require_once 'CRM/Core/Form.php';
class CRM_Redsys_Form_Settings extends CRM_Core_Form {
public function buildQuickForm() {
$this->add('checkbox', 'ipn_http', 'Use http for IPN Callback');
$this->add('text', 'merchant_terminal', 'Merchant Terminal', array('size' => 5));
$this->addButtons(array(
array(
'type' => 'submit',
......@@ -27,6 +28,7 @@ class CRM_Redsys_Form_Settings extends CRM_Core_Form {
public function postProcess() {
$values = $this->exportValues();
$redsys_settings['ipn_http'] = $values['ipn_http'];
$redsys_settings['merchant_terminal'] = $values['merchant_terminal'];
CRM_Core_BAO_Setting::setItem($redsys_settings, "Redsys Settings", 'redsys_settings');
CRM_Core_Session::setStatus(ts('Redsys Settings Saved', array( 'domain' => 'com.ixiam.payment.redsys')), 'Configuration Updated', 'success');
......
......@@ -7,6 +7,10 @@ http://book.civicrm.org/user/current/contributions/payment-processors/
## Release Notes ##
### v1.6 ###
- More settings to customize Merchant Terminal number if it is not "1"
### v1.5 ###
- New Settings to force http urls in ipn callback, if Redsys doesn't support the SSL certificate installed in the website
......
......@@ -11,8 +11,8 @@
<author>iXiam Global Solutions</author>
<email>info@ixiam.com</email>
</maintainer>
<releaseDate>2016-09-14</releaseDate>
<version>1.5</version>
<releaseDate>2016-10-13</releaseDate>
<version>1.6</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.4</ver>
......
<fieldset>
<legend>Redsys Main Settings</legend>
<div class="view-content">
<div id="help">
Redsys doesn't support ipn callbacks using SSL shared certificate in multiples websites with a single IP.<br>
In that case you must force to use http protocl in ipn callback url
</div>
</div>
<div class="crm-block crm-form-block">
<table class="form-layout">
<tr class="crm-redsys-form-block-ipn_http">
<td width="20%">
......@@ -13,11 +6,23 @@
</td>
<td>
{$form.ipn_http.html}
<br>
<span class="description">Redsys doesn't support ipn callbacks using SSL shared certificate in multiples websites with a single IP. In that case you must force to use http protocol in ipn callback url</span>
</td>
</tr>
<tr class="crm-redsys-form-block-merchant_terminal">
<td width="20%">
{$form.merchant_terminal.label}
</td>
<td>
{$form.merchant_terminal.html}
<br>
<span class="description">Merchant terminal number ("1" if not defined)</span>
</td>
</tr>
</table>
</fieldset>
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="bottom"}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="bottom"}
</div>
</div>
......@@ -3,7 +3,7 @@
<item>
<path>civicrm/redsys/settings</path>
<page_callback>CRM_Redsys_Form_Settings</page_callback>
<title>Settings</title>
<title>Redsys Settings</title>
<access_arguments>administer CiviCRM</access_arguments>
</item>
</menu>
Markdown is supported
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