PaymentCardNumber
A payment card's number (ISO/IEC 7812), 12 to 19 digits with a Luhn check digit: 4242424242424242. Shown to people as its last four only, •••• 4242. Personal data.
Money and banking; not ordered; personal data (financial); since Jadpo 0.1.0.
Make one
Build one from its text, PaymentCardNumber("4242424242424242"), which checks it: text that isn't one breaks format.
text.parse(raw, as: PaymentCardNumber) reads one from its text; text that isn't one at all fails malformed, such as 4242424242424241, 4242 4242 4242 4242 or 42424242424.
Text, JSON and storage
text.from writes its canonical text, the one form text.parse reads back. JSON sends its canonical text as a string.
| Text | JSON |
|---|---|
4242424242424242 |
"4242424242424242" |
378282246310005 |
"378282246310005" |
5555555555554444 |
"5555555555554444" |
It is stored in one column named for the field, of type text. 378282246310005 is stored as '378282246310005'.
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
4242424242424242 |
•••• 4242 |
378282246310005 |
•••• 0005 |
5555555555554444 |
•••• 4444 |
Operations
money.mask(card: PaymentCardNumber) -> MaskedCardNumber: What may be kept ofcardonce its number is gone: its brand, told by its first digits from the ranges each scheme publishes (nonefor a range no listed scheme issues), and its last four digits.
Like every standard type, it also has the contract's own operations: text.parse, text.from, text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-payment-card-number.md.Built from Jadpo main at e00e61f.