Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JuergenLeber committed May 27, 2022
1 parent f7ab3fc commit d0c6078
Show file tree
Hide file tree
Showing 10 changed files with 735 additions and 0 deletions.
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# 360 Monitoring Provisioning Module for WHMCS Version 1.4 #

## Installation ##

- Extract the contents of the release zip file recursively in your WHMCS root folder. The module will be extracted to /modules/servers/p360monitoring and other folders won't be touched
- The module is now installed and can be used to configure new products
- Don't forget to remove the zip file afterwards

## Example Configuration as Product ##

- Login to your WHMCS instance as an admin user
- Go to Configuration -> Sytem-Settings -> Products/Services
- Create a new product group e.g. "Monitoring" with a nice headline like "Everything you need to keep your servers and websites up and running!" and "Standard Cart" template
- Go back to Sytem-Settings -> Products/Services and create a new product called "360 Monitoring Pro" of type "Other" and select the just created product group there. Choose "360 Monitoring Provisioning Module" as the module for automation. Keep the "Create as Hidden" switch set to "On" and click "Continue"
- Switch to the tab "Module Settings" and fill the fields "Plesk KA Username" and "Plesk KA Password" with the credentials for the Plesk Partner API 3.0
- Leave the fields "Servers" and "Websites" empty (don't use "0") for a configurable product or fill both of them with fixed values. Either both or none have to be filled out
- Check "Automatically setup the product as soon as an order is placed" if you want a good user experience or any other option that matches your existing process
- Switch to the tab "Pricing" and select the payment type, e.g. "Recurring" and enable the "One Time/Monthly" option for selected currencies with the price you like to have as a "base fee". For a pay-as-you-grow product leave this at 0.00 and otherwise set this as the monthly fee
- Click on "Save Changes"
- Go to Configuration -> Sytem-Settings -> Configurable Options (only if you want to have a pay-as-you-grow product)
- Create a new group e.g. "Monitoring Options" and select the just created product in the "Assigned Products" list
- Click on "Save Changes"
- Add a new configurable option named "Servers". For that enter "Servers" to the field "Option Name" AND "Add Option" (both fields) choose option type "Quantity" and click on "Save Changes"
- After saving the options for "Minimum Quantity Required" and "Maximum Allowed" appear and can be set accordingly.
- Set the price that will be charged for every option value on top of the base price defined in the product.
- Don't forget to "Save Changes" and close the window
- Do the same for another configurable option named "Websites"
- IMPORTANT: There must only be two options, first "Servers" and second "Websites" in this order
- Click on "Save Changes"
- Go back to Configuration -> Sytem-Settings -> Products/Services
- Edit the newly created product by clicking on the edit icon on the right
- If you want a nice description with a product image for the product you can edit the "Product Description" and refer to the logo that has been delivered within the module's zip archive e.g.
`Keep track of the performance and availability with our professional`
`server and website monitoring service <br/>`
`<img height="50" src="./modules/servers/p360monitoring/360monitoring.png">`
- Remove the check from "Hidden" to enable customers to buy the product
- Click on "Save Changes"

## Example Configuration as Addon ##

- Login to your WHMCS instance as an admin user
- Go to Configuration -> Sytem-Settings -> Products Addons
- Create a new product addon e.g. "360 Monitoring Addon" with a nice description like "Keep track of your servers performance and website uptime with our easy to use monitoring platform"
- Optionally you can add a nice product image that has been delivered within the module's zip archive e.g.
`Keep track of your servers performance and website uptime with our easy`
`to use monitoring platform <br/>`
`<img height="50" src="./modules/servers/p360monitoring/360monitoring.png">`
- Check "Show addon during initial product order process" if you want the addon to be ordered e.g. with a virtual server in the initial order process
- Select the appropriate "Welcome email" if you want your customers to receive a separate email for the addon after ordering. This is normally the "Other Product/Service Welcome Email"
- Switch to the tab "Pricing" and select the payment type, e.g. "Recurring" and enable the "One Time/Monthly" option for selected currencies with the price you like to have as the monthly fee. The fixed amount of servers and websites will be set in the next step
- Switch to the tab "Module Settings" and choose "Other" for the product type together with "360 Monitoring Provisioning Module" as the module name
- Fill the fields "Plesk KA Username" and "Plesk KA Password" with the credentials for the Plesk Partner API 3.0
- Set the fields "Servers" and "Websites" to the fixed values that apply to this addon. You have to fill both fields
- Check "Automatically setup the product as soon as an order is placed" if you want a good user experience or any other option that matches your existing process
- Switch to the tab "Applicable Products" and select all the products where this addon will be available for
- Click on "Save Changes"

## Example E-Mail Templates ##

- The 360 Monitoring license can be activated through the client area or alternatively by sending the activation link in the "New Product Information", which by default is the "Other Product/Service Welcome Email". To do so:
- Go to Configuration -> Sytem-Settings - Email Templates
- Edit the "Other Product/Service Welcome Email" in the "Product/Service Messags" group
- Add the placeholder `{$service_custom_field_activationlink}` to the template, e.g.
`If not already done please activate the product here:`
`{$service_custom_field_activationlink}`
- Click on "Save Changes"

## Troubleshooting ##

In case of problems pleae have a look at the "Module Log" by visiting Configuration -> System Logs and selecting "Module Log" on the left sidebar.

## Minimum Requirements ##

The 360 Monitoring Provisioning Module has been tested with WHMCS versions 7.8 and higher.

For the latest WHMCS minimum system requirements, please refer to
https://docs.whmcs.com/System_Requirements

## Copyright ##

Copyright 2022 [Plesk International GmbH](https://www.plesk.com)
Binary file added modules/servers/p360monitoring/360monitoring.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions modules/servers/p360monitoring/configs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"label_features": "Features",
"label_features_german": "Eigenschaften",
"label_servers": "Servers",
"label_servers_german": "Server",
"label_websites": "Websites",
"label_websites_german": "Webseiten",
"button_activate_license": "Activate license",
"button_activate_license_german": "Lizenz aktivieren",
"button_license_activated": "License activated",
"button_license_activated_german": "Lizenz aktiviert",
"button_dashboard": "360 Monitoring Dashboard"
}
7 changes: 7 additions & 0 deletions modules/servers/p360monitoring/hooks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
/**
* WHMCS Plesk 360 Monitoring Provisioning Module Hooks File
* (C) 2022 Plesk International GmbH
*/

// This file is only kept here to overwrite older versions to prevent module errors
30 changes: 30 additions & 0 deletions modules/servers/p360monitoring/lib/confighelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* WHMCS Plesk360 Provisioning Module
* Config Helper
* (C) 2022 Plesk International GmbH
**/

namespace WHMCS\Module\Server\Plesk360;

class ConfigHelper {

public $configs;

public function __construct()
{
$this->configs = $this->loadConfigs();
}

public function loadConfigs(): array
{
$configsFilePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'configs.json';

if ($configs = file_get_contents($configsFilePath)) {
return (array) json_decode($configs);
}

return [];
}

}
67 changes: 67 additions & 0 deletions modules/servers/p360monitoring/lib/curlhelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
/**
* WHMCS Provisioning Module
* cURL Helper
* (C) 2022 Plesk International GmbH
**/

namespace WHMCS\Module\Server\Plesk360;

class CURLHelper {

static private function prepare($url, $username, $password, $contentType)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
if ($username != "") {
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
}
if ($contentType != "") {
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: ' . $contentType));
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_FAILONERROR, true);

return $ch;
}

static public function preparePOST($url, $username, $password, $contentType, $postData)
{
$ch = self::prepare($url, $username, $password, $contentType);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

return $ch;
}

static public function preparePUT($url, $username, $password, $contentType, $postData)
{
$ch = self::prepare($url, $username, $password, $contentType);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

return $ch;
}

static public function prepareGET($url, $username, $password, $contentType)
{
$ch = self::prepare($url, $username, $password, $contentType);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_POST, 0);

return $ch;
}

static public function prepareDELETE($url, $username, $password)
{
$ch = self::prepare($url, $username, $password, '');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_POST, 0);

return $ch;
}
}
Loading

0 comments on commit d0c6078

Please sign in to comment.