View Source AbaValidator (ABA Validator v2.0.0)
Documentation for AbaValidator
.
Link to this section Summary
Functions
Get the entries as part of the descriptive 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
Reads a file, validates it as an ABA file and returns the processed contents.
Link to this section Functions
Get the entries as part of the descriptive 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"}}
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}}
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}}
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"
Reads a file, validates it as an ABA file and returns the processed contents.
examples
Examples
iex> AbaValidator.process_aba_file("./test/helper")
iex> AbaValidator.process_aba_file("./test/helper/test.txt")
iex> AbaValidator.process_aba_file("./test/helper/test.aba") [ {:descriptive_record, :ok, {"01", "CBA", "test ", "301500", "221212121227", "121222"}}, {:detail_record, :ok, {"040-440", "123456", :blank, :externally_initiated_credit, 35389, "4dd86..4936b", "Bank cashback", "040-404", "12345678", "test", 0}}, {:detail_record, :ok, {"040-404", "12345678", :blank, :externally_initiated_debit, 35389, "Records", "Fake payment", "040-404", "12345678", "test", 0}}, {:file_total_record, :output, {0, 35389, 35389, 2}} ]