From: Christoffer Lernö on
On Apr 27, 2007, at 23:06 , James Edward Gray II wrote:

> On Apr 27, 2007, at 3:10 PM, anansi wrote:
>
>> James Edward Gray II wrote:
>>> On Apr 27, 2007, at 12:58 PM, Matthew Moss wrote:
>>>> So is a card number like "4012 3456 7890" a valid Unknown, or an
>>>> invalid Visa?
>>> Visa Invalid
>>> Always match the type first.
>>
>> Nope thats no Visa number but a unknown one. Visa Cards have a
>> certain length (13 or 16) and if that length doesn't fit
>> (Matthew's number here had just 12 digits)it's unknown :)
>> otherwise the length would be obsolete don't you think?
>> Both length and startingbytes have equal weight in the decision
>> wether a card belongs to a known Company or not.
>
> You are right. I didn't read well. It's Unknown.
>
> James Edward Gray II

Do we display Valid/Invalid for unknown cards?

- And by the way: 4012 3456 7890 isn't valid is it? So should that
not be "invalid Unknown" or "invalid Visa"?

/C


From: anansi on
Christoffer Lern� wrote:
>> James Edward Gray II
>
> Do we display Valid/Invalid for unknown cards?
>


We desplay unknown for unkown cards :) and valid/invalid for valid or
invalid cards, the first has nothing to do with the second.

Check first if it's a known one which depends on both the length and the
starting bytes. Then output if it's a known or unknown one.

After that, check the known or unknown number for validation and output
that result.



> - And by the way: 4012 3456 7890 isn't valid is it? So should that not
> be "invalid Unknown" or "invalid Visa"?
>
> /C

That's a unknown and invalid one. To be a Visa one it would need to be
13 or 15 bytes long.


--
greets
(
)
(
/\ .-"""-. /\
//\\/ ,,, \//\\
|/\| ,;;;;;, |/\|
//\\\;-"""-;///\\
// \/ . \/ \\
(| ,-_| \ | / |_-, |)
//`__\.-.-./__`\\
// /.-(() ())-.\ \\
(\ |) '---' (| /)
` (| |) `
jgs \) (/


one must still have chaos in oneself to be able to give birth to a
dancing star
From: anansi on
anansi wrote:
> That's a unknown and invalid one. To be a Visa one it would need to be
> 13 or 15 bytes long.
>

13 or 16 of course...


--
greets
(
)
(
/\ .-"""-. /\
//\\/ ,,, \//\\
|/\| ,;;;;;, |/\|
//\\\;-"""-;///\\
// \/ . \/ \\
(| ,-_| \ | / |_-, |)
//`__\.-.-./__`\\
// /.-(() ())-.\ \\
(\ |) '---' (| /)
` (| |) `
jgs \) (/


one must still have chaos in oneself to be able to give birth to a
dancing star
From: James Edward Gray II on
On Apr 28, 2007, at 7:43 AM, Christoffer Lernö wrote:

> On Apr 27, 2007, at 23:06 , James Edward Gray II wrote:
>
>> On Apr 27, 2007, at 3:10 PM, anansi wrote:
>>
>>> James Edward Gray II wrote:
>>>> On Apr 27, 2007, at 12:58 PM, Matthew Moss wrote:
>>>>> So is a card number like "4012 3456 7890" a valid Unknown, or
>>>>> an invalid Visa?
>>>> Visa Invalid
>>>> Always match the type first.
>>>
>>> Nope thats no Visa number but a unknown one. Visa Cards have a
>>> certain length (13 or 16) and if that length doesn't fit
>>> (Matthew's number here had just 12 digits)it's unknown :)
>>> otherwise the length would be obsolete don't you think?
>>> Both length and startingbytes have equal weight in the decision
>>> wether a card belongs to a known Company or not.
>>
>> You are right. I didn't read well. It's Unknown.
>>
>> James Edward Gray II
>
> Do we display Valid/Invalid for unknown cards?
>
> - And by the way: 4012 3456 7890 isn't valid is it? So should that
> not be "invalid Unknown" or "invalid Visa"?

I would go ahead and display Valid/Invalid normally. That way people
can use the program on cards we didn't cover, as long as they conform
to the standard.

James Edward Gray II


From: Jeremy Hinegardner on
On Fri, Apr 27, 2007 at 08:59:49PM +0900, Ruby Quiz wrote:
> The first check people often do is to validate that the card matches a known
> pattern from one of the accepted card providers. Some of these patterns are:
>
> +============+=============+===============+
> | Card Type | Begins With | Number Length |
> +============+=============+===============+
> | AMEX | 34 or 37 | 15 |
> +------------+-------------+---------------+
> | Discover | 6011 | 16 |
> +------------+-------------+---------------+
> | MasterCard | 51-55 | 16 |
> +------------+-------------+---------------+
> | Visa | 4 | 13 or 16 |
> +------------+-------------+---------------+

Wikipedia has a great chart showing all the prefixes of most known
credit cards, along with lengths and overlap between cards (currently
none).

http://en.wikipedia.org/wiki/Credit_card_number

enjoy,

-jeremy

--
========================================================================
Jeremy Hinegardner jeremy(a)hinegardner.org