- Posts: 23
- Thank you received: 0
Help on new payment plugin
I'm trying to develop a new payment plugin for CECA (group of Savings Banks in Spain). I am not a php programmer but I found it is very close to Bluepaid plugin, so I nearly did a copy-paste-edit.
I installed it ok but now I am stuck on an error for which I have no clue.
Error message when trying to edit configuration:
Fatal error: Call to a member function display() on a non-object in <location>/hikashop/plugins/hikashoppayment/ceca/ceca_configuration.php on line 123
Same ocurrs in line 133 and 143 . This is the code of ceca_configuration.php block which is a copy-paste from bluepaid_configuration.php (found numbered and on bold the line whit errors)
<tr>
<td class="key">
<label for="data[payment][payment_params][invalid_status]">
<?php echo JText::_( 'CECA_INVALID_STATUS' ); ?>
</label>
</td>
<td>
123 <?php echo $this->data->display("data[payment][payment_params][invalid_status]",@$this->element->payment_params->invalid_status); ?>
</td>
</tr>
<tr>
<td class="key">
<label for="data[payment][payment_params][pending_status]">
<?php echo JText::_( 'CECA_PENDING_STATUS' ); ?>
</label>
</td>
<td>
133 <?php echo $this->data->display("data[payment][payment_params][pending_status]",@$this->element->payment_params->pending_status); ?>
</td>
</tr>
<tr>
<td class="key">
<label for="data[payment][payment_params][verified_status]">
<?php echo JText::_( 'CECA_VERIFIED_STATUS' ); ?>
</label>
</td>
<td>
143 <?php echo $this->data->display("data[payment][payment_params][verified_status]",@$this->element->payment_params->verified_status); ?>
</td>
</tr>
As said, I am stuck, I would really apreciate any help on this.
Plugin is not tested at all, but, if it would help you, I can attach the whole set of files.
Thanks,
Emilio
Please Log in or Create an account to join the conversation.
$this->category = hikashop::get('type.categorysub');
$this->category->type = 'status';
at the end of the function. If you don't have these two lines in your plugin in the onPaymentConfiguration function, you will get these errors you're talking about.
Once the plugin is tested we would love to add it in HikaShop. I'm sure other others would be interested in using it.
Please Log in or Create an account to join the conversation.
Indeed there are those two lines.
Find attached the whole plugin, by now it is NOT TESTED AT ALL.
Thanks in advance,
Emilio
This attachment is hidden for guests.
Please log in or register to see it.
Please Log in or Create an account to join the conversation.
Please change it to plgHikashoppaymentCeca otherwise, hikashop won't be able to call it to initialize all the variables which you then use in the ceca_configuration.php file.
Please Log in or Create an account to join the conversation.
My fault, I did not see it.
I'm going on. Be sure I'll share it for contributing to your fantastic sw.
Emilio
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I met something I would need your advice for.
CECA system offers a payment accepted on-line notification. On their control panel I must state the notify url their servers should use. Within Hikashop it is something like:
CECA_NOTIFICATION_URL www.gamaquality.com/nueva/index.php?opti...pl=component&lang=es
But I met a huge problem: in their control panel, the length of the notify url field is much shorter than needed for above url, so it gets truncated and useless. It is not feasible to ask for that big company to extend field length.
Any ideas?
Thanks in advance
Emilio
Please Log in or Create an account to join the conversation.
The easiest solution will be to create a file redirect.php at the root of your website and have something like this in this:
<?php
$_GET='com_hikashop';
$_GET='component';
$_GET='checkout';
$_GET='notify';
$_GET='ceca';
$_GET='es';
include('index.php');
Then, you can just user the notify url : www.gamaquality.com/nueva/redirect.php
Please Log in or Create an account to join the conversation.
Is only that to be on redirect.php? I'll try it tomorrow, I think we both should go to sleep.
Thanks a lot.
Emilio
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I had to leave apart this plugin for a week. Now I am reasuming it.
I found a problem. I wrote that little script for notifying. I realised that array should not be $_GET, but $_POST and correct it. But i am seeing that onPaymentNotification function is not called.
I have checked that the payment provider indeed makes a post. For that, on notify-ceca.php I write the $_POST array into a file, which looks like:
Array
(
[MerchantID] => 085876431
[AcquirerBIN] => 0000554027
[TerminalID] => 00000003
[Num_operacion] => 34
[Importe] => 000000010500
[TipoMoneda] => 978
[Exponente] => 2
[Referencia] => 120053993711040500104306007000
[Firma] => f88dfcc6c37fd531d331f03a4dc1fd6e6bbf5933
[Codigo_pedido] =>
[Codigo_cliente] =>
[Codigo_comercio] =>
[Num_aut] => 116817
[BIN] => 554050
[Cambio_moneda] => 1.000000
[Idioma] => 1
[Pais] => 724
[Tipo_tarjeta] => C
[Descripcion] =>
[option] => com_hikashop
[tmpl] => component
[ctrl] => checkout
[task] => notify
[notif_payment] => ceca
[lang] => es
)
Parameters to the end, beginning with [option]=> com_hikashop, are those included by the notify-ceca.php script. others are received from the provider.
Problem is that I check in a similar manner that onNotifyPayment function is not called at all.
It seems that index.php is not being included or that it is not routing.
Any idea?
This attachment is hidden for guests.
Please log in or register to see it.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
If not, then, you will have to look into the joomla code to see where it stops...
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
$fp = fopen('log-hikashop.txt', 'w');
fwrite ($fp, "enter hikashop \n");
jimport('joomla.application.component.controller');
jimport( 'joomla.application.component.view');
JRequest::setVar('hikashop_front_end_main',1);
include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php');
global $Itemid;
if(empty($Itemid)){
$urlItemid = JRequest::getInt('Itemid');
if($urlItemid){
$Itemid = $urlItemid;
}
}
$view = JRequest::getCmd('view');
if(!empty($view) && !JRequest::getCmd('ctrl')){
JRequest::setVar('ctrl',$view);
$layout = JRequest::getCmd('layout');
if(!empty($layout)){
JRequest::setVar('task',$layout);
}
fwrite ($fp, "dentro de ctrl \n");
}
$session =& JFactory::getSession();
if(is_null($session->get('registry'))){
jimport('joomla.registry.registry');
$session->set('registry', new JRegistry('session'));
fwrite ($fp, "dentro de registry \n");
}
$taskGroup = JRequest::getCmd('ctrl','category');
if(!include(HIKASHOP_CONTROLLER.$taskGroup.'.php')){
return JError::raiseError( 404, 'Page not found : '.$taskGroup );
fwrite ($fp, "dentro de ctrl y category \n");
}
if($taskGroup!='checkout'){
$app =& JFactory::getApplication();
$app->setUserState('com_hikashop.ssl_redirect',0);
fwrite ($fp, "dentro de checkout \n");
}
$className = ucfirst($taskGroup).'Controller';
$classGroup = new $className();
JRequest::setVar( 'view', $classGroup->getName() );
$classGroup->execute( JRequest::getCmd('task'));
$classGroup->redirect();
if(JRequest::getString('tmpl') !== 'component'){
echo hikashop::footer();
}
JRequest::setVar('hikashop_front_end_main',0);
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.