BankAccount
A bank account to pay into or take from: a UK sort code and account number, an IBAN, or another country's account by its country, its bank's code where it has one, and its number. Shown masked to its number's last four. Personal data.
Money and banking; not ordered; since Jadpo 0.1.0.
Make one
Pick one of its variants and give its fields, BankAccount.uk { sort_code: ... account_number: ... }.
Variants
| Variant | Fields |
|---|---|
uk |
sort_code: UkSortCode, account_number: UkAccountNumber |
iban |
iban: Iban |
other |
country: Country, bank_code: Text?, account_number: Text |
Text, JSON and storage
It has no single text form, so text.from and text.parse don't take it. JSON sends an object of its variant's name, as tag, and the variant's fields.
| JSON |
|---|
{"tag":"uk","sort_code":"089999","account_number":"66374958"} |
{"tag":"iban","iban":"GB29NWBK60161331926819"} |
{"tag":"other","country":"US","bank_code":"021000021","account_number":"123456789"} |
{"tag":"other","country":"NZ","bank_code":null,"account_number":"010202012345600"} |
It is stored in 6 columns, each named for the field, _ and its suffix. This is {"tag":"other","country":"US","bank_code":"021000021","account_number":"123456789"}:
| Column | Type | Holds |
|---|---|---|
<field>_kind |
text |
'other' |
<field>_sort_code |
text |
NULL::text |
<field>_account_number |
text |
'123456789' |
<field>_iban |
text |
NULL::text |
<field>_country |
text |
'US' |
<field>_bank_code |
text |
'021000021' |
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
{"tag":"uk","sort_code":"089999","account_number":"66374958"} |
•••• 4958 |
{"tag":"iban","iban":"GB29NWBK60161331926819"} |
•••• 6819 |
{"tag":"other","country":"US","bank_code":"021000021","account_number":"123456789"} |
•••• 6789 |
{"tag":"other","country":"NZ","bank_code":null,"account_number":"010202012345600"} |
•••• 5600 |
Operations
It has the contract's own operations: 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-bank-account.md.Built from Jadpo main at e00e61f.