isCreditCard() and Mastercards?
Has anyone noticed that the isCreditCard fuction from cflib.org (http://www.cflib.org/udf.cfm?ID=49) doesn't work with Mastercards? Guess I need to double-check its validation routines. -- Damien McKenna - Web Developer - [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] The Limu Company - http://www.thelimucompany.com/ http://www.thelimucompany.com/ - 407-804-1014 #include stdjoke.h ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193844 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: isCreditCard() and Mastercards?
Has anyone noticed that the isCreditCard fuction from cflib.org (http://www.cflib.org/udf.cfm?ID=49) doesn't work with Mastercards? Guess I need to double-check its validation routines. It did work for Mastercard when I wrote it, but that was during the CF5 beta, so maybe their format has changed? I must admit I haven't used it for years. Nick ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193846 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: isCreditCard() and Mastercards?
It did work for Mastercard when I wrote it, but that was during the CF5 beta, so maybe their format has changed? I must admit I haven't used it for years. If anyone is interested, I wrote a validation function based on the LUHN formula to validate card numbers. This can be added to the existing entry an cflib, or if someone wants to submit it as a separate entry they are free to do so. Here's the code (watch for wrapping)... cfscript function luhn(cc_num) { // luhn() - Version 1.00 // Written by Justin D. Scott of Sceiron Interactive, Inc. // Use: luhn(card_number); // Returns boolean if card is valid or not. // Verifies the format of a credit card number via LUHN Formula (Mod 10) // Based on information available at http://www.beachnet.com/~hstiles/cardtype.html var rev = reverse(cc_num); // Reverse the number so we can start at the end. var tot = 0; var tval = 0; var doub = 0; for (i=1; i lte len(rev); i=i+1) { // Iterate through each number. // Pick out the one to work with. tval = mid(rev, i, 1); // If it's in an odd numbered position simply add to the total. if (i mod 2) tot = tot + tval; else { // Otherwise double the value and add each of the digits // of the product to the total. doub = tval * 2; // So if the digit is 9 (ex: 9*2=18) then add 1 and // then 8 to the total. for (j=1; j lte len(doub); j=j+1) tot = tot + mid(doub, j, 1); } } // And return a boolean. return not tot mod 10; } /cfscript --- Justin D. Scott Vice President Sceiron Interactive, Inc. www.sceiron.com [EMAIL PROTECTED] 941.378.5341 - office 941.320.2402 - mobile 877.678.6011 - facsimile ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193855 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: isCreditCard() and Mastercards?
Justin, I'll try to get this in today. On Wed, 9 Feb 2005 11:03:52 -0500, Justin D. Scott [EMAIL PROTECTED] wrote: It did work for Mastercard when I wrote it, but that was during the CF5 beta, so maybe their format has changed? I must admit I haven't used it for years. If anyone is interested, I wrote a validation function based on the LUHN formula to validate card numbers. This can be added to the existing entry an cflib, or if someone wants to submit it as a separate entry they are free to do so. Here's the code (watch for wrapping)... -- === Raymond Camden, Director of Development for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email: [EMAIL PROTECTED] Blog : ray.camdenfamily.com Yahoo IM : cfjedimaster My ally is the Force, and a powerful ally it is. - Yoda ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193860 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: isCreditCard() and Mastercards?
If anyone is interested, I wrote a validation function based on the LUHN formula to validate card numbers. I may be wrong but I think this is exactly what the first part of IsCreditCard() does. Nick ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193867 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: isCreditCard() and Mastercards?
I may be wrong but I think this is exactly what the first part of IsCreditCard() does. Now that I actually read the description and look in more detail at the code, that is correct. --- Justin D. Scott Vice President Sceiron Interactive, Inc. www.sceiron.com [EMAIL PROTECTED] 941.378.5341 - office 941.320.2402 - mobile 877.678.6011 - facsimile ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193874 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: isCreditCard() and Mastercards?
There's another UDF, CheckPattern(), which has basic syntax checking. It doesn't check the LUHN value though, its just a basic regex. I'm going to give that a try just to see if it can at least let Mastercards through, and then I'll work on fixing the isCreditCard() UDF. -- Damien McKenna - Web Developer - [EMAIL PROTECTED] The Limu Company - http://www.thelimucompany.com/ - 407-804-1014 #include stdjoke.h ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193882 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: isCreditCard() and Mastercards?
I'll wait for you then Damien. Would you mind emailing me directly and NOT submitting to CFLib? That way I get more immidiate notification. Not that it takes me long to process queue items. Ahem. On Wed, 9 Feb 2005 12:04:03 -0500, Damien McKenna [EMAIL PROTECTED] wrote: There's another UDF, CheckPattern(), which has basic syntax checking. It doesn't check the LUHN value though, its just a basic regex. I'm going to give that a try just to see if it can at least let Mastercards through, and then I'll work on fixing the isCreditCard() UDF. -- Damien McKenna - Web Developer - [EMAIL PROTECTED] The Limu Company - http://www.thelimucompany.com/ - 407-804-1014 #include stdjoke.h ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193889 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54