Service reselling

From ISPWiki
Jump to: navigation, search

This article will go you through the steps you need to perform to resell services via BILLmanager.

BILLmanager which services we are going to resell will be referred to as an "external" billing system. Only BILLmanager 5 Corporate can be used as an external system.

General information

A processing module is connected to the BILLmanager handler. This module is integrated with external BILLmanager (user permissions required). Make sure the client has sufficient funds on his personal account to pay for his orders.

Attention! Do not add connections with user permissions associated with one account from different BILLmanager. Creating two or more connections will lead to incorrect handling of events.

One or multiple tariff plans are imported and configured. Once completed, your clients will be able to order services related to the tariff plans. When a client orders a service, or his service is handled, a new operation is registered, and the request to external BILLmanager is sent while handling the service. If a success, the current operation is set to manual setup so that it won't start again automatically.

Once external BILLmanager activates the service, the corresponding notification will be sent via events. The event mechanism receives all the changes made in external BILLmanager (parameters, add-ons, service activation/suspension, etc.), so your BILLmanager will always have up-to-date information about services.

Integration with external BILLmanager

To set up integration with an external BILLmanager, add a processing module.

Choose a service type

Choose a service type


Select the BILLmanager processing module (BILLmanager is not shown for not supported product types).


Choose a service type


Proceed with the following steps similar to configuration of other processing modules. The newly created processing module can be used for reselling other supported services.
Note: make sure that the user in external BILLmanager has Client permissions and has sufficient funds on his personal account to pay for services. Besides, make sure that he is assigned to the group of clients who can suspend and deleted services, otherwise, services won't be suspended in a reselling billing system. (E.g. if phone verification is used for service deletion).

Importing tariff plan

Navigate to the Tariff plans module to import a tariff plan.


Click the "Import" button and complete the following steps:


Select the processing module that you've created above. It is already integrated with external BILLmanager.

Then, select a tariff plan and click Finish.


Limits:

  1. Be sure to specify equal order periods in both panels for successful import.
  2. If currencies do not match, the prices being imported will be converted into the main currency of your BILLmanager. If currencies are not set in your BILLmanager, prices cannot be imported.

The following objects can be imported:

  • tariff add-ons
  • OS templates - if you are importing "OS templates" (the internal name is "ostempl"), templates of operating systems available for the tariff in external BILLmanager will be imported; all of the templates in your billing are assigned to the same module, OS templates will be assigned to certain tariff plans (templates that are not used will be unassigned);
  • enumerations - if the tariff plan being imported has "enumeration" add-ons, these enumerations will be imported;


The tariff plan you have just imported will be assigned to a tariff of external BILLmanager via the Internal name field (intname in the pricelist database table). This field will contain the 5-intname value, where 5 is the tariff identifier in external BILLmanager, intname - its internal name.

Synchronization of tariff plans

Starting from version 5.74.0 the synchronization function was modified (it doesn't depend on "lang").

Execute the following command in BILLmanager that will resell services

cd /usr/local/mgr5
./sbin/mgrctl -m billmgr pricelist.sync elid=<tariff id>

Actions that are performed during synchronization:

  • parameters of product type:
    • tags for the "Pre-installed software" and "Operating system" parameters will be updated
    • new values for the "Pre-installed software" and "Operating system" parameters will added and associated with a processing module/tariff plan
    • the "Pre-installed software" and "Operating system" parameters, which were removed in reselling BILLmanager, will be removed from the tariff plan.
  • tariff add-on:
    • new add-ons will be created for the tariff plan (they will have the Disabled status)
    • add-ons, which were removed/disabled in reselling BILLmanager, will be deleted
    • please note: prices for existing add-ons will remain unchanged!
  • enumerations:
    • new enumerations will be created
    • new elements will be created for existing enumeration elements
  • enumeration prices (in tariff add-on's configuration form):
    • new enumerations with price will be created
    • elements, which were removed or disabled in reselling BILLmanager will be deleted.

Service handler

Any operation with a service (order, changing parameters, status, etc.) a new operation is registered, and the pmbillmgr handler is started. Depending on a operation, the processing module generates a command and executes it in external BILLmanager. If a success, the current operation is set to manual setup so that it won't be restarted automatically.

When creating a service in external BILLmanager, the service id from your BILLmanager is saved into the database (he remoteid field of the item table).

In your BILLmanager the operation that will process the command can be also running, that's why it's not possible to define if the command completed successfully in your BILLmanager. To check service status, BILLmanager that resells services, once in 5 minutes requests external BILLmanager for events; the following command is automatically added to cron:

*/5 * * * *	/usr/local/mgr5/sbin/mgrctl -m billmgr checkevent

Events that can be handled:

  • Service setup - the service status will change into "Active";
  • Suspension - the service status will change into "Suspended";
  • Activation - the service status will change into "Active";
  • Deletion - the service status will change into "Deleted";
  • Adding new IP address - 1 address is added to the tariff plan. A new IP is created in the list of IP addresses;
  • Deletion of IP - 1 IP address is deleted from the list;
  • Changing add-on - add-on's value will be modified;
  • Changing parameters - service parameter will be modified.

Your BILLmanager keeps events in the itemevent database. It is usually deleted after processing the event in BILLmanager.

Event handling depends on BILLmanager where the operation started. If changes are made in your BILLmanager, the service status will be updated in 5 minutes.

If service statuses and expiration dates are not synchronized, you can modify them in the database: the item table, status and expiredate fields.

Possible values for status:

  • 1 - ordered
  • 2 - active
  • 3 - suspended
  • 4 - deleted

Matching periods

Periods are configured in the Processing module edit form. Navigate to Processing modules -- select the module integrated with BILLmanager and click Properties.


A list of module properties will open.

Currently, only one parameter can be configured - - Periods comparison. If needed, you may create multiple parameters for period comparison. При необходимости может быть создано несколько параметров для настройки сопоставления разных периодов.

Fill out the following form:

  • Parameter - currently only "Periods comparison" is supported
  • Source period - period to be changed;
  • Change into - new period that will be applied;
  • Compare with tariff plan - periods will be compared only for services of the selected tariff plan;
  • Product type - select a product type related to the tariff plan;
  • Tariff plan - tariff plan for which periods will be compared.

Troubleshooting

If service expiration dates in the billing systems do not match for some reason, you can change a date in the database:

update item set expiredate="2016-04-27" where id=9304;

where 2016-04-27 - is a service expiration date in the external billing system. 9304 - service id in our billing system.

Service import

Starting from version 5.158 you can import services from BILLmanager. In the list of processing modules select BILLmanager from which you want to import services. Click import to open a list of services you can import. Click "Upload" to upload the list and select a product type. In the search field you can enter a service name to upload services by mask.

The system will start a new background task to upload the list. Once completed, you can assign services to clients. Select a service and click the "Assign" button. If the corresponding tariff plan has not been created in the billing system, BILLmanager will offer to import it. After import you can select a client to assign the service.

Types of services that can be imported:

  • VPS
  • Dedicated server
  • Web-hosting
  • ISPsystem licenses

If a service is already created in BILLmanager, you cannot assign it. Conditions for comparison of services - the IP address, identifier in the control panel, or username (depending on a service type).