How to start calculation of accruals manually


The following command is used to calculate accruals manually:

Manual calculation of accruals

/usr/local/mgr5/sbin/billmaintain --command affiliatemonthly --date YYYY-MM-DD
CODE

YYYY-MM-DD — the date as of which the referral program reward is accrued. Referral program accruals are created for the specified month.

If you need to recalculate the accruals for the referral program:

  1. Delete the referral program payments.
  2. Delete the reward accruals from the affiliatereward table. Read more in How does the affiliate program work?
  3. Execute the command above.

How to set the reward greater than 100%


It is not possible to specify the amount of reward more than 100% through the BILLmanager interface. However, to do so:

  1. Create the following record into the database:

    An example of a DB table record

    UPDATE affiliate SET reward = 1000;
    CODE

    reward — amount of reward in percent.

  2. Clear the DB cache with the command:

    Clear DB cache

    rm -rf /usr/local/mgr5/var/.db.cache*
    CODE
  3. Restart BILLmanager with the command:

    Restart BILLmanager

    /usr/local/mgr5/sbin/mgrctl -m billmgr exit 
    CODE

How to link a referral to another client


To link a referral to another client:

  1. Create the following record into the database:

    An example of a DB table record

    UPDATE account2project SET affiliatereferer = 3 WHERE account = 6;
    CODE

    affiliatereferer — the partner under whose link the client was attracted;

    account — client code.

  2. Clear the DB cache with the command:

    Clear DB cache

    rm -rf /usr/local/mgr5/var/.db.cache*
    CODE
  3. Restart BILLmanager with the command:

    Restart BILLmanager

    /usr/local/mgr5/sbin/mgrctl -m billmgr exit
    CODE

    If the referrer, to which the client has been linked, does not have access to the referral program, under which the client is attracted, then the referrer will not receive rewards. The log will contain an error in the form below:

    An example of a log error

    Jan 24 15:25:49 [272:152] libmgr ERROR Error: Type: 'access' Object: 'affiliate' Value: '1'
    CODE

When considering the reward, BILLmanager uses the value of the affiliateprogram field in the account2project table for the referral. 

For example, if the referrer is connected to the first referral program, and the referral has the second referral program in account2project, the referrer will be rewarded at the rate of the second program. This should be taken into account if the client changes the referral program, because the field affiliateprogram does not change.