Twitter
Tue
29
Apr
'08
PDF
Print
Send
 
Hits (2662) | Comments (6) | Favorited (0) | Votes (0)

Mighty Bill is a component that allows receive payment through many payment gateways. But it would be only half useful if it only do that. It is very often when some actions should be done if payment was successful. For example if payment successfull move user to another group. Or make user listing featured. And this is very possible without hacking Bill through plugin. This plugin should be installed into joomsuite_bill group. For that you need to set this group name in installation XML file. Joomla will create plugins/joomsuite_bill folder automatically if it is not exist.

First 2 lines of XML installation file example

<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="joomsuite_bill">

All other fields and params are the same as for any other plugin. But do not forget set plugin name which is important.

<files>
    <filename plugin="act_user">activate_user.php</filename>
</files>

act_user now is the name of plugin. And it will be used for creating method name.

Plugin can be triggered one 2 events. onBeforeStore and onAfterStore. See an example:

  1. <?php
  2. defined( '_JEXEC' ) or die( 'Restricted access' );
  3.  
  4. jimport( 'joomla.plugin.plugin' );
  5.  
  6. class plgJoomsuite_billAct_user extends JPlugin
  7. {
  8. function plgJoomsuite_billAct_user( &amp;$subject, $params )
  9. {
  10. parent::__construct( $subject, $params );
  11. }
  12. function onBeforeStore ( &amp;$result, &amp;$user)
  13. {
  14. global $mainframe;
  15. }
  16. function onAfterStore ( &amp;$result, &amp;$user, $model )
  17. {
  18. global $mainframe;
  19. }
  20. }

Let me explain. line 6 and 8 with class and function name plgJoomsuite_billAct_user which is constructed like:

  • plg - prefix
  • Joomsuite_bill - group name
  • Act_user - plugin name set in installation XML

line 12 trigger event onBeforeStore and takes 2 parameters. First is $result. This is array returned by payment plugin. Though payment plugin may process through different payment system like PayPal, 2CO, moneybookers bot it return always the same array. Here is the array example:

  1. $result['sid'] = 12;
  2. $result['gateway'] = 'paypaypal';
  3. $result['gateway_id'] = '6ND10117JG0564249';
  4. $result['user_id'] = 62;
  5. $result['price'] = 134.23;
  6. $result['pay'] = 'success';
  • 1. sid - is bill ID
  • 2. gateway - name of payment plugin
  • 3. gateway_id - transaction ID stored on payment system DB
  • 4. user_id - user ID
  • 5. price - the ammount taken by payment gateway
  • 6. pay - success or fail depends on transaction result. But in case of Bill it is always 'success'

Next parameter, $user contain $user object constructed by JFactory::getUser();

line 16 trigger event onAfterStore and takes 3 parameters. First two $result and $user are the same. And third is $model. $model is and object with two properties.

$model->transaction_id
$model->published

Where transaction_id is an ID of bill invoice just saved in jos_jcs_bill_invoice table in DB.

I think that every creative mind now have many toughts of what can be done with Bill component. You can easily integrate any your component with it without mantaining own billing system.


Comments
jwc07usAvatar
Quote
- -
Written by jwc07us VIP on 13 October 2008

If anyone is looking for some more information on how to make a plugin.  I found this article at Joomla:

http://docs.joomla.org/Tutorial:Creating_an_Authentication_Plugin_for_Joomla_1.5

It goes through how to create a plugin.  This is for an authentication plugin obviously but it will give you the basic idea of how things come together.

-
jennixAvatar
Quote
- -
Written by jennix VIP on 26 November 2008

Sergey, can you be anymore specific about these instructions? I'm pretty bright but i'm having to learn this as i go. From the above it seems i need to :

  1. create a plugin.php file and a plugin.xml file
  2. put them into plugins/joomsuite_bill
  3. magic happens, and my user's accounts are changed when they successfully pay a bill.

Please, a little more step-by-step? I realize it's hard to provide everyone examples, but perhaps one complete example? I simply need to load a specific page on billing success and another on billing fail, and i can't even figure out how to do that!

I have the payment plugins installed. I can create bills, and launch the process. Successes and failures both seem to do the same thing.

Any direction at all will be greatly appreciated.

-
SerhioAvatar
Quote
- -
Written by Serhio STAFF on 27 November 2008

Yes you should create those files but not simply put chem to forlder but install as plugin through Jomla installation. Because if Jomla does not save plugin infor in DB it does not trigger it.

So you install it and then use events i described.

onBeforeStore  can be used to process fail transactions and onAfterStore success. To get to know if transaction is success or fail use $result array and $model->published.

 

-
Tamss13Avatar
Quote
- -
Written by Tamss13 VIP on 11 May 2009

Could someone send me this plugin.  I have tried to make it and can not. Any help would do. 

-
perieteanuAvatar
Quote
- -
Written by perieteanu VIP on 26 May 2009

hi..

i am in the following situation.

AFTER the payment request from us the payer has to send an SMS to some payment provider.

THE PAYMENT PROVIDER send to us an http post request with some paramteres.

THEN the JS BILL2.0 coponent has to validate the payment and allow user to acces the subscription.

 what i need it is an model for the http request. something like:

http://www.jobsinro.ro/index.php?var=xxx&var2=xxx&var3=xxx  etc.

Could you provide me such a information please..?

 

-
almascoAvatar
Quote
- -
Written by almasco VIP on 08 July 2009

Why have you guys not created this plugin for your paying customers? I feel that if I spend 29 pounds to buy a component, I should at least be given every resource that makes it work to its full potential. You are basically saying that we have to develop our own plugin in order to make the component you charged us for work as anyone would expect it to. I feel somewhat cheated. I am not a programmer and hence will not be able to create the plugin. The instructions you gave don't really make sense because they don't start from the beginning and are not step by step. So I guess my money was wasted at your site. I really loved the JoomSuite User component, but JoomSuite Bill has made me disappointed.

-
Add New Comment
Name:
Email:
Comment:
Attachment
Hide Comment
Security code:
Enter text as you see on image
 
 
What is best way for Download/Installation MightyExtensions?
 


Member Area



Member Activity

We have 2111 guests and 11 members online


MightyTemplate - Professional Joomla Templates