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:
<?php jimport( 'joomla.plugin.plugin' ); class plgJoomsuite_billAct_user extends JPlugin { function plgJoomsuite_billAct_user( &$subject, $params ) { parent::__construct( $subject, $params ); } function onBeforeStore ( &$result, &$user) { global $mainframe; } function onAfterStore ( &$result, &$user, $model ) { global $mainframe; } }
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:
$result['sid'] = 12; $result['gateway'] = 'paypaypal'; $result['gateway_id'] = '6ND10117JG0564249'; $result['user_id'] = 62; $result['price'] = 134.23; $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.
on
on 
+1 (209) 800 1209