| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Business::NAB::Australian::DirectEntry::Payments::DescriptiveRecord; |
|
2
|
|
|
|
|
|
|
$Business::NAB::Australian::DirectEntry::Payments::DescriptiveRecord::VERSION = '0.03'; |
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::NAB::Australian::DirectEntry::Payments::DescriptiveRecord |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Business::NAB::Australian::DirectEntry::Payments::DescriptiveRecord; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# parse |
|
12
|
|
|
|
|
|
|
my $Record = Business::NAB::Australian::DirectEntry |
|
13
|
|
|
|
|
|
|
::Payments::DescriptiveRecord->new_from_record( $line ); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# create |
|
16
|
|
|
|
|
|
|
my $Record = Business::NAB::Australian::DirectEntry |
|
17
|
|
|
|
|
|
|
::Payments::DescriptiveRecord->new( |
|
18
|
|
|
|
|
|
|
reel_sequence_number => '01', |
|
19
|
|
|
|
|
|
|
institution_name => 'NAB', |
|
20
|
|
|
|
|
|
|
user_name => 'NAB TEST', |
|
21
|
|
|
|
|
|
|
user_number => 123456, |
|
22
|
|
|
|
|
|
|
description => 'DrDebit', |
|
23
|
|
|
|
|
|
|
process_date => DateTime->now, |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $line = $Record->to_record; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Class for descriptive record in the "Australian Direct Entry Payments and |
|
31
|
|
|
|
|
|
|
Dishonour report" |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut; |
|
34
|
|
|
|
|
|
|
|
|
35
|
4
|
|
|
4
|
|
1082146
|
use strict; |
|
|
4
|
|
|
|
|
14
|
|
|
|
4
|
|
|
|
|
189
|
|
|
36
|
4
|
|
|
4
|
|
28
|
use warnings; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
340
|
|
|
37
|
4
|
|
|
4
|
|
32
|
use feature qw/ signatures /; |
|
|
4
|
|
|
|
|
12
|
|
|
|
4
|
|
|
|
|
684
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
4
|
|
|
4
|
|
33
|
use Carp qw/ croak /; |
|
|
4
|
|
|
|
|
12
|
|
|
|
4
|
|
|
|
|
305
|
|
|
40
|
4
|
|
|
4
|
|
676
|
use Moose; |
|
|
4
|
|
|
|
|
599154
|
|
|
|
4
|
|
|
|
|
34
|
|
|
41
|
4
|
|
|
|
|
355
|
use Business::NAB::Types qw/ |
|
42
|
|
|
|
|
|
|
add_max_string_attribute |
|
43
|
4
|
|
|
4
|
|
40151
|
/; |
|
|
4
|
|
|
|
|
15
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
4
|
|
|
4
|
|
32
|
no warnings qw/ experimental::signatures /; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
2463
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=over |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item process_date (NAB::Type::Date, coerced from Str) |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item reel_sequence_number (Int, max 99) |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item institution_name (Str, max length 3) |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item user_name (Str, max length 26) |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item user_number (Str, max length 6) |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item description (Str, max length 12) |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=back |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has [ |
|
68
|
|
|
|
|
|
|
qw/ |
|
69
|
|
|
|
|
|
|
process_date |
|
70
|
|
|
|
|
|
|
/ |
|
71
|
|
|
|
|
|
|
] => ( |
|
72
|
|
|
|
|
|
|
is => 'ro', |
|
73
|
|
|
|
|
|
|
isa => 'NAB::Type::Date', |
|
74
|
|
|
|
|
|
|
required => 1, |
|
75
|
|
|
|
|
|
|
coerce => 1, |
|
76
|
|
|
|
|
|
|
); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
foreach my $str_attr ( |
|
79
|
|
|
|
|
|
|
'reel_sequence_number[2:trim_leading_zeros]', |
|
80
|
|
|
|
|
|
|
'institution_name[3]', |
|
81
|
|
|
|
|
|
|
'user_name[26]', |
|
82
|
|
|
|
|
|
|
'user_number[6]', |
|
83
|
|
|
|
|
|
|
'description[12]', |
|
84
|
|
|
|
|
|
|
) { |
|
85
|
|
|
|
|
|
|
__PACKAGE__->add_max_string_attribute( |
|
86
|
|
|
|
|
|
|
$str_attr, |
|
87
|
|
|
|
|
|
|
is => 'ro', |
|
88
|
|
|
|
|
|
|
required => 1, |
|
89
|
|
|
|
|
|
|
); |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _pack_template { |
|
93
|
10
|
|
|
10
|
|
82
|
return "A1 A17 A2 A3 A7 A26 A6 A12 A6 A40"; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
10
|
|
|
10
|
0
|
76
|
sub record_type { 0 } |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 METHODS |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 new_from_record |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Returns a new instance of the class with attributes populated from |
|
103
|
|
|
|
|
|
|
the result of parsing the passed line: |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
my $Record = Business::NAB::Australian::DirectEntry |
|
106
|
|
|
|
|
|
|
::Payments::DescriptiveRecord->new_from_record( $line ); |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
|
109
|
|
|
|
|
|
|
|
|
110
|
4
|
|
|
4
|
1
|
26177
|
sub new_from_record ( $class, $line ) { |
|
|
4
|
|
|
|
|
13
|
|
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
27
|
|
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# undef being "this space intentionally left blank" |
|
113
|
|
|
|
|
|
|
my ( |
|
114
|
4
|
|
|
|
|
75
|
$record_type, |
|
115
|
|
|
|
|
|
|
undef, |
|
116
|
|
|
|
|
|
|
$reel_sequence_number, |
|
117
|
|
|
|
|
|
|
$institution_name, |
|
118
|
|
|
|
|
|
|
undef, |
|
119
|
|
|
|
|
|
|
$user_name, |
|
120
|
|
|
|
|
|
|
$user_number, |
|
121
|
|
|
|
|
|
|
$description, |
|
122
|
|
|
|
|
|
|
$date, |
|
123
|
|
|
|
|
|
|
undef, |
|
124
|
|
|
|
|
|
|
) = unpack( $class->_pack_template(), $line ); |
|
125
|
|
|
|
|
|
|
|
|
126
|
4
|
100
|
|
|
|
35
|
if ( $record_type ne $class->record_type ) { |
|
127
|
1
|
|
|
|
|
26
|
croak( "unsupported record type ($record_type)" ); |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
3
|
|
|
|
|
262
|
return $class->new( |
|
131
|
|
|
|
|
|
|
reel_sequence_number => $reel_sequence_number, |
|
132
|
|
|
|
|
|
|
institution_name => $institution_name, |
|
133
|
|
|
|
|
|
|
user_name => $user_name, |
|
134
|
|
|
|
|
|
|
user_number => $user_number, |
|
135
|
|
|
|
|
|
|
description => $description, |
|
136
|
|
|
|
|
|
|
process_date => $date, |
|
137
|
|
|
|
|
|
|
); |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 to_record |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Returns a string constructed from the object's attributes, representing |
|
143
|
|
|
|
|
|
|
the record for use in a batch file: |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
my $line = $Record->to_record; |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |
|
148
|
|
|
|
|
|
|
|
|
149
|
6
|
|
|
6
|
1
|
109
|
sub to_record ( $self ) { |
|
|
6
|
|
|
|
|
18
|
|
|
|
6
|
|
|
|
|
13
|
|
|
150
|
|
|
|
|
|
|
|
|
151
|
6
|
|
|
|
|
40
|
my $record = pack( |
|
152
|
|
|
|
|
|
|
$self->_pack_template(), |
|
153
|
|
|
|
|
|
|
$self->record_type, |
|
154
|
|
|
|
|
|
|
"", |
|
155
|
|
|
|
|
|
|
sprintf( "%02s", $self->reel_sequence_number ), |
|
156
|
|
|
|
|
|
|
$self->institution_name, |
|
157
|
|
|
|
|
|
|
"", |
|
158
|
|
|
|
|
|
|
$self->user_name, |
|
159
|
|
|
|
|
|
|
sprintf( "%06s", $self->user_number ), |
|
160
|
|
|
|
|
|
|
$self->description, |
|
161
|
|
|
|
|
|
|
$self->process_date->strftime( '%d%m%y' ), |
|
162
|
|
|
|
|
|
|
"", |
|
163
|
|
|
|
|
|
|
); |
|
164
|
|
|
|
|
|
|
|
|
165
|
6
|
|
|
|
|
706
|
return $record; |
|
166
|
|
|
|
|
|
|
} |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
L<Business::NAB::Types> |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |