CryptoPay\NZBanks\NZBankAccount
DataObject representation of a New Zealand bank account
Synopsis
class NZBankAccount
extends DataObject
{
- // members
- private static string $table_name = 'NZBankAccount';
- private static string $singular_name = 'Bank Account';
- private static string $plural_name = 'Bank Accounts';
- private static array $db = ;
- private static array $has_one = ;
- private static array $summary_fields = ;
- // methods
- public void getTitle()
- public void getCMSFields()
- public void validate()
- public void validateAccountNumber()
- public static boolean validate_reference_field()
- public void onBeforeWrite()
- public static int dollars_to_cents()
- public static float cents_to_dollars()
- public static string prettify()
- public static NZBankAccount find_or_make()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Tasks
Line | Task |
---|---|
117+ | : technically allows a-ZA-Z0-9-~*()+=[]{} but that regex sucks |
146+ | this probably needs bcmul |
201+ | allow has_many relationship with Member |
Members
private
-
$db
Database fields: - AccountNumber: Padded version of a New Zealand bank account, including dashes ☹ Bank ID (maximum 2 digits) ☹ Bank branch (maximum 4 digits) ☹ Account base number (maximum 8 digits) ☹ Account suffix (maximum 4 digits). -
$has_one
Has One fields: - Bank: points back to the bank which controls the account - $plural_name
- $singular_name
-
$summary_fields
Summary fields for display purposes - $table_name
Methods
public
- cents_to_dollars() — Convert New Zealand cents into dollars
- dollars_to_cents() — Convert New Zealand dollars into cents
- find_or_make() — Here we find an existing bank account, or create a new one for identification Bank accounts are not currently assigned to members, but will be if internal payments are ever allowed This method is to check that more than one account is not being used unless necessary - on some occasions members may share accounts, such as a joint account
- getCMSFields() — CMS Fields
- getTitle() — Display the bank account number instead of the record ID
- onBeforeWrite() — The number is validated at this point Before writing, format the number and assign it to the identified bank
- prettify() — "Prettify" the bank account information prior to displaying it
- validate() — We must store the fully padded version of the bank account It must identify a New Zealand bank Finally, it must pass the checksum validation
- validateAccountNumber() — Validate the bank account number
- validate_reference_field() — Check that the provided value contains alphanumeric, spaces, or a dash