Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating a billing system
#1
I am a decent programmer i am not great, but i can only get better. i am in development of a billing system for my hosting site. would like to find out what your ideas are for setting this up. I was thinking a system similar to cpanels secret code that would only allow this software to communicate with this software as the identifier to allow it to create the new account once payment is recieved also allowing it to create the plans in the billing system and it will automatically be set in ehcp.

Restored from old drupal forum, for user uid:2701 username:headstew
You may reset your password to access your new account here.
Reply
#2
Hi,
this would be a good thing.
if you can build/program a billing system, we can together make it work with ehcp.

The billing system (shortly BS) should communicate with ehcp like this:
* ehcp should have hosting plans, or something like that. those plan codes should be known to BS,
* the key/joint point of ehcp - BS should be something common to both, such as panelusername and hostingplan
* ehcp should be able to : check if a panelusername available, setup hosting by a call from BS, terminate the hosting upon request, or terminate hosting when expired,

Here is a scenario between BS and ehcp:
* BS accepts payment, has hosting plan known,
* BS asks ehcp for an available panelusername, some panelusername is agreed,
* BS asks ehcp to setup the hosting using some parameters (such as, expiredate, noexpire, deleteafterexpire etc..)
* ehcp setups the hosting and informs BS of successfull setup,
* BS completes order/setup.

We can work on this more..
I think I can adapt ehcp to this in reasonable time.
most functions in ehcp are ready for this.

Note that, I do coding in php, so you should do similar,

Wait for your comments...


Restored from old drupal forum, for user uid:2701 username:headstew
You may reset your password to access your new account here.
Reply
#3
it is written in php, i have already started it and it will allow people to setup there whole site how they want it to look so that it is not only just a billing section but a whole front end website with the ability to control all there info from the back side. i was looking at the bs being able to tell ehcp what the hosting requirements should be like if i want to set plan 1 to 20 gigs of bandwidth and 20 gigs hard drive it does it itself


Restored from old drupal forum, for user uid:1 username:ehcpdeveloper
You may reset your password to access your new account here.
Reply
#4
This is possible in ehcp, using something like this:

in your php file do these:

<code>
include_once("ehcp/classapp.php");
$app = new Application();
$app->connectTodb(); # fill config.php with db user/pass for things to work..
$app->addDomainDirect( $domainname,$panelusername,$paneluserpass,$ftpusername,$ftppassword,'active',$email,$quota); # to add passive, just use 'passive' instead of 'active'

</code>
Here, you call ehcp internal function from within your application.
Hosting plans not yet implemented in ehcp, you should tace care of plans on your side.
hope this helps.

This function also checks if those usernames are available.
you may check ehcp source, classapp.php file, that function.

Restored from old drupal forum, for user uid:2701 username:headstew
You may reset your password to access your new account here.
Reply
#5
so at this time there is no way to provision the system it is all based on some set of presets somewhere?
also is there a way we can add a function that would require some kind of secret code so that only a software with that information could control it, also this would work nice for managing remote servers at other facilities with ehcp installed on them.

Restored from old drupal forum, for user uid:1 username:ehcpdeveloper
You may reset your password to access your new account here.
Reply
#6
I love the idea of a billing system for Ehcp. That would be amazing

Restored from old drupal forum, for user uid:2701 username:headstew
You may reset your password to access your new account here.
Reply
#7
well what i want to do is set the quota first of all. how much space how many domain names how many email all from what i have loaded in my script by using a command like that also i need ehcp to make sure that only and ehcp that should have access to this server is able to create it.

