How to make a payment plugin?

  • Posts: 25
  • Thank you received: 1
10 years 10 months ago #138756

Hi,

I have read the doc ( www.hikashop.com/support/support/documen...ntation.html#payment ) and I have some questions:

This sample scrypt ...

class plgHikashopName extends JPlugin {
	function plgHikashopName(&$subject, $config){
		parent::__construct($subject, $config);
	}

	// Call a trigger, in this example: onBeforeOrderCreate
	function onBeforeOrderCreate(&$order,&$send_email) {
		// Actions to do when my trigger is called
	}

	// Another trigger
	function onAfterOrderCreate(&$order) {
		// Actions to do when my trigger is called
	}
}

What directory I put? I want it visible and configurable on the hikashop/configuration/payment_mode

Thanks.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 10 months ago #138758

Hi,

If you want to create a payment plugin, the best is to use the "hikashopPaymentPlugin" interface.
Depending the kind of payment plugin you want to implement, having a look to an existing HikaShop plugin could be interesting.
The smallest one might be "collect on delivery".

The interface will provide you a lot of services, some repetitive tasks are already manage by the interface so you just have to write the minimum of code, only the specific code.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: andersondionizio

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

  • Posts: 25
  • Thank you received: 1
10 years 10 months ago #138852

Ok,

I have copied and changed the "collect on delevery" to adapt to my new plugin. I have created too a folder on the "plugins/hikashoppayment/pagseguro". But "pagseguro" still not showing at "configuration/payment plugin".

How to do the new plugin visible at configuration/payment plugin listing?

Thanks for the help.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #138865

You need to zip your plugin files and install them via the joomla installer so that joomla sees it as a plugin of the group "hikashoppayment" only then will you see it as a potential payment method in Hikashop.

The following user(s) said Thank You: andersondionizio

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

  • Posts: 25
  • Thank you received: 1
10 years 10 months ago #138951

Thanks for the answers,

Nicolas, i did as you sayed and joomla install without errors.

Now I am adding a configuration file, i copyed the paypal configuration file as sample. I am new on Joomla and i dont know its architecture. I read the code at paypal_configuration.php and where is comming this array: data[payment] ? How I can add one array with my new plugin ?

Thanks.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #138955

It's not an array. It's a piece of input name. You can just keep it in your payment plugin fields.
Basically, you just copy/paste all the code/files and rename paypal to "yourpaymentgateway" in the files and then you have your plugin where you can just replace the different bits like the specific fields you would need, or the IPN handling...

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

  • Posts: 25
  • Thank you received: 1
10 years 10 months ago #138998

I did exactly as you said, but the plugin configuration page stay the way as on print-screen attached. What is wrong? The font of plugin is also attached, please help!

Attachments:

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

  • Posts: 25
  • Thank you received: 1
10 years 10 months ago #139116

Forget my last message, i have created other plugin based other payment plugin and that error is no more.

But my new plugin get a error 500 on the step2, after finish order (the payment's library create a external link), like printscreen attached. Do you have any idea why this error?

Attachments:
Last edit: 10 years 10 months ago by andersondionizio.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #139126

A 500 error doesn't say anything about the problem. It could be anything.
Look in your server's PHP error log for the Fatal error behind that 500 error and you will know where it's coming from and why.

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

  • Posts: 25
  • Thank you received: 1
10 years 10 months ago #139260

The log is empty, no error:

"POST /fechar-pedido/finalizacao/step-1/task-step HTTP/1.1" 500 1434

Only it.

The error show when i set a variable inside setSender:

        $nome = $order->customer->name;
   	$email = $order->customer->email;
		
        $paymentRequest->setSender(
            $nome,
            $email
        );
       // error

if i set hardcode on the setSender, no problem is showed:

        $paymentRequest->setSender(
            "Nome Maldito",
            "plugin@maldito.com"
        );
       // no error

Why ? I do not understand why, do you have any ideia ?

update: I discovery the error: the payment library has some kind of parse about customer name... i just check if the name is right before send across method...

update 2: i made the plugin, all is working without problem.

Last edit: 10 years 10 months ago by andersondionizio.
The following user(s) said Thank You: Jerome

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

Time to create page: 0.075 seconds
Powered by Kunena Forum