Trying to make a payment plugin

  • petiflas
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 1 month ago #89057 by petiflas
Trying to make a payment plugin was created by petiflas
Hi!

I am trying to develop my own payment plugin for eshop (Redys for spanish banks) but I see there is a lack of documentation and would like to know if there is someone who has managed to develop their own plugin and can help me.

I understand they have to separate the plugin in 3 different functions:

public function __construct($params)
Here we can read the parameters setted up on the backend using: $params->get('value')
and we have to set with $this->url ="http;/...." the posting url, I am not sure if it's mandatory if we need to set up other values other than this, any help/documentation?


public function processPayment($data)
Here we can read from the $data table information from the order, but I haven't found anywhere of the possible values that can be read from this table. Any ideas?
After this we should create the posting info with:
$this->setData('key', "value");
and finish $this->submitPost(); to post the data to the url specified on function __construct
I'm I right? or do I need something else?

public function processPayment($data)
This is the most confusing part of all for me, in this part we can GET the values from our POST (not sure how to do it) and depending of its response we should confirm the order and mark the order as OK with:

// Store the transaction
$row = JTable::getInstance('Eshop', 'Order');
$row->load($id);
$row->transaction_id = $transactionId ;
$row->order_status_id = EshopHelper::getConfigValue('complete_status_id');
$row->payment_date = date('Y-m-d H:i:s');
$row->published = true;
$row->$this->postData;
$row->store();


// Notifications and plugins
$config = EshopHelper::getConfigValue('order_alert_mail') ; //I don't know where is $config coming from
EshopHelper::sendEmails($row);

JPluginHelper::importPlugin( 'eshop' );
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger( 'onAfterCompleteOrder', array($row));


Thanks for everything, I will be glad if someone could help me out with these doubts, anyway I am also willing to pay some if him/her is interested in helping on the development of this plugin.

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

  • Giang Dinh Truong
  • Offline
  • Administrator
  • Administrator
More
8 years 1 month ago #89080 by Giang Dinh Truong
Replied by Giang Dinh Truong on topic Trying to make a payment plugin
Hello petiflas,

I think you did it properly. The plugin is not appeared on the front-end side because you didn't choose it as available payment plugins in the shipping plugins. I answered you with same content in the ticket system.

Please following up to get the solution.
Sincerely, Giang

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

Moderators: Giang Dinh Truong