The validator would just return true or false. The code behind the validation might use a long and test whether or not it is zero.
But the validation itself is going to be pass/fail. Michael Marrotte wrote: > > So the checksum is the Long returned by the method? Did it used to be a > boolean? I need to know because I'm wrote my own validator that filters > masked credit card numbers and passes it to StrutsValidator only if it's not > masked. But, I need to know what Long I should return if the credit card > number I'm filtering for is masked -- since I will not call StrutsValidator > then. > > Any help is greatly appreciated. > > Thanks, > > --Michael Marrotte > > -----Original Message----- > From: Ted Husted [mailto:[EMAIL PROTECTED]] > Sent: Thursday, May 23, 2002 6:31 PM > To: Struts Users Mailing List > Subject: Re: StrutsValidator.validateCreditCard() returns Long? > > It was adapted from Perl and Javascript routines that use a "prime of > nines" checksum against the number. > > It also looks to see if the prefix matches one of the usual vendors, and > that the length of the number matches what a given vendor expects. > > I've run it against thousands of accounts in production applications and > it has always worked just fine. > > Of course, the account itself might not be any good, but at least you > know its not an arbitrary number. > > Another good check is to see if the number is already being used by > anyone. This way if a bogus number is in circulation, it can't be used > more than once. > > Incidentally, the algorithm behind this is also a good way to generate > your own account numbers. The checksum digit it puts at the end is > specifically designed to guard against transpositions and what not. The > first X digits can be a serial number, and then you just concaternate > the checksum at the end. > > -- Ted Husted, Husted dot Com, Fairport NY US > -- Developing Java Web Applications with Struts > -- Tel: +1 585 737-3463 > -- Web: http://husted.com/about/services > > Michael Marrotte wrote: > > > > According to the source and docs it returns a boolean. But, the link > seems > > to be broken in the latest docs for this method. Any help on how > > validateCreditCard() decides what values to return is greatly appreciated. > > > > Thanks, > > > > --Michael Marrotte -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>