I'm pleasure to announce that an i-MSCP client (Server Manager) for BoxBilling will coming soon. For now, I 'm developing a Rest server, and also a BoxBilling plugin that will act as a Web service controller (i-MSCP side). To resume this plugin will allow to use the free billing software with i-MSCP, a very good alternative to the WHMCS billing system that is unfortunately no free of use.
To resume with few skeletons:
[code=php]
// i-MSCP side
/**
* i-MSCP Rest server
*/
class iMSCP_Server_Rest
{
}
/**
* Plugin that act as Web service controller for the BoxBilling client (Server Manager)
*/
iMSCP_Plugins_BoxBilling extends iMSCP_Plugin_Action implements iMSCP_Events_Listeners_Interface
{
/**
* @var iMSCP_Server_Rest
*/
protected $_server;
/**
* @var string Listened event
*/
protected $_listenedEvents = 'onRestRequest';
/**
* Register a callback for the given event(s).
*
* @param iMSCP_Events_Manager_Interface $controller
*/
public function register(iMSCP_Events_Manager_Interface $controller)
{
$controller->registerListener($this->getListenedEvents(), $this);
$this->_controller = $controller;
}
/**
* Implements the onRestRequest rest listener method.
*
* @param iMSCP_Events_Event $event
*/
public function onRestRequest($events)
{
try {
$this->_server = new iMSCP_Server_Rest($event->getParam('request', $_REQUEST));
$this->_server->setServiceClass(__CLASS__)->handle();
} catch(Exception $e) {
// do something
}
}
/**
* Implement the iMSCP_Events_Listener interface
*
* @return string
*/
public function getListenedEvents()
{
return $this->_listenedEvents;
}
// Method (needed by the BoxBilling server manager)
public function getLoginUrl()
{
}
public function getResellerLoginUrl()
{
}
public function testConnection()
{
}
public function createAccount()
{
}
public function synchronizeAccount()
{
}
public function suspendAccount() {
}
public function unsuspendAccount()
{
}
public function cancelAccount())
{
}
public function changeAccountPassword()
{
}
public function changeAccountUsername(Server_Account $a, $new_username)
{
}
public function changeAccountDomain()
{
}
public function changeAccountIp(Server_Account $a, $new_ip)
{
}
public function changeAccountPackage(Server_Account $a, Server_Package $p)
{
}
}
// BoxBilling side (server manager)
class Server_Manager_Imscp extends Server_Manager
{
public static function getForm()
{
return array(
'label' => 'i-MSCP Server Manager',
);
}
public function getLoginUrl()
{
}
public function getResellerLoginUrl()
{
}
public function testConnection()
{
}
public function synchronizeAccount(Server_Account $a)
{
}
public function createAccount(Server_Account $a)
{
}
public function suspendAccount(Server_Account $a)
{
}
public function unsuspendAccount(Server_Account $a)
{
}
public function cancelAccount(Server_Account $a)
{
}
public function changeAccountPackage(Server_Account $a, Server_Package $p)
{
}
public function changeAccountUsername(Server_Account $a, $new)
{
}
public function changeAccountDomain(Server_Account $a, $new)
{
}
public function changeAccountPassword(Server_Account $a, $new)
{
}
public function changeAccountIp(Server_Account $a, $new)
{
}
}
[/php]