eWay Recurring Payment Plugin

  • Posts: 62
  • Thank you received: 0
13 years 1 month ago #31384

Does HikaShop support eWay Recurring Payments. If not, can you point me in the right direction for creating a custom payment plugin.

eWay have sample code for integrating with their API at this address:
www.eway.com.au/Developer/eway-api/recurring-payments.aspx

If I need to create a custom payment method what would be the best approach?

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

  • Posts: 83103
  • Thank you received: 13414
  • MODERATOR
13 years 1 month ago #31410

Hi,

There is no recurring payments integration with eWay.
You can find the documentation for the development of payment method plugins here:
www.hikashop.com/en/support/documentatio...r-documentation.html

The best approach I think would be to take the files of the current eway plugin and modify them to handle recurring payments. They are in the folder plugins/hikashoppayment

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

  • Posts: 62
  • Thank you received: 0
13 years 1 month ago #31754

I have never developed a Joommla plugin before however I am going to give it a go. I thought a good place to start would be to understand the Joomla plugin installer. I have copied the existing eway.php, eway_configuration.php and the eway.xml from the plugins\hikashoppayment folder and renamed them to eway_test.

In the xml file I have changed the following tags as shown:
<name>eWay Rebill Payment Plugin</name>
<filename plugin="rebill">eway_test.php</filename>
<filename>eway_test_configuration.php</filename>

Although this does install OK there are some issues which I can't seem to figure out. There are no params registered and the plugin must not install correctly as I cannot uninstall. The following error occurs when I try to uninstall. "Plugin Uninstall: Manifest File invalid or not found"

Also in the Extension Manager there is no version, date or author details despite these tags being unchanged in the xml file.

Thank you to anyone who can assist.

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

  • Posts: 83103
  • Thank you received: 13414
  • MODERATOR
13 years 1 month ago #31785

In the plugin attribute of the filename tag, you should put the name of the php file: eway_test
And not rebill. Otherwise, Joomla won't be able to use the plugin properly. It might be the reason that you have these problems.

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

  • Posts: 62
  • Thank you received: 0
13 years 1 month ago #31859

Can you please explain how the back end configuration page is created for hikashoppayment plugins.

The test plugin has now installed OK however the Hikashop plugin options page only displays the eWay specific parameters and without any of the standard Joomla administrator template or standard hikashoppayment plugin parameters. I can see there is an eWay_configuration.php that has the custom parameters but where does the rest come from?

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

  • Posts: 83103
  • Thank you received: 13414
  • MODERATOR
13 years 1 month ago #31881

The configuration file is used when you edit the payment method via the menu System->Payment methods in HikaShop.
It is displayed by the files administrator/components/com_hikashop/views/plugins/view.html.php and administrator/components/com_hikashop/views/plugins/tmpl/form.php

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

  • Posts: 62
  • Thank you received: 0
13 years 1 month ago #31966

I am fairly confident with editing the eWay.php file to work with the eWay reBill API however I am still not understanding the plugin installation process and how this is registering the parameters.

For example my simple test is as follows:
1. rename eway.php = eway_test.php
2. rename eway_configuration.php = eway_configuration_test.php
3. rename eway.xml = eway_test.xml
4. edit eway_test.xml <files> tags as follows:
<files>
<filename plugin="eway_test">eway_test.php</filename>
<filename>eway_configuration_test.php</filename>
</files>
5. uninstall the current eway plugin
6. install the eway_test plugin
7. go to System->Payment methods in HikaShop and select HikaShop eWAY payment plugin
The 'eWay customer id', 'Debug' and 'Versified status' are not present for configuration. Why are they not available?
8. install the original eway plugin
This one configures fine although if your have both payment methods active the checkout crashes

Can you please help with the installation process? I just don't understand where the params are being registered. Also eventually I will need both the eWay plugin and an eWay reBill plugin active and configurable. Will this be an issue if they use the same params?

I just had a thought. The basic idea behind this will be that only one product uses the reBill option (I understand I need to do this with shipping methods). Would it be easier to just edit the eWay plugin to choose a payment method at run time rather than have two separate payment method plugins? For this to work is it possible to limit the types of products in the cart so that they can not be combined with others?

Sorry about the long post. Thank you for all your help!!!

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

  • Posts: 62
  • Thank you received: 0
13 years 1 month ago #31967

Sorry just another question. Where is the logic that validates the forms in the checkout?

The reason I ask is that to use the debug option on the eWay plugin you need to use the card number "4444333322221111" which is not a valid card number if you try to use it. Effectively rendering the debug option useless.

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

  • Posts: 83103
  • Thank you received: 13414
  • MODERATOR
