View Source AbaValidator (ABA Validator v0.1.4)

Documentation for AbaValidator.

Link to this section Summary

Functions

Get the entries as part of the descriptiive record

Get the entries as part of the detail record

Get the entries as part of the file total record

Get a description for a given transaction code. See here for the possible transaction code

Link to this section Functions

Link to this function

get_descriptive_record(entry)

View Source
@spec get_descriptive_record(String.t()) ::
  {:error, :incorrect_length | :incorrect_starting_code | :invalid_format}
  | {:ok, String.t(), String.t(), String.t(), String.t(), String.t(),
     String.t()}

Get the entries as part of the descriptiive record

examples

Examples

iex> AbaValidator.get_descriptive_record(1)
{:error, :invalid_input}

iex> AbaValidator.get_descriptive_record("11")
{:error, :incorrect_length}

iex> AbaValidator.get_descriptive_record("01")
{:error, :incorrect_length}

iex> AbaValidator.get_descriptive_record("1                 01CBA       test                      301500221212121227121222                                        ")
{:error, :incorrect_starting_code}

iex> AbaValidator.get_descriptive_record("0                   CBA       test                      301500221212121227121222                                        ")
{:error, :invalid_format, [:reel_sequence_number]}

iex> AbaValidator.get_descriptive_record("0                 01CBA       test                      301500221212121227121222                                        ")
{:ok, "01", "CBA", "test                      ", "301500", "221212121227", "121222"}
Link to this function

get_detail_record(entry)

View Source

Get the entries as part of the detail record

examples

Examples

iex> AbaValidator.get_detail_record(1)
{:error, :invalid_input}

iex> AbaValidator.get_detail_record("11")
{:error, :incorrect_length}

iex> AbaValidator.get_detail_record("01")
{:error, :incorrect_length}

iex> AbaValidator.get_detail_record("1032 898 12345678 130000035389money                           Batch payment     040 404 12345678test            00000000")
{:error, :invalid_format, [:bsb,:trace_record]}

iex> AbaValidator.get_detail_record("1                                                                                                                       ")
{:error, :invalid_format,
         [:bsb, :account_number, :transasction_code, :amount, :account_name, :reference, :trace_record, :trace_account_number, :remitter, :withheld_tax]}

iex> AbaValidator.get_detail_record("7999 999            000000000000000353890000035388                        000002                                        ")
{:error, :incorrect_starting_code}

iex> AbaValidator.get_detail_record("1032-898 12345678 130000035389 money                           Batch payment    040-404 12345678 test           00000000")
{:ok, "032-898", "12345678", :blank, :externally_initiated_debit, 35389, " money", " Batch payment","040-404", "12345678", " test", 0}

iex> AbaValidator.get_detail_record("1032-8980-2345678N130000035389money                           Batch payment     040-404 12345678test            00000000")
{:ok, "032-898", "0-2345678", :new_bank, :externally_initiated_debit, 35389, "money", "Batch payment","040-404", "12345678", "test", 0}
Link to this function

get_file_total_record(entry, records \\ 0)

View Source
@spec get_file_total_record(String.t(), integer()) ::
  {:error, :incorrect_length | :incorrect_starting_code | :invalid_input}
  | {:error, :invalid_format,
     [
       :bsb_filler
       | :first_blank
       | :last_blank
       | :mid_blank
       | :net_total
       | :net_total_mismatch
       | :record_count
       | :records_mismatch
       | :total_credit
       | :total_debit
     ]}
  | {:ok, integer(), integer(), integer(), integer()}

Get the entries as part of the file total record

examples

Examples

iex> AbaValidator.get_file_total_record(1)
{:error, :invalid_input}

iex> AbaValidator.get_file_total_record("11")
{:error, :incorrect_length}

iex> AbaValidator.get_file_total_record("01")
{:error, :incorrect_length}

iex> AbaValidator.get_file_total_record("1                 01CBA       test                      301500221212121227121222                                        ")
{:error, :incorrect_starting_code}

iex> AbaValidator.get_file_total_record("7999 999            000000000000000353890000035388                        000000                                        ")
{:error, :invalid_format, [:bsb_filler, :net_total_mismatch ]}

iex> AbaValidator.get_file_total_record("7                                                                                                                       ")
{:error, :invalid_format, [:bsb_filler, :net_total, :total_credit, :total_debit, :record_count]}

iex> AbaValidator.get_file_total_record("7999 999            000000000000000353890000035388                        000002                                        ")
{:error, :invalid_format, [:bsb_filler, :net_total_mismatch, :records_mismatch]}

iex> AbaValidator.get_file_total_record("7999-999            000000000000000353890000035389                        000000                                        ")
{:ok, 0, 35389, 35389, 0}
Link to this function

get_transaction_code_description(arg1)

View Source
@spec get_transaction_code_description(String.t() | integer() | atom()) ::
  :error | String.t()

Get a description for a given transaction code. See here for the possible transaction code

The following atoms are valid inputs:

  • :allotment
  • :australian_government_security_interest
  • :debenture_note_interest
  • :dividend
  • :error
  • :externally_initiated_credit
  • :externally_initiated_debit
  • :family_allowance
  • :pay
  • :pension

examples

Examples

iex> AbaValidator.get_transaction_code_description("11")
:error

iex> AbaValidator.get_transaction_code_description(53)
"Pay"

iex> AbaValidator.get_transaction_code_description(:australian_government_security_interest)
"Australian Government Security Interest"