Help on new payment plugin

  • Posts: 23
  • Thank you received: 0
13 years 8 months ago #11016

Hi Nicolas,
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.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 8 months ago #11023

As you can see in the function onPaymentConfiguration of the file plugins/hikashoppayment/bluepaid.php there is the code
$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.

  • Posts: 23
  • Thank you received: 0
13 years 8 months ago #11026

Thanks Nicolas,
Indeed there are those two lines.
Find attached the whole plugin, by now it is NOT TESTED AT ALL.

Thanks in advance,
Emilio

File Attachment:

File Name: plg_hikash...ceca.zip
File Size:8 KB

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 8 months ago #11037

The problem probably comes from the name of the class of your plugin: plgHikashoppaymentBluepaid
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.

  • Posts: 23
  • Thank you received: 0
13 years 8 months ago #11040

INDEED.
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.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 8 months ago #11043

Great !

Please Log in or Create an account to join the conversation.

  • Posts: 23
  • Thank you received: 0
13 years 8 months ago #11166

Hi Nicolas,
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.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 8 months ago #11168

What is the limit ?

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.

  • Posts: 23
  • Thank you received: 0
13 years 8 months ago #11169

Limit is nearly half of the whole url.

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.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 8 months ago #11170

Yes, that's all.

Please Log in or Create an account to join the conversation.

  • Posts: 23
  • Thank you received: 0
13 years 7 months ago #13199

Hi Nicolas,
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?

File Attachment:

File Name: log_ceca.txt
File Size:1 KB

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 7 months ago #13200

If you got the log but then it didn't continue, it means that the order id could not be found in the database. If you display your notify_ceca.php file directly from your browser, it should display you "Could not load any order for your notification XX"

Please Log in or Create an account to join the conversation.

  • Posts: 23
  • Thank you received: 0
13 years 7 months ago #13204

No, it does not reach the function. I insert a statement to write to a file as the first instruction within onNotifypayment, but it is not reached. Moreover, the order id exists.

Please Log in or Create an account to join the conversation.

  • Posts: 23
  • Thank you received: 0
13 years 7 months ago #13209

I have modified notify-ceca.php including a new, temporal, parameter with an order id. I have displayed notify-ceca.php directly on my browser. Nothing happens: it seems that onPaymentNotification is not reached, nothing is displayed on screen and control is returned to main page of hikashop front end

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 7 months ago #13215

Maybe there is a redirect done by joomla for SEF or something like this ?

Please Log in or Create an account to join the conversation.

  • Posts: 23
  • Thank you received: 0
13 years 7 months ago #13216

No idea, but I have tried it changing Joomla "use friendly URLs" in global config. for both true and false with same result

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 7 months ago #13218

Could you try to put traces in components/com_hikashop/com_hikashop.php in order to see if joomla gives the control to hikashop on that notification ?
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.

  • Posts: 23
  • Thank you received: 0
13 years 7 months ago #13219

It enters hikashop.php. Trying to follow the code...

Please Log in or Create an account to join the conversation.

  • Posts: 23
  • Thank you received: 0
13 years 7 months ago #13220

Well, this is what I'm able to do. I copy paste hikashop.php code and highlight where enters the program:


$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.

  • Posts: 23
  • Thank you received: 0
13 years 7 months ago #13221

By the way, check hikashop.php code: there is a <?php tag without ending ?> Don't know if important

Please Log in or Create an account to join the conversation.

Time to create page: 0.091 seconds
Powered by Kunena Forum