13 years 1 month ago #31989

2. It should be eway_test_configuration.php

4. same in the xml

Otherwise, the configuration file won't be loaded by the system. That's why you don't see your options in point 7.

You can have both plugins at the same time, no problem on that.
Indeed, it seems better to have only one payment method with an option to activate/deactivate rebill or normal billing.
That way, you could display one or another (you don't want both at the same time anyway) or none (if you have products from both "types" which in that case would display an error message and forbid the user to finish his order) with a check of the products in the cart in the onPaymentDisplay function.

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

  • Posts: 62
  • Thank you received: 0
13 years 1 month ago #32031

Thanks Nicolas, you have been a great help.

You didn't answer my question about debug though. I cannot use the test card number because of validation code on the credit card form. Where is this logic so I may temporarily turn it off?

Lastly what would be the best way to conditionally display terms. For this recurring payment product I would like users to accept terms but I do not want these terms for all other products.

Last edit: 13 years 1 month ago by Devine.

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

  • Posts: 83103
  • Thank you received: 13414
  • MODERATOR
13 years 1 month ago #32053

I didn't saw your other message actually.
You can just rename the media/com_hikashop/js/creditcard.js file to something else so that it won't find the card number checking function.

For the terms, you will have to edit the file components/com_hikashop/controllers/checkout.php (for the logic when the terms step is done) and the file components/com_hikashop/views/checkout/tmpl/terms.php (for the display)

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

  • Posts: 62
  • Thank you received: 0
13 years 1 month ago #32423

Since we are using the shipping method to determine the payment method it makes sense to me to use the same condition for displaying the terms. Therefore in both the terms.php and the checkout.php I will need to know what shipping method has been selected. Can you please advise how to recall this from the cart in these files.

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

  • Posts: 83103
  • Thank you received: 13414
  • MODERATOR
13 years 1 month ago #32444

You can do like that to get the id of the shipping method selected:
$app =& JFactory::getApplication();
$shipping_id=$app->getUserState( HIKASHOP_COMPONENT.'.shipping_id' );

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

  • Posts: 62
  • Thank you received: 0
13 years 2 weeks ago #34374

I have now customised the eWay Payment plugin to support recurring payments and this is working well. There is just one thing that I would like to tidy up for both the normal payment and recurring how easy it will be.

In the standard eWay plugin there is an xml property <ewayCustomerInvoiceRef> which is set to uniqid( "order_" ). Similarly the eWay reBill xml has a property <RebillInvRef>. How hard will it be to set these to the actual Hikashop order number? I understand that the order is not yet created so this may be difficult. Any ideas?

My order number format is J{id size="6"}.

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

  • Posts: 83103
  • Thank you received: 13414
  • MODERATOR
13 years 2 weeks ago #34403

Indeed, the order is not yet created when the payment request is sent to eway which is why the order number is set like that and not with the real order number.

You could have a SQL query in the plugin to get the max order_id from the hikashop_order table and use the max id + 1 to get your future order id.
It's highly unlikely that another order would be created just between that MySQL request and the creation of the order, but still it's possible and that's why we didn't do it.

I you don't mind sharing you plugin, I'm sure other users could benefit from using it.

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

  • Posts: 62
  • Thank you received: 0
13 years 2 weeks ago #34479

Yes I am happy to share. The only issue here is that it is mostly hard coded rather than with any configuration options. Also I have just customised your existing eWay plugin and added some logic to determine which gateway and xml to use based on the shipping method. As you can see this works in my scenario but is not that flexible.

In any case, I'm sure the source would be very useful for somebody to perhaps reuse some code and possibly improve to include configuration options. I have attached my edited eWay.php payment plugin for those who would like to see.

The hard coded parts are:
1. The condition for determining the gateway is based on shipping_id
2. RebillInitialDate
3. RebillStartDate
4. RebillEndDate
5. RebillInterval
6. RebillIntervalType

Last edit: 13 years 2 weeks ago by Devine.

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

  • Posts: 62
  • Thank you received: 0
13 years 2 weeks ago #34480

OK php files cannot be attached. Try as a text file.

File Attachment:

File Name: eway.txt
File Size:32 KB

Attachments:
Last edit: 13 years 2 weeks ago by Devine.

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

  • Posts: 83103
  • Thank you received: 13414
  • MODERATOR
13 years 2 weeks ago #34500

Thank you for sharing your modifications.

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

Time to create page: 0.086 seconds
Powered by Kunena Forum