valtype::c...d::discover(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’³ valtype::c...d::discover β€” aka valtype::creditcard::discover (3tcl)

okay bestie, welcome to the manual page for valtype::creditcard::discover, part of tcllib β€” no cap, we're about to validate some Discover creditcard numbers and it's giving very much "trust but verify" πŸ’…


✨ NAME ✨

valtype::creditcard::discover β€” validation for Discover 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::discover ?1.1?

valtype::creditcard::discover validate value

valtype::creditcard::discover checkdigit value

✨ DESCRIPTION ✨

So this package implements a snit validation type for a Discover creditcard number. fr fr.

A validation type is basically an object you can use to validate Tcl values of a particular kind. Like, for example, snit::integer β€” a validation type defined by the snit package β€” is used to validate that a Tcl value is an integer. Same energy, different card. πŸ¦‹

Every validation type has a validate method, and that's the one doing the actual validating. It must take a single argument β€” the value to be validated β€” and further, it must do nothing if the value is valid, but throw an error if the value is invalid:

valtype::creditcard::discover validate .... ;# Does nothing
valtype::creditcard::discover validate .... ;# Throws an error (bad Discover creditcard number).

The validate method will always return the validated value on success, and throw the -errorcode INVALID on error, possibly with additional elements that provide more details about the problem. extra receipts, iykyk 🧾✨


✨ API ✨

The API provided by this package satisfies the specification of snit validation types found in the documentation of Snit's Not Incr Tcl. iconic behaviour, honestly πŸ‘‘

  • valtype::creditcard::discover validate value β€” This method validates the value and returns it, possibly in a canonical form, if it passes. If the value does not pass the validation, an error is thrown. it either slays or it gets yeeted πŸ’€
  • valtype::creditcard::discover checkdigit value β€” This method computes a check digit for the value. Before doing so it is validated, except for a checkdigit. If the value does not pass the validation, no check digit is calculated and an error is thrown instead. like, no digit for you bestie πŸ™ˆ

✨ ERROR CODES ✨

As said in the package description, the errors thrown by the commands of this package in response to input validation failures use the -errorcode INVALID to distinguish themselves from package internal errors. periodt.

To provide more detailed information about why the validation failed, the -errorCode goes actually beyond that. First, it will contain a code detailing the type itself. Here this is CREDITCARD DISCOVER. This is then followed by values detailing the reason for the failure. The full set of -errorCodes which can be thrown by this package are:

  • INVALID CREDITCARD DISCOVER 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 Discover creditcard number. 🚫
  • INVALID CREDITCARD DISCOVER 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, th input may be an outright fake too. 😭
  • INVALID CREDITCARD DISCOVER LENGTH β€” The input value is of the wrong length to be a Discover creditcard number. too short? too long? vibe check failed. πŸ“
  • INVALID CREDITCARD DISCOVER PREFIX β€” The input value does not start with the magic value(s) required for it to be a Discover creditcard number. ✨ no magic prefix, no entry.

✨ BUGS, IDEAS, FEEDBACK ✨

This document, and the package it describes, will undoubtedly contain bugs and other problems. πŸ˜” Please report such in the category valtype of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist](http://core.tcl.tk/tcllib/reportlist). Please also report any ideas for enhancements you may have for either package and/or documentation. we love feedback bestie 🫢

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. πŸ‘€

✨ KEYWORDS ✨

Checking, Discover, Testing, Type checking, Validation, Value checking, bank, card for credit, credit card, finance, isA 🌈


✨ CATEGORY ✨

Validation, Type checking πŸŽ€


Copyright (c) 2011 Andreas Kupries <andreas_kupries@users.sourceforge.net>


okay that's the whole page, bestie β€” sending you off with the source and version deets: this is from tcllib, version 1.1, manual page valtype::c...d::discover(3tcl). go forth and validate responsibly πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from