NAME

Business::NAB::BPAY::Payments

SYNOPSIS

use Business::NAB::BPAY::Payments;

my $Payments = Business::NAB::BPAY::Payments->new_from_file(
    "/path/to/bpay/payments/batch/file.bpb",
);

# parse
my $Header = $Payments->header_record->[0];

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

my $Trailer = $Payments->trailer_record->[0];

# create
$Payments->to_file(
    "/path/to/bpay/payments/batch/file_output.bpb",
    $separator, # defaults to "\r\n"
);

DESCRIPTION

Class for parsing / creating a NAB BPAY batch payments file

ATTRIBUTES

All attributes are ArrayRef[Obj] where Obj are of the Business::NAB::BPAY* namespace:

HeaderRecord
DetailRecord
TrailerRecord

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

$Payments->add_header_record( $HeaderRecord );
$Payments->add_detail_record( $DetailRecord );
$Payments->add_trailer_record( $TrailerRecord );
header_record (ArrayRef[Obj])
detail_record (ArrayRef[Obj])
trailer_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::BPAY::Payments
    ->new_from_file( $file_path );

to_file

Writes the file content to the passed file path:

$Payments->to_file(
    $file_path,
    $separator, # defaults to "\r\n"
);

SEE ALSO

Business::NAB::Types

Business::NAB::BPAY::Payments::HeaderRecord

Business::NAB::BPAY::Payments::DetailRecord

Business::NAB::BPAY::Payments::TrailerRecord