StructureJS
0.15.2A class based utility library for building modular and scalable web platform applications. Features opt-in classes and utilities which provide a solid foundation and toolset to build your next project.
A MerchantUtility class that has several static methods to assist in development.
_updateRanges
()
protected
_validateCreditCard
cardNumber
Determines if credit card is valid using the Luhn formula. https://gist.github.com/ShirtlessKirk/2134376
_validateStructure
cardNumber
encodeCreditCardNumber
strNumber
[digitsShown=4]
[encodeChar=*]
Encode a credit card number as a string and encode all digits except the last digitsShown
.
MerchantUtil.encodeCreditCardNumber('4556106734384949');
// ************4949
MerchantUtil.encodeCreditCardNumber('4556106734384949', 5, 'x');
// xxxxxxxxxxx84949
getCreditCardProvider
cardNumber
Returns a credit card provider name from the credit card number passed in.
MerchantUtil.getCreditCardProvider("4");
MerchantUtil.getCreditCardProvider("4556106734384949");
// visa
MerchantUtil.getCreditCardProvider("5428070016026573");
// mastercard
isCreditCard
cardNumber