Control Web Panel

Developers => New Modules => Topic started by: darkness on June 29, 2017, 08:03:02 PM

Title: WHMCS integration with CWP
Post by: darkness on June 29, 2017, 08:03:02 PM
Hello guys,
After having so much problems with integration of WHMCS and CWP I rewrote the WHMCS module almost from zero. Ok, mine also has errors which I will fix and then I will provide it encoded free of charge with all the improvements. For the moment I will provide you a fixed copy from http://wiki.centos-webpanel.com/cwp-account-api (http://wiki.centos-webpanel.com/cwp-account-api) which was the original. In the original one it`s supposed that you have option in WHMCS to register/transfer domain. In the fixed version you don`t need it. If you don`t have option for register/transfer domain then the user domain will become automatic user.your-server-domain-name.tld(ex. johndoe.server.com). If you have the option for registering/transfering domains then the domain will be what the user register/transfer (ex. my-domain-with-you.com).
How to install the script:
1. Download -> here <-  (http://www.born2host.com/centoswebpanel.zip) the script in your /path/to/whmcs/modules/servers/ (ex. /home/hosting/public_html/modules/servers/)
2. Unzip it (unzip centoswebpanel.zip)
3. Login to your WHMCS Admin panel
4. Go to Setup -> Product/Services -> Servers
5. Press 'Create New Group' and name it how you want
6. Press 'Add New Server'
7. Scroll down to 'Server Details'
8. On 'Type' choose 'Centoswebpanel'
9. Open in your browser  -> Random.org <- (https://www.random.org/passwords/?num=5&len=20&format=html&rnd=new) and choose a random generated password
10. Paste this password in the 'Access Hash' field and press 'Save Changes'
11. Paste this password in /usr/local/cwp/.conf/api_key.conf
12. Open /usr/local/cwp/.conf/api_allowed.conf with your favourite editor and enter inside the IP address of the WHMCS (if the WHMCS and CWP are on the same server than enter 127.0.0.1)
13. Go to Setup -> Product/Services -> Product/Services
14. Press 'Create a New Product'
15. Choose and write name of your product
16. Go to 'Module Settings' tab and choose 'Module Name: Centoswebpanel
17. In the settings shown below edit only Package Number (Package Number 1 is package with name 'default' in CWP, if you add new package it will be Package Number 2)
18. Choose 'Do not automatically setup this product' and press 'Save Changes'
Hooray! You are ready!!!
Don`t forget to fix the Pricing of the Product/Service that you offer :)
If you have any questions or problems please PM me or ask on root@born2host.com
The script is opensource. Tested on WHMCS 6.3.1 and 7.1.2. Have fun!
Please, if you download and use the script, leave a comment how is it working and on what version of WHMCS you tested it. It will be useful for me to fix errors and for other users to know on which versions of WHMCS is tested and working. Thank you.
Title: Re: WHMCS integration with CWP
Post by: Joe on July 01, 2017, 04:22:38 PM
I'd like to download and use the script but there are no files in your download "centoswebpanel.zip"
Title: Re: WHMCS integration with CWP
Post by: darkness on July 02, 2017, 07:44:45 PM
Sorry, my bad.
Download this tar archive: CentOSWebPanel (http://www.born2host.com/centoswebpanel.tar.gz)
If again is not working let me know. But I extracted it and the file is inside.
Title: Re: WHMCS integration with CWP
Post by: rad on July 06, 2017, 06:52:25 PM
I am having issues reaching your files and website. You should check your DNS.
Title: Re: WHMCS integration with CWP
Post by: darkness on July 06, 2017, 09:52:14 PM
I`m sorry. It was my bad. During the tests of the OpenVZ web panel I did some changes to my named.conf and I forgot to reverse them. Now it`s working. At least google says so:
Code: [Select]
[root@born2host named]# nslookup born2host.com
Server:         8.8.8.8
Address:        8.8.8.8#53
Non-authoritative answer:
Name:   born2host.com
Address: 77.236.172.141
[root@born2host named]#
Title: Re: WHMCS integration with CWP
Post by: darkness on July 08, 2017, 04:49:33 PM
During to a planned maintanence Born 2 Host will be down since 09/07/2017 00:30 until 09/07/2017 14:30 (+/- 2h). Any downloads will be unavailable until that time. Sorry for any problems that this may cause.
Title: Re: WHMCS integration with CWP
Post by: vxdas on July 17, 2017, 08:32:41 AM
I think I have set up both editable files for the lines and password, in ip I added 127.0.0.1 I have the same control panel and whmcs installations on the same server. I keep having problems,
Order Accept Encountered Problems
Allowed IP's not set or you do not have access from IP
Title: Re: WHMCS integration with CWP
Post by: darkness on July 21, 2017, 08:26:04 AM
Do you have NAT enabled? Did you checked all the permissions of the files?
Title: Re: WHMCS integration with CWP
Post by: vxdas on July 21, 2017, 05:27:00 PM
Sorry for the delay in responding. Where do I disable NAT? What permissions do you need?
Title: Re: WHMCS integration with CWP
Post by: darkness on July 22, 2017, 02:29:22 PM
Do not disable NAT, just add the internal IP of the server (ex. 192.168.1.2) as allowed in api_allowed.conf.
For me the permissions are those:
Code: [Select]
-rw-r--r-- 1 hosting hosting 6107 Jun 29 22:58 centoswebpanel.php-rw-r--r-- is:
Code: [Select]
chmod 644 fileDon`t forget to change the owner of the file not to be root:
Code: [Select]
chown -R username.usernameYou can check it by:
Code: [Select]
(small letters): LL /home/user_where_is_your_whmcs/public_html/modules/servers/centoswebpanel/
Title: Re: WHMCS integration with CWP
Post by: WHVglenn on October 09, 2017, 06:04:54 PM
The download links do not seem to be available any longer (from the original posting).  Are they still available.  I am looking to add in our CWP server to our WHMCS system and this looks to be the solution. Thanks
Title: Re: WHMCS integration with CWP
Post by: darkness on October 09, 2017, 10:29:31 PM
Sorry for the missing files. I was working on them and forgot to re-upload them. I was looking for a way to fix the error when the domain is not resolved to an IP but still no success. I will re-upload the files in few minutes. You can download it now at CentOS Web Panel (http://www.born2host.com/centoswebpanel.tar.gz) link.
Title: Re: WHMCS integration with CWP
Post by: WHVglenn on October 10, 2017, 08:01:46 PM
Sorry for the missing files. I was working on them and forgot to re-upload them. I was looking for a way to fix the error when the domain is not resolved to an IP but still no success. I will re-upload the files in few minutes. You can download it now at CentOS Web Panel (http://www.born2host.com/centoswebpanel.tar.gz) link.

Thank you !  Just a FYI
Your website / server seems to be unavailable, I will try again later.  Thanks!
Title: Re: WHMCS integration with CWP
Post by: nicklg on November 04, 2017, 01:11:40 PM
I've installed this on my WHMCS client and I cannot get it to work. Nothing shows in the error log and the string created is correct (looking at the module log and testing it directly). I am running V7.3.0.
Title: Re: WHMCS integration with CWP
Post by: darkness on November 04, 2017, 06:17:15 PM
I didn`t tested it on WHMCS 7.3.0 yet. Can you login to your WHMCS, go to Utilities -> Logs -> Module Log. From there Enable Debug Logging. Then try to add user through WHMCS and check the log on the same place. Let me know what`s the error. Waiting for your reply.
Title: Re: WHMCS integration with CWP
Post by: nicklg on November 04, 2017, 09:27:50 PM
I had the module debuggin on.. the request looks correct (sanitised the details):

https://vps2.xxxxxxx.xx:2031/api/?key=cT79nMhEyafZFx93MpXfF&api=account_new&domain=xxxxx.net.xx&username=image&password=xxxxxxx&package=1&email=xxx%40xxxxx.com.au&inode=0&nofile=100000&nproc=40

The response is blank though..in the admin log there is nothing next to the error
Title: Re: WHMCS integration with CWP
Post by: darkness on November 05, 2017, 05:28:34 AM
Do you have 127.0.0.1 in /usr/local/cwp/.conf/api_allowed.conf ? Are you behind NAT? If yes put also the NAT IP and your PUBLIC IP in that conf file and try again. Also check if the hash key in /usr/local/cwp/.conf/api_key.conf is the same as the hash key in the server config in your WHMCS.
Title: Re: WHMCS integration with CWP
Post by: nicklg on November 05, 2017, 12:46:42 PM
I've added it in, but the CWP server and WHMCS are separate boxes. I've added in all the IP's but it isn't behind a NAT. Hash key is the same as I copied the string above from the module log and pasted it into the my browser and it worked aok. Problem is I can't see where it is failing and why. every log is blank.

I am assuming I don't need to enter the CWP username/password, I only need the API Hash key? I've also tried both secure ticked and unticked.

I can't even see on CWP if the attempt to hit the server is even happening.
Title: Re: WHMCS integration with CWP
Post by: darkness on November 06, 2017, 02:12:58 PM
Yes, you don`t need username and password. Just the hash. Add the IP of WHMCS and the IP of CWP in the config also. Does your CWP have a domain or it`s by IP ? If it`s by IP it will not work and will not give error. You need hostname/domain for CWP.
Title: Re: WHMCS integration with CWP
Post by: nicklg on November 07, 2017, 06:28:51 AM
ok I added the CWP IP into the APi config as well but still no joy. My CWP install has it's own domain name which is working.
Title: Re: WHMCS integration with CWP
Post by: darkness on November 07, 2017, 02:26:58 PM
Ok, I found WHMCS 7.3.0 nulled and I will test it now to see if it`s working. I also put CentOS 7 with CWP on a KVM. Give me some time for the test.
Title: Re: WHMCS integration with CWP
Post by: nicklg on November 08, 2017, 12:32:10 AM
no problems.. happy to help test if you need a hand as it isn't a production server at the moment.
Title: Re: WHMCS integration with CWP
Post by: darkness on November 08, 2017, 03:31:57 PM
Nah. I have Proxmox server and I make it on LXC or KVM. The problem is that the nulled 7.3.0 is giveing an error on the install. I will try to fix it and to test the module.
Title: Re: WHMCS integration with CWP
Post by: jamshed_206 on November 19, 2017, 03:28:48 AM
Any news on this? Did you made it compatible with whmcs 7.4?
Title: Re: WHMCS integration with CWP
Post by: darkness on November 19, 2017, 07:32:48 AM
I just tested it on WHMCS 7.4.1 and it`s working without any problems. Be sure to enable Module Log from Utilities -> Logs -> Module Log and give me request and response info from there on PM if you have any problems.
Title: Re: WHMCS integration with CWP
Post by: nicklg on November 20, 2017, 11:56:40 AM
is there an updated module to install? I just tried on 7.4.1 and I had the same error
Title: Re: WHMCS integration with CWP
Post by: darkness on November 23, 2017, 06:27:54 AM
No. There`s no update for the module. I use the version for 6.3.1 and tested it on 7.4.1 without any changes. I`m 99.99% sure that there`s a problem which is not related to the module, but related to the configuration (IP address in /usr/local/cwp/.conf/api_allowed.conf)

Look at here:
(https://i.imgur.com/L2Vn73K.png)
(https://i.imgur.com/7DTJMPN.png)
(https://i.imgur.com/oDcancT.png)
(https://i.imgur.com/ExHNo1q.png)
(https://i.imgur.com/kEuHYW4.png)

Does your configuration in WHMCS looks like this? One more thing - are you using CWP6 or CWP7? Now I`m installing CentOS 7 to put CWP7 on it to test it also there. Currently I`m using CWP6 and all the tests are made there. Not 100% sure, but it`s possible to have a difference in the API of CWP6 and CWP7. Wait to finish the test.
Title: Re: WHMCS integration with CWP
Post by: darkness on November 23, 2017, 08:59:46 AM
Ok nicklg. I just created a new KVM on my Proxmox server, installed CentOS 7 Minimal, installed CWP 7, installed WHMCS 7.4.1 (nulled only for testing, never for production server). Working on local IP address without any domain. On public IP with domain will be the same.
Here are screenshots:
Getting the module for WHMCS ->
(https://i.imgur.com/V93gZTp.png)
Check WHMCS version (7.4.1) ->
(https://i.imgur.com/43lyfyd.png)
See pending order ->
(https://i.imgur.com/kL1hHjc.png)
Accept pending order (you can select also "Send Welcome Email") ->
(https://i.imgur.com/rea34k4.png)
Order accepted ->
(https://i.imgur.com/FICBsS8.png)
Check logs (Utilities -> Logs -> Modules Log) ->
(https://i.imgur.com/AVRfKlS.png)
Check in CWP7 if the user is created ->
(https://i.imgur.com/4lWQ5uk.png)
Log in to CWP7 with the new user we just created ->
(https://i.imgur.com/JxDnWpd.png)

As you said that the CWP and WHMCS are on different boxes, add in /usr/local/cwp/.conf/api_allowed.conf the IP addresses of CWP and WHMCS. Waiting for your reply. BTW I put it FREE the hosting not to pay to PayPal taxes to transfer $1 from one of my cards to another in a testing. Working with price is the same.
Title: Re: WHMCS integration with CWP
Post by: nicklg on November 25, 2017, 09:26:26 AM
thats pretty much how mine was set up. I added in the correct IP's but no joy. however I have another issue with CWP, now coming up with bad gateway on the admin ports. I am trying to fix that so i can see whats happened
Title: Re: WHMCS integration with CWP
Post by: wimmy on November 25, 2017, 01:09:42 PM
is your serve down i just want download the package

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@born2host.com to inform them of the time this error occurred, and the actions you performed just before this error.

Title: Re: WHMCS integration with CWP
Post by: darkness on November 27, 2017, 05:17:17 AM
Nope, the server is up already 46 days and the files are there for downloading. May be you tried old link. https://www.born2host.com/centoswebpanel.tar.gz is the correct and working one.