CC_VISA(3tcl)
π³ valtype::creditcard::visa β the valtype::creditcard::visa manual, section 3tcl, bestie edition β¨
okay so. you opened the manual for valtype::creditcard::visa and you want the whole thing but make it make sense? say less. this is Validation for VISA creditcard number, it lives in section 3tcl, and it ships with tcllib. let's go π«Ά
β¨ NAME β¨
valtype::creditcard::visa β Validation for VISA creditcard number π³
π SYNOPSIS π
package require Tcl 8.5 9
package require snit 2
package require valtype::common
package require valtype::luhn
package require valtype::creditcard::visa ?1.1?
valtype::creditcard::visa validate value
valtype::creditcard::visa checkdigit value
π DESCRIPTION π
So. This package implements a snit validation type for a VISA creditcard number. That's the whole vibe. π
And like, what even is a validation type? Bestie. A validation type is an object you can use to validate Tcl values of a particular kind. For example, snit::integer β a validation type defined by the snit package β gets used to validate that a Tcl value is an integer. Same energy, different data type. β¨
Every validation type has a validate method, and that's the one doing the actual work. Rules of the game:
- it must take a single argument, the value to be validated;
- it must do nothing at all if the value is valid;
- it must throw an error if the value is invalid.
so it's giving:
valtype::creditcard::visa validate .... ;# Does nothing
valtype::creditcard::visa validate .... ;# Throws an error (bad VISA creditcard number).
The validate method will always return the validated value on success, and on error it throws with -errorcode INVALID, possibly with extra elements that spill more tea about what exactly went wrong. π
π API π
The API this package gives you satisfies the spec of snit validation types found in the documentation of Snit's Not Incr Tcl. no cap.
valtype::creditcard::visa validate valueβ This method validates the value and returns it, possibly in a canonical form, if it passes. And if the value does not pass the validation? an error is thrown. simple as. πvaltype::creditcard::visa checkdigit valueβ This method computes a check digit for the value. Before it does any of that, the value gets validated β except for a checkdigit. If the value does not pass validation then no check digit is calculated and an error is thrown instead. periodt. π
π ERROR CODES π
Like the package description already said, the errors thrown by this package's commands when input validation fails use -errorcode INVALID to distinguish themselves from the package's own internal errors. important distinction, don't skip it.
Now for the extra detail, because -errorCode goes actually beyond that. First, it will contain a code detailing the type itself. Here, that's CREDITCARD VISA. After that comes values detailing the reason for the failure. The full set of -errorCodes this package can throw:
INVALID CREDITCARD VISA CHARACTERβ The input value contained one or more bad characters, i.e. characters which must not occur in the input for it to be a VISA creditcard number. π«INVALID CREDITCARD VISA CHECK-DIGITβ The check digit of the input value is wrong. This usually signals a data-entry error, with digits transposed, forgotten, etc. Of course, the input may be an outright fake too. πINVALID CREDITCARD VISA LENGTHβ The input value is of the wrong length to be a VISA creditcard number.INVALID CREDITCARD VISA PREFIXβ The input value does not start with the magic value(s) required for it to be a VISA creditcard number. π§
π BUGS, IDEAS, FEEDBACK π
This document, and the package it describes, will undoubtedly contain bugs and other problems. not me being honest about it π Please report such in the category valtype of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist]. And please also report any ideas for enhancements you may have for either the package and/or the documentation. we love feedback fr fr π
When proposing code changes, please provide unified diffs, i.e. the output of diff -u.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. iykyk. π
π₯ KEYWORDS π₯
Checking, Testing, Type checking, VISA, Validation, Value checking, bank, card for credit, credit card, finance, isA
β CATEGORY β
Validation, Type checking
πΈ COPYRIGHT πΈ
Copyright (c) 2011 Andreas Kupries <andreas_kupries@users.sourceforge.net>
okay bestie that's the whole page, every flag, every error code, every reference, nothing skipped π go validate some cards and stay iconic β¨
tcllib Β· version 1.1 Β· page valtype::creditcard::visa(3tcl) β mwah, take care of her π«Άπ
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- Copyright (c) 2011 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms