Configuring LUHN-10 Accounts Numbering
LUHN-10 is a widely used algorithm for character-based error control. In Billing, LUHN-10 can be applied to accounts numbering, so that the last digit in an account number computed with LUHN-10 provides the error detection.
In case LUHN-10 is in use, accounts' numbers are issued in the YYYYNNNNNC
format,
where
YYYY
is<current_year> - 1000
(for example, year 2015-1000=1015);NNNNN
is an auto incrementing account number;C
is a control digit computed by LUHN-10 for each account.
Before Enabling LUHN-10 Accounts Numbering
Initial accounts enumeration format in Billing is simple auto incremented 7-digit ID. Thus, before enabling LUNH-10, it is necessary to zero-fill account numbering counter, to start with 1. In case this is not done, then in the situation when account number is greater than 5-digit value, the resulting LUHN-10 number will appear to be incorrect. Namely, the account number will be added to year.
Enabling LUHN-10 Accounts Numbering
LUHN-10 is enabled by adding a parameter to Billing configuration file global.conf
located at ~bm/etc/ssm.conf.d/
.
To enable LUHN-10 for accounts numbering:
- Log in to Billing application server.
- Open the
global.conf
file. -
Add the following parameter to the
[environment]
section of the file:ACCOUNT_NUMBERING = YEAR_AND_LUHN10
- Save changes.
-
Zero- fill account numbering. For that, execute the following queries:
DELETE FROM "IntAccountSequence";
SELECT setval('"IntAccountSequence_AccountSeq_seq"', 1); -
Restart Billing:
/etc/init.d/pba restart
As a result, account number will be auto-incremented, and next year only the year will be changed, for example, 1009008759 -> 1010008765
If you want to zero-fill the auto-incremented part of account number, then schedule by cron
the same SQL request as in item 5 of the step-by-step instruction above.