Restored from old drupal forum, for user uid:2687 username:ehcpuser
You may reset your password to access your new account here.
Reply
#8
function addNewCustomer($domainname,$panelusername,$paneluserpass,$ftpusername,$ftppassword,$status,$maxdomains,$maxemails,$maxpanelusers,$maxftpusers,$maxdbs,$email='',$quota=0){

$domainname=$this->adjustDomainname($domainname);
$panelusername=trim($panelusername);
$ftpusername=trim($ftpusername);


if(!$this->afterInputControls("adddomain",
array(
"domainname"=>$domainname,
"ftpusername"=>$ftpusername,
"panelusername"=>$panelusername
)
)
) return false;


/*
domain path will be like: /var/www/vhosts/ftpusername/domain.com
/var/www/vhosts/ftpusername/domain.com will be stored as homedir in domains table,
one user will may have multiple domains with single ftp acount.
to achive this, i must implement domain add to an existing ftp acount.
*/
$this->output.="Adding domain: $domainname";
$homedir=$this->conf['vhosts']."$ftpusername/$domainname";
$success=true;
$s=$this->executeQuery("insert into ".$this->conf['domainstable']['tablename']." (reseller,panelusername,domainname,homedir,status,diskquota) values ('".$this->activeuser."','$panelusername','$domainname','$homedir','$status',$quota)",'domain add to ehcp db');
$success=$success && ($s=$this->addDaemonOp("daemondomain","add",$domainname,$homedir,'domain info&ftp'));// since, adddaemonop only returns true or false, this construct is true, but above, execute may return other thing...
$success=$success && ($s=$this->addDaemonOp("syncdomains",'','','','sync apache '));
$success=$success && ($s=$this->addDaemonOp("syncdns",'','','','sync dns'));
$success=$success && ($s=$this->addFtpUserDirect($panelusername,$ftpusername,$ftppassword,$this->conf['vhosts']."$ftpusername",$upload,$download,$quota,$domainname,'default'));
$success=$success && ($s=$this->addPanelUserDirect($panelusername,$paneluserpass,$maxdomains,$maxemails,$maxpanelusers,$maxftpusers,$maxdbs,$quota,'',$email));

$msg="ehcp: $domainname domain created in your ehcp panel at ".$this->conf['dnsip']." ";
$msg.=$this->url;

$msguser="ehcp: $domainname domain created in ehcp panel at http://".$this->conf['dnsip']." Your panelusername: $panelusername, Password: $paneluserpass, ftpusername: $ftpusername, ftp pass: $ftppassword ";
$subj=$msg;
$this->infotoadminemail($msg,$subj);
if($email<>'') mail($email,"Your domain $domainname created in ehcp panel", $msguser,"From: ".$this->conf['adminemail']);

return $this->ok_err_text($success,"All ops successfull. Adding domain complete..: $domainname",
"Some domain operations are not successfull. Retry again, after deleting old data.");
// rollback of operations when not succeeded, is not implemented. it just displays an error message... to be fixed later..

}


include_once("ehcp/classapp.php");
$app = new Application();
$app->addNewCustomer( $domainname,$panelusername,$paneluserpass,$ftpusername,$ftppassword,'active',$maxdomains,$maxemails,$maxpanelusers,$maxftpusers,$maxdbs,$email,$quota);

so far i have just hacked a little of your script together still working on adding some stuff to do it, basically it is a ready made function but i need to remove parts that will now be handled in the billing software.

Restored from old drupal forum, for user uid:2701 username:headstew
You may reset your password to access your new account here.
Reply
#9
Hi,

The api doesn't seem to be working. Sad
I don't get any error, but it just doesn't add the account.
<?php
include_once("ehcp/classapp.php");
$app = new Application();
$app->connectTodb();
$domainname = "nodomain.com";
$panelusername = "test123";
$paneluserpass = "pass123";
$ftpusername = "123ftp";
$ftppassword = "ftppass";
$email = "2";
$quota = "1000";
$app->addDomainDirect( $domainname,$panelusername,$paneluserpass,$ftpusername,$ftppassword,'active',$email,$quota); # to add passive, just use 'passive' instead of 'active'
?>
This is in vhosts/

Restored from old drupal forum, for user uid:2701 username:headstew
You may reset your password to access your new account here.
Reply
#10
<li>I assume, you want to run that api in server B, while ehcp is actually in server A (B->A)
<li> classapp loads config.php in same dir, and reads mysql user pass and so on, so, your script should be able to connect to mysql of original ehcp server (A)
<li> in original ehcp server, make sure you enabled mysql connection from your other server. to do that, in phpmyadmin, add a new user of ehcp, with same pass, where hostname is "not" localhost, but ip of B
<li> you may check return value of $app->addDomainDirect, as it returns True, if successful, False, if not. examine that, or print that on screen..

(note: related post: http://www.ehcp.net/?q=node/842)


Restored from old drupal forum, for user uid:2766 usernameConfusedmooch1502
You may reset your password to access your new account here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)

Online Shopping App
Online Shopping - E-Commerce Platform
Online Shopping - E-Commerce Platform
Feinunze Schmuck Jewelery Online Shopping