I am trying to make a new payment processor called Liberty Reserve.
I copied the files from Administrator/components/com_hronoforms/form_actions/2co_sender to Lr_Sender folder. Edited the the php and ctp file to match the fields to be acceptables by Liberty Reserve SCI Servers. Now my Liberty Reserever Sender is showing on ChronoForm in Advanced Wizard > Actions > Payment Gateways/Processors. Dragged it on my Onload Event. In the edit windows set all the paramenters. But out of 14 fileds only 5 can save be saved and remaining fields remain blank.
Following is the code I am using:
lr_sender.php
<?php
/**
* CHRONOFORMS version 4.0
* Copyright (c) 2006 - 2011 Chrono_Man, ChronoEngine.com. All rights reserved.
* Author: Chrono_Man (ChronoEngine.com)
* @license GNU/GPL
* Visit http://www.ChronoEngine.com for regular updates and information.
* Liberty Reserve Payment Gateway Plugin by CodeSlayer. Created, modifying Original 2Co Payment Processor by Chrono_Man
**/
class CfactionLRSender{
var $formname;
var $formid;
var $group = array('id' => 'payments', 'title' => 'Payment Gateways/Processors');
var $events = array('success' => 0, 'fail' => 0);
var $details = array('title' => 'Liberty Reserve Sender', 'tooltip' => 'Communicate with the Liberty Reserve payment gateway.');
function run($form, $actiondata){
$params = new JParameter($actiondata->params);
global $mainframe;
$checkout_values = array(
//variables
'lr_acc' => $form->data[$params->get('lr_acc')],
'lr_store' => $form->data[$params->get('lr_store')],
'lr_currency' => $form->data[$params->get('lr_currency')],
'lr_merchant_ref' => $form->data[$params->get('lr_merchant_ref')],
'lr_comments' => $form->data[$params->get('lr_comments')],
'lr_success_url' => $form->data[$params->get('lr_success_url')],
'lr_success_url_method' => $form->data[$params->get('lr_success_url_method')],
'lr_fail_url' => $form->data[$params->get('lr_fail_url')],
'lr_fail_url_method' => $form->data[$params->get('lr_fail_url_method')],
'lr_status_url' => $form->data[$params->get('lr_status_url')],
'lr_status_url_method' => $form->data[$params->get('lr_status_url_method')],
'lr_field1' => $form->data[$params->get('lr_field1')],
'lr_field2' => $form->data[$params->get('lr_field2')],
'lr_field3' => $form->data[$params->get('lr_field3')],
);
}
function load($clear){
if($clear){
$action_params = array(
'lr_acc' => '',
'lr_store' => '',
'lr_currency' => '',
'lr_merchant_ref' => '',
'lr_comments' => '',
'lr_success_url' => '',
'lr_success_url_method' => '',
'lr_fail_url' => '',
'lr_fail_url_method' => '',
'lr_status_url' => '',
'lr_status_url_method' => '',
'lr_field1' => '',
'lr_field2' => '',
'lr_field3' => '',
);
}
return array('action_params' => $action_params);
}
}
?>
And
lr_sender.ctp
<?php
require_once(JPATH_SITE.DS."administrator".DS."components".DS."com_chronoforms".DS."helpers".DS."tabs_helper.php");
$PluginTabsHelper = new TabsHelper();
?>
<div class="dragable" id="cfaction_lr_sender">Liberty Reserve Sender</div>
<!--start_element_code-->
<div class="element_code" id="cfaction_lr_sender_element">
<label class="action_label">lr Sender</label>
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_acc]" id="action_lr_sender_{n}_lr_acc" value="<?php echo $action_params['lr_acc']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_store]" id="action_lr_sender_{n}_lr_store" value="<?php echo $action_params['lr_store']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_currency]" id="action_lr_sender_{n}_lr_currency" value="<?php echo $action_params['lr_currency']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_merchant_ref]" id="action_lr_sender_{n}_lr_merchant_ref" value="<?php echo $action_params['lr_merchant_ref']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_comments]" id="action_lr_sender_{n}_lr_comments" value="<?php echo $action_params['lr_comments']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_success_url]" id="action_lr_sender_{n}_lr_success_url" value="<?php echo $action_params['lr_success_url']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_success_url_method]" id="action_lr_sender_{n}_lr_success_url_method" value="<?php echo $action_params['lr_success_url_method']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_fail_url]" id="action_lr_sender_{n}_lr_fail_url" value="<?php echo $action_params['lr_fail_url']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_fail_url_method]" id="action_lr_sender_{n}_lr_fail_url_method" value="<?php echo $action_params['lr_fail_url_method']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_status_url]" id="action_lr_sender_{n}_lr_status_url" value="<?php echo $action_params['lr_status_url']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_status_url_method]" id="action_lr_sender_{n}_lr_status_url_method" value="<?php echo $action_params['lr_status_url_method']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_field1]" id="action_lr_sender_{n}_lr_field1" value="<?php echo $action_params['lr_field1']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_field2]" id="action_lr_sender_{n}_lr_field2" value="<?php echo $action_params['lr_field2']; ?>" />
<input type="hidden" name="chronoaction[{n}][action_lr_sender_{n}_lr_field3]" id="action_lr_sender_{n}_lr_field3" value="<?php echo $action_params['lr_field3']; ?>" />
<input type="hidden" id="chronoaction_id_{n}" name="chronoaction_id[{n}]" value="{n}" />
<input type="hidden" name="chronoaction[{n}][type]" value="lr_sender" />
</div>
<!--end_element_code-->
<div class="element_config" id="cfaction_lr_sender_element_config">
<?php echo $PluginTabsHelper->Header(array('fields' => 'Fields', 'settings' => 'Settings', 'help' => 'Help'), 'lr_sender_config_{n}'); ?>
<?php echo $PluginTabsHelper->tabStart('fields'); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_acc_config', array('type' => 'text', 'label' => "Liberty Account ID", 'class' => 'medium_input', 'smalldesc' => 'ex: U1234567, X3214567')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_store_config', array('type' => 'text', 'label' => "Your Store Name", 'class' => 'medium_input', 'smalldesc' => 'ex: Wallmart')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_currency_config', array('type' => 'text', 'label' => "Currency", 'class' => 'medium_input', 'smalldesc' => 'ex: LRUSD for US Dollars, LREUR for Euro')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_merchant_ref_config', array('type' => 'text', 'label' => "Merchant Reference", 'class' => 'medium_input', 'smalldesc' => 'Here we would like to use FP_User_id. So that we know which user send us money')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_comments_config', array('type' => 'text', 'label' => "LR Comments", 'class' => 'medium_input', 'smalldesc' => 'If FP_User want to write his own message.')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_success_url', array('type' => 'text', 'label' => "on Success URL", 'class' => 'medium_input', 'smalldesc' => 'Enter the page you wish your customers to go after a successful payment. ex: http://www.forbiddenpalace.tk/success.html')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_success_url_method', array('type' => 'text', 'label' => "on Success Transaction Method", 'class' => 'medium_input', 'smalldesc' => 'POST or GET')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_fail_url', array('type' => 'text', 'label' => "On Failure URL", 'class' => 'medium_input', 'smalldesc' => 'Enter the page you wish your customers to go after a successful payment. ex: http://www.forbiddenpalace.tk/fail.html')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_fail_url_method', array('type' => 'text', 'label' => "on Failure Transaction Method", 'class' => 'medium_input', 'smalldesc' => 'POST or GET')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_status_url', array('type' => 'text', 'label' => "Status URL", 'class' => 'medium_input', 'smalldesc' => 'Examples: http://www.example.com/status.php, mailto:mymail@example.com. ')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_status_url_method', array('type' => 'text', 'label' => "Status URL Method", 'class' => 'medium_input', 'smalldesc' => 'ex: POST or GET')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_field1', array('type' => 'text', 'label' => "Additional Field 1", 'class' => 'medium_input', 'smalldesc' => 'You may send additional passthrough information that will be returned to you and will not be stored anywhere in Librty Reserve system. This may include order numbers, customer user names or any other data. You will need to specify the field name and the field value. Information limited to 50 characters.')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_field2', array('type' => 'text', 'label' => "Additional Field 2", 'class' => 'medium_input', 'smalldesc' => 'You may send additional passthrough information that will be returned to you and will not be stored anywhere in Librty Reserve system. This may include order numbers, customer user names or any other data. You will need to specify the field name and the field value. Information limited to 50 characters.')); ?>
<?php echo $HtmlHelper->input('action_lr_sender_{n}_lr_field3', array('type' => 'text', 'label' => "Additional Field 3", 'class' => 'medium_input', 'smalldesc' => 'You may send additional passthrough information that will be returned to you and will not be stored anywhere in Librty Reserve system. This may include order numbers, customer user names or any other data. You will need to specify the field name and the field value. Information limited to 50 characters.')); ?>
<?php echo $PluginTabsHelper->tabEnd(); ?>
<?php echo $PluginTabsHelper->tabStart('settings'); ?>
<?php echo $PluginTabsHelper->tabEnd(); ?>
<?php echo $PluginTabsHelper->tabStart('help'); ?>
<p>
<ul>
<li>This plugin will communicate with the Liberty Reserve server, you must have a Liberty Reserve Account in order to be able to use this one.</li>
<li>Map your form fields names to the fields required by Liberty Reserve, no spaces should be in the fields name.</li>
<li>Enter your Libert Reserve account settings.</li>
<li>Once triggered, this action will redirect the user to the Libert Reserve servers for payment.</li>
<li>For more documentation about the LR parameters, please search the Liberty Reserve website for http://www.libertyreserve.com/en/paymentform.</li>
</ul>
</p>
<?php echo $PluginTabsHelper->tabEnd(); ?>
</div>
Please can you point out where I am going wrong.
Regards
Hassan