package
BPAY Customer Reference Number Generator and Validator
npm install bpayGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Node.JS BPAY Customer Reference Number Generator and Validator.
Also includes helpful methods for dealing with Luhn Check Digits.
See http://www.bpay.com.au/Business/Small-Medium-Business/Help/BPAY-Services-FAQs.aspx
and http://en.wikipedia.org/wiki/Luhn_algorithm
npm install bpay --save... then ...
var bpay = require('bpay');
var crn = bpay.generateBpayCRN(10); // generates a valid 10 digit CRN
console.log(bpay.validateBpayCRN(crn)); // true!generateBpayCRN(len, prefix)Generates a valid BPay Customer Reference Number.
A BPay CRN is a 2-20 digit number with the last digit a luhn check digit.
len (String or Number) - Length of number to generate (defaults to 10)prefix (String or Number) - Prefix to use (optional)String - The new CRNvalidateBpayCRN(input)Validates a BPay Customer Reference Number.
input (String or Number) - The CRN to validateBoolean - Whether the CRN is validgetLuhnCheckDigit(input)Calculates the Luhn check digit for the input.
input (String or Number) - The input to generate a check digit forString - The check digitvalidateLuhnCheckDigit(input)Validates the Luhn check digit in the input.
input (String or Number) - The input to validateBoolean - Whether the check digit is valid