Balance threshold control is responsible for sending notification e-mails when company's balance reaches some threshold limit.
This could be useful to notify your customers that they need to refill their balance as soon as possible or the service provision might will be suspended soon.
To configure it, you need to supply threshold values in company's configuration.
As far company has 3 balances (their, our and mutual) you can specify balance threshold for any of them.
Let's for instance configure their balance threshold.
This balance threshold will apply to the company's balance.
The similar way you could configure our balance threshold which will apply to our balance for this company.
To do this, enter edit mode of company and go to Their Balance tab:
balance threshold amount and balance threshold currency define the threshold limit for the company's balance.
balance alarm email defines e-mail to which notification e-mail will be sent.
balance alarm mail template defines mail template which will be used for sending e-mail.
balance mail time declares time when Smartswitch has sent notification mail last time.
Balance Threshold Controller is implemented as application, named balance_threshold_controller.
You can schedule it's execution via Tasks.
When the application is invoked by Tasks scheduling subsystem, it checks all company's that have balance threshold control enabled, and sends e-mails correspondingly.
To create e-mail, application uses balance alarm mail template.
Application passes next variables to the mail template:
${COMPANY} - the company's name
${BALANCE} - the company's balance
You can use these variables inside mail template.
When e-mail has been sent, application sets balance mail time for the corresponding peer.
In case if current balance doesn't require mail sending, balance mail time is cleared.
Each time when balance threshold controller is invoked, it checks if balance mail time is set, and if it's set, it doesn't send email again.
This is done to eliminate spam e-mails to customers.
So the only case for balance threshold controller to actually send e-mail is when current balance requires e-mail sending and balance mail time is not set.