| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Business::NAB::Australian::DirectEntry::Payments::DetailRecord; |
|
2
|
|
|
|
|
|
|
$Business::NAB::Australian::DirectEntry::Payments::DetailRecord::VERSION = '0.03'; |
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::NAB::Australian::DirectEntry::Payments::DetailRecord |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Business::NAB::Australian::DirectEntry::Payments::DetailRecord; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# parse |
|
12
|
|
|
|
|
|
|
my $Record = Business::NAB::Australian::DirectEntry |
|
13
|
|
|
|
|
|
|
::Payments::DetailRecord->new_from_record( $line ); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# create |
|
16
|
|
|
|
|
|
|
my $Record = Business::NAB::Australian::DirectEntry |
|
17
|
|
|
|
|
|
|
::Payments::DetailRecord->new( |
|
18
|
|
|
|
|
|
|
bsb_number => '083-047', |
|
19
|
|
|
|
|
|
|
account_number => '111111111', |
|
20
|
|
|
|
|
|
|
transaction_code => '13', |
|
21
|
|
|
|
|
|
|
amount => 1, |
|
22
|
|
|
|
|
|
|
title_of_account => ' Beneficiary 1', |
|
23
|
|
|
|
|
|
|
lodgement_reference => 'FOR DEMONSTRATION', |
|
24
|
|
|
|
|
|
|
bsb_number_trace => '083-047', |
|
25
|
|
|
|
|
|
|
account_number_trace => '123456789', |
|
26
|
|
|
|
|
|
|
remitter_name => 'NAB SAMPLE TEST', |
|
27
|
|
|
|
|
|
|
withholding_tax => '00000000', |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $line = $Record->to_record; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Class for detail record in the "Australian Direct Entry Payments and |
|
35
|
|
|
|
|
|
|
Dishonour report" |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut; |
|
38
|
|
|
|
|
|
|
|
|
39
|
4
|
|
|
4
|
|
1168630
|
use strict; |
|
|
4
|
|
|
|
|
12
|
|
|
|
4
|
|
|
|
|
178
|
|
|
40
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
327
|
|
|
41
|
4
|
|
|
4
|
|
32
|
use feature qw/ signatures /; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
575
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
4
|
|
|
4
|
|
28
|
use Carp qw/ croak /; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
301
|
|
|
44
|
4
|
|
|
4
|
|
2348
|
use Moose; |
|
|
4
|
|
|
|
|
567920
|
|
|
|
4
|
|
|
|
|
36
|
|
|
45
|
4
|
|
|
|
|
421
|
use Business::NAB::Types qw/ |
|
46
|
|
|
|
|
|
|
add_max_string_attribute |
|
47
|
4
|
|
|
4
|
|
39823
|
/; |
|
|
4
|
|
|
|
|
14
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
4
|
|
|
4
|
|
36
|
no warnings qw/ experimental::signatures /; |
|
|
4
|
|
|
|
|
12
|
|
|
|
4
|
|
|
|
|
3918
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=over |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item bsb_number (NAB::Type::BSBNumber) |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item bsb_number_trace (NAB::Type::BSBNumber) |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item account_number (NAB::Type::AccountNumber) |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item account_number_trace (NAB::Type::AccountNumber) |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item indicator (NAB::Type::Indicator) |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item amount (NAB::Type::PositiveInt) |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item withholding_tax (NAB::Type::PositiveIntOrZero) |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item transaction_code (Str, max length 2) |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item title_of_account (Str, max length 32) |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item lodgement_reference (Str, max length 18) |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item remitter_name (Str, max length 16) |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=back |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
has [ qw/ bsb_number bsb_number_trace / ] => ( |
|
82
|
|
|
|
|
|
|
is => 'ro', |
|
83
|
|
|
|
|
|
|
isa => 'NAB::Type::BSBNumber', |
|
84
|
|
|
|
|
|
|
required => 1, |
|
85
|
|
|
|
|
|
|
coerce => 1, |
|
86
|
|
|
|
|
|
|
); |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
has [ qw/ account_number account_number_trace / ] => ( |
|
89
|
|
|
|
|
|
|
is => 'ro', |
|
90
|
|
|
|
|
|
|
isa => 'NAB::Type::AccountNumber', |
|
91
|
|
|
|
|
|
|
required => 1, |
|
92
|
|
|
|
|
|
|
); |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
has [ qw/ indicator / ] => ( |
|
95
|
|
|
|
|
|
|
is => 'ro', |
|
96
|
|
|
|
|
|
|
isa => 'NAB::Type::Indicator', |
|
97
|
|
|
|
|
|
|
required => 0, |
|
98
|
|
|
|
|
|
|
default => sub { ' ' }, |
|
99
|
|
|
|
|
|
|
); |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
has [ qw/ amount / ] => ( |
|
102
|
|
|
|
|
|
|
is => 'ro', |
|
103
|
|
|
|
|
|
|
isa => 'NAB::Type::PositiveInt', |
|
104
|
|
|
|
|
|
|
required => 1, |
|
105
|
|
|
|
|
|
|
); |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
has [ qw/ withholding_tax / ] => ( |
|
108
|
|
|
|
|
|
|
is => 'ro', |
|
109
|
|
|
|
|
|
|
isa => 'NAB::Type::PositiveIntOrZero', |
|
110
|
|
|
|
|
|
|
required => 0, |
|
111
|
|
|
|
|
|
|
); |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
foreach my $str_attr ( |
|
114
|
|
|
|
|
|
|
'transaction_code[2]', |
|
115
|
|
|
|
|
|
|
'title_of_account[32]', |
|
116
|
|
|
|
|
|
|
'lodgement_reference[18]', |
|
117
|
|
|
|
|
|
|
'remitter_name[16]', |
|
118
|
|
|
|
|
|
|
) { |
|
119
|
|
|
|
|
|
|
__PACKAGE__->add_max_string_attribute( |
|
120
|
|
|
|
|
|
|
$str_attr, |
|
121
|
|
|
|
|
|
|
is => 'ro', |
|
122
|
|
|
|
|
|
|
required => $str_attr =~ /original/ ? 0 : 1, |
|
123
|
|
|
|
|
|
|
); |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub _pack_template { |
|
127
|
32
|
|
|
32
|
|
148
|
return "A1 A7 A9 A1 A2 A10 A32 A18 A7 A9 A16 A8"; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
101
|
|
|
101
|
0
|
3693
|
sub record_type { 1 } |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 METHODS |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 new_from_record |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Returns a new instance of the class with attributes populated from |
|
137
|
|
|
|
|
|
|
the result of parsing the passed line: |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
my $Record = Business::NAB::Australian::DirectEntry |
|
140
|
|
|
|
|
|
|
::Payments::DescriptiveRecord->new_from_record( $line ); |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |
|
143
|
|
|
|
|
|
|
|
|
144
|
22
|
|
|
22
|
1
|
25957
|
sub new_from_record ( $class, $line ) { |
|
|
22
|
|
|
|
|
51
|
|
|
|
22
|
|
|
|
|
43
|
|
|
|
22
|
|
|
|
|
39
|
|
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
# undef being "this space intentionally left blank" |
|
147
|
|
|
|
|
|
|
my ( |
|
148
|
22
|
|
|
|
|
95
|
$record_type, |
|
149
|
|
|
|
|
|
|
$bsb_number, |
|
150
|
|
|
|
|
|
|
$account_number, |
|
151
|
|
|
|
|
|
|
$indicator, |
|
152
|
|
|
|
|
|
|
$transaction_code, |
|
153
|
|
|
|
|
|
|
$amount, |
|
154
|
|
|
|
|
|
|
$title_of_account, |
|
155
|
|
|
|
|
|
|
$lodgement_reference, |
|
156
|
|
|
|
|
|
|
$bsb_number_trace, |
|
157
|
|
|
|
|
|
|
$account_number_trace, |
|
158
|
|
|
|
|
|
|
$remitter_name, |
|
159
|
|
|
|
|
|
|
$withholding_tax, |
|
160
|
|
|
|
|
|
|
$rest, |
|
161
|
|
|
|
|
|
|
) = unpack( $class->_pack_template(), $line ); |
|
162
|
|
|
|
|
|
|
|
|
163
|
22
|
|
|
|
|
66
|
my ( $return_code, $orig_day, $orig_user_id ); |
|
164
|
|
|
|
|
|
|
|
|
165
|
22
|
100
|
|
|
|
84
|
if ( $record_type ne $class->record_type ) { |
|
166
|
1
|
|
|
|
|
26
|
croak( "unsupported record type ($record_type)" ); |
|
167
|
|
|
|
|
|
|
} |
|
168
|
|
|
|
|
|
|
|
|
169
|
21
|
100
|
|
|
|
68
|
if ( $class->record_type eq '1' ) { |
|
|
|
50
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
# payments descriptive record |
|
172
|
|
|
|
|
|
|
} elsif ( $class->record_type eq '2' ) { |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
# returns descriptive record |
|
175
|
14
|
|
|
|
|
32
|
$return_code = $indicator; |
|
176
|
14
|
|
|
|
|
32
|
$orig_day = $withholding_tax; |
|
177
|
14
|
|
|
|
|
36
|
$orig_user_id = $rest; |
|
178
|
|
|
|
|
|
|
} |
|
179
|
|
|
|
|
|
|
|
|
180
|
21
|
100
|
50
|
|
|
83
|
return $class->new( |
|
|
|
100
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
bsb_number => $bsb_number, |
|
182
|
|
|
|
|
|
|
account_number => $account_number, |
|
183
|
|
|
|
|
|
|
transaction_code => $transaction_code, |
|
184
|
|
|
|
|
|
|
amount => $amount, |
|
185
|
|
|
|
|
|
|
title_of_account => $title_of_account, |
|
186
|
|
|
|
|
|
|
lodgement_reference => $lodgement_reference, |
|
187
|
|
|
|
|
|
|
bsb_number_trace => $bsb_number_trace, |
|
188
|
|
|
|
|
|
|
account_number_trace => $account_number_trace, |
|
189
|
|
|
|
|
|
|
remitter_name => $remitter_name, |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
( |
|
192
|
|
|
|
|
|
|
$class->record_type eq '1' |
|
193
|
|
|
|
|
|
|
? ( |
|
194
|
|
|
|
|
|
|
indicator => $indicator || ' ', |
|
195
|
|
|
|
|
|
|
withholding_tax => $withholding_tax, |
|
196
|
|
|
|
|
|
|
) |
|
197
|
|
|
|
|
|
|
: () |
|
198
|
|
|
|
|
|
|
), |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
( |
|
201
|
|
|
|
|
|
|
$class->record_type eq '2' |
|
202
|
|
|
|
|
|
|
? ( |
|
203
|
|
|
|
|
|
|
return_code => $return_code, |
|
204
|
|
|
|
|
|
|
original_day_of_processing => $orig_day, |
|
205
|
|
|
|
|
|
|
original_user_id_number => $orig_user_id, |
|
206
|
|
|
|
|
|
|
) |
|
207
|
|
|
|
|
|
|
: () |
|
208
|
|
|
|
|
|
|
), |
|
209
|
|
|
|
|
|
|
); |
|
210
|
|
|
|
|
|
|
} |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head2 to_record |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Returns a string constructed from the object's attributes, representing |
|
215
|
|
|
|
|
|
|
the record for use in a batch file: |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
my $line = $Record->to_record; |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=cut |
|
220
|
|
|
|
|
|
|
|
|
221
|
38
|
|
|
38
|
1
|
141
|
sub to_record ( $self ) { |
|
|
38
|
|
|
|
|
67
|
|
|
|
38
|
|
|
|
|
81
|
|
|
222
|
|
|
|
|
|
|
|
|
223
|
38
|
100
|
|
|
|
141
|
my $record = pack( |
|
|
|
100
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
$self->_pack_template(), |
|
225
|
|
|
|
|
|
|
$self->record_type, |
|
226
|
|
|
|
|
|
|
$self->bsb_number, |
|
227
|
|
|
|
|
|
|
$self->account_number, |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
$self->record_type eq '1' |
|
230
|
|
|
|
|
|
|
? $self->indicator |
|
231
|
|
|
|
|
|
|
: $self->return_code, |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
$self->transaction_code, |
|
234
|
|
|
|
|
|
|
sprintf( "%010s", $self->amount ), |
|
235
|
|
|
|
|
|
|
$self->title_of_account, |
|
236
|
|
|
|
|
|
|
$self->lodgement_reference, |
|
237
|
|
|
|
|
|
|
$self->bsb_number_trace, |
|
238
|
|
|
|
|
|
|
$self->account_number_trace, |
|
239
|
|
|
|
|
|
|
$self->remitter_name, |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
$self->record_type eq '1' |
|
242
|
|
|
|
|
|
|
? ( $self->withholding_tax ) |
|
243
|
|
|
|
|
|
|
: ( |
|
244
|
|
|
|
|
|
|
$self->original_day_of_processing, |
|
245
|
|
|
|
|
|
|
$self->original_user_id_number, |
|
246
|
|
|
|
|
|
|
), |
|
247
|
|
|
|
|
|
|
); |
|
248
|
|
|
|
|
|
|
|
|
249
|
38
|
|
|
|
|
456
|
return $record; |
|
250
|
|
|
|
|
|
|
} |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head2 is_debit |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head2 is_credit |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
Boolean check on the transaction type |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
if ( $Record->is_credit ) { |
|
259
|
|
|
|
|
|
|
... |
|
260
|
|
|
|
|
|
|
} |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=cut |
|
263
|
|
|
|
|
|
|
|
|
264
|
38
|
|
|
38
|
1
|
60
|
sub is_credit ( $self ) { |
|
|
38
|
|
|
|
|
58
|
|
|
|
38
|
|
|
|
|
50
|
|
|
265
|
38
|
|
|
|
|
79
|
return !$self->is_debit; |
|
266
|
|
|
|
|
|
|
} |
|
267
|
|
|
|
|
|
|
|
|
268
|
76
|
|
|
76
|
1
|
106
|
sub is_debit ( $self ) { |
|
|
76
|
|
|
|
|
114
|
|
|
|
76
|
|
|
|
|
121
|
|
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
# there's only one debit transaction type code so |
|
271
|
|
|
|
|
|
|
# this is pretty straightforward |
|
272
|
76
|
100
|
|
|
|
152
|
return $self->transaction_code eq '13' ? 1 : 0; |
|
273
|
|
|
|
|
|
|
} |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
L<Business::NAB::Types> |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=cut |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |