NAME

Business::NAB::Australian::DirectEntry::Payments

SYNOPSIS

use Business::NAB::Australian::DirectEntry::Payments;

# parse:
my $Payments = Business::NAB::Australian::DirectEntry::Payments
    ->new_from_file( $file_path );

foreach my $DetailRecord ( $Payments->detail_record->@* ) {
    ...
}

# build:
my $Payments = Business::NAB::Australian::DirectEntry::Payments->new;

$Payments->add_descriptive_record(
    .. # Business::NAB:: ... DescriptiveRecord object
);

$Payments->add_detail_record(
    .. # Business::NAB:: ... DetailRecord object
) for ( @payments );

# optional:
$Payments->add_total_record(
    .. # Business::NAB:: ... TotalRecord object
);

$Payments->to_file(
    $file_path,
    $bsb_number, # if TotalRecord is not set
    $separator, # defaults to "\r\n"
);

DESCRIPTION

Class for building/parsing a "Australian Direct Entry Payments" file

ATTRIBUTES

All attributes are ArrayRef[Obj] where Obj are of the Business::NAB::Australian::DirectEntry::Payments::* namespace:

DescriptiveRecord
DetailRecord
TotalRecord

Convenience methods are available for trivial addition of new elements to the arrays:

$Payments->add_descriptive_record( $DescriptiveRecord );
$Payments->add_detail_record( $DetailRecord );
$Payments->add_total_record( $TotalRecord );
descriptive_record (ArrayRef[Obj])
detail_record (ArrayRef[Obj])
total_record (ArrayRef[Obj])

METHODS

new_from_file

Returns a new instance of the class with attributes populated from the result of parsing the passed file

my $Payments = Business::NAB::Australian::DirectEntry::Payments
    ->new_from_file( $file_path );

to_file

Writes the file content to the passed file path:

$Payments->to_file(
    $file_path,
    $bsb_number, # if TotalRecord is not set, defaults to 999-999
    $separator, # defaults to "\r\n"
);

This also does some validation on the totals in the records.

SEE ALSO

Business::NAB::Australian::DirectEntry::Payments::DescriptiveRecord

Business::NAB::Australian::DirectEntry::Payments::DetailRecord

Business::NAB::Australian::DirectEntry::Payments::TotalRecord