| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Business::NAB::BPAY::Payments::DetailRecord; |
|
2
|
|
|
|
|
|
|
$Business::NAB::BPAY::Payments::DetailRecord::VERSION = '0.03'; |
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::NAB::BPAY::Payments::DetailRecord |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Business::NAB::BPAY::Payments::DetailRecord; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# parse |
|
12
|
|
|
|
|
|
|
my $Detail = Business::NAB::BPAY::Payments::DetailRecord; |
|
13
|
|
|
|
|
|
|
->new_from_record( $line ); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# create |
|
16
|
|
|
|
|
|
|
my $Detail = Business::NAB::BPAY::Payments::DetailRecord->new( |
|
17
|
|
|
|
|
|
|
biller_code => $biller_code, |
|
18
|
|
|
|
|
|
|
payment_account_bsb => $payment_account_bsb, |
|
19
|
|
|
|
|
|
|
payment_account_number => $payment_account_number, |
|
20
|
|
|
|
|
|
|
customer_reference_number => $customer_reference_number, |
|
21
|
|
|
|
|
|
|
amount => $amount, |
|
22
|
|
|
|
|
|
|
lodgement_reference_1 => $lodgement_reference_1, |
|
23
|
|
|
|
|
|
|
lodgement_reference_2 => $lodgement_reference_2, |
|
24
|
|
|
|
|
|
|
lodgement_reference_3 => $lodgement_reference_3, |
|
25
|
|
|
|
|
|
|
); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $line = $Detail->to_record; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Class for detail record in the "BPAY Batch User Guide" |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut; |
|
34
|
|
|
|
|
|
|
|
|
35
|
5
|
|
|
5
|
|
949709
|
use strict; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
243
|
|
|
36
|
5
|
|
|
5
|
|
31
|
use warnings; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
348
|
|
|
37
|
5
|
|
|
5
|
|
35
|
use feature qw/ signatures /; |
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
662
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
5
|
|
|
5
|
|
95
|
use Carp qw/ croak /; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
397
|
|
|
40
|
5
|
|
|
5
|
|
578
|
use Moose; |
|
|
5
|
|
|
|
|
468777
|
|
|
|
5
|
|
|
|
|
43
|
|
|
41
|
5
|
|
|
|
|
491
|
use Business::NAB::Types qw/ |
|
42
|
|
|
|
|
|
|
add_max_string_attribute |
|
43
|
5
|
|
|
5
|
|
46403
|
/; |
|
|
5
|
|
|
|
|
18
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
5
|
|
|
5
|
|
41
|
no warnings qw/ experimental::signatures /; |
|
|
5
|
|
|
|
|
13
|
|
|
|
5
|
|
|
|
|
3471
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=over |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item biller_code (Str, max length 10) |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item payment_account_bsb (NAB::Type::BSBNumberNoDash) |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item payment_account_number (NAB::Type::AccountNumber) |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item customer_reference_number (Str, max length 20) |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item amount (NAB::Type::PositiveInt) |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item lodgement_reference_1 (Str, max length 10, optional) |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item lodgement_reference_2 (Str, max length 20, optional) |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item lodgement_reference_3 (Str, max length 50, optional) |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=back |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
has [ qw/ payment_account_bsb / ] => ( |
|
72
|
|
|
|
|
|
|
is => 'ro', |
|
73
|
|
|
|
|
|
|
isa => 'NAB::Type::BSBNumberNoDash', |
|
74
|
|
|
|
|
|
|
required => 1, |
|
75
|
|
|
|
|
|
|
coerce => 1, |
|
76
|
|
|
|
|
|
|
); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
has [ qw/ payment_account_number / ] => ( |
|
79
|
|
|
|
|
|
|
is => 'ro', |
|
80
|
|
|
|
|
|
|
isa => 'NAB::Type::AccountNumber', |
|
81
|
|
|
|
|
|
|
required => 1, |
|
82
|
|
|
|
|
|
|
); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
has [ qw/ amount / ] => ( |
|
85
|
|
|
|
|
|
|
is => 'ro', |
|
86
|
|
|
|
|
|
|
isa => 'NAB::Type::PositiveInt', |
|
87
|
|
|
|
|
|
|
required => 1, |
|
88
|
|
|
|
|
|
|
); |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
foreach my $str_attr ( |
|
91
|
|
|
|
|
|
|
'biller_code[10]', |
|
92
|
|
|
|
|
|
|
'customer_reference_number[20]', |
|
93
|
|
|
|
|
|
|
) { |
|
94
|
|
|
|
|
|
|
__PACKAGE__->add_max_string_attribute( |
|
95
|
|
|
|
|
|
|
$str_attr, |
|
96
|
|
|
|
|
|
|
is => 'ro', |
|
97
|
|
|
|
|
|
|
required => 1, |
|
98
|
|
|
|
|
|
|
); |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
foreach my $str_attr ( |
|
102
|
|
|
|
|
|
|
'lodgement_reference_1[10]', |
|
103
|
|
|
|
|
|
|
'lodgement_reference_2[20]', |
|
104
|
|
|
|
|
|
|
'lodgement_reference_3[50]', |
|
105
|
|
|
|
|
|
|
) { |
|
106
|
|
|
|
|
|
|
__PACKAGE__->add_max_string_attribute( |
|
107
|
|
|
|
|
|
|
$str_attr, |
|
108
|
|
|
|
|
|
|
is => 'ro', |
|
109
|
|
|
|
|
|
|
required => 0, |
|
110
|
|
|
|
|
|
|
); |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub _pack_template { |
|
114
|
23
|
|
|
23
|
|
125
|
return "A1 A10 A6 A9 A20 A13 A10 A20 A50 A5"; |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 METHODS |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 new_from_record |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Returns a new instance of the class with attributes populated from |
|
122
|
|
|
|
|
|
|
the result of parsing the passed line: |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
my $Record = Business::NAB::BPAY::Payments::DetailRecord |
|
125
|
|
|
|
|
|
|
->new_from_record( $line ); |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |
|
128
|
|
|
|
|
|
|
|
|
129
|
7
|
|
|
7
|
1
|
17963
|
sub new_from_record ( $class, $line ) { |
|
|
7
|
|
|
|
|
15
|
|
|
|
7
|
|
|
|
|
13
|
|
|
|
7
|
|
|
|
|
12
|
|
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
# undef being "this space intentionally left blank" |
|
132
|
|
|
|
|
|
|
my ( |
|
133
|
7
|
|
|
|
|
31
|
$record_type, |
|
134
|
|
|
|
|
|
|
$biller_code, |
|
135
|
|
|
|
|
|
|
$payment_account_bsb, |
|
136
|
|
|
|
|
|
|
$payment_account_number, |
|
137
|
|
|
|
|
|
|
$customer_reference_number, |
|
138
|
|
|
|
|
|
|
$amount, |
|
139
|
|
|
|
|
|
|
$lodgement_reference_1, |
|
140
|
|
|
|
|
|
|
$lodgement_reference_2, |
|
141
|
|
|
|
|
|
|
$lodgement_reference_3, |
|
142
|
|
|
|
|
|
|
undef, |
|
143
|
|
|
|
|
|
|
) = unpack( $class->_pack_template(), $line ); |
|
144
|
|
|
|
|
|
|
|
|
145
|
7
|
100
|
|
|
|
40
|
if ( $record_type ne '2' ) { |
|
146
|
1
|
|
|
|
|
20
|
croak( "unsupported record type ($record_type)" ); |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
6
|
|
|
|
|
31
|
$biller_code =~ s/^0+//; |
|
150
|
6
|
|
|
|
|
20
|
$amount =~ s/^0+//; |
|
151
|
|
|
|
|
|
|
|
|
152
|
6
|
|
|
|
|
372
|
return $class->new( |
|
153
|
|
|
|
|
|
|
biller_code => $biller_code, |
|
154
|
|
|
|
|
|
|
payment_account_bsb => $payment_account_bsb, |
|
155
|
|
|
|
|
|
|
payment_account_number => $payment_account_number, |
|
156
|
|
|
|
|
|
|
customer_reference_number => $customer_reference_number, |
|
157
|
|
|
|
|
|
|
amount => $amount, |
|
158
|
|
|
|
|
|
|
lodgement_reference_1 => $lodgement_reference_1, |
|
159
|
|
|
|
|
|
|
lodgement_reference_2 => $lodgement_reference_2, |
|
160
|
|
|
|
|
|
|
lodgement_reference_3 => $lodgement_reference_3, |
|
161
|
|
|
|
|
|
|
); |
|
162
|
|
|
|
|
|
|
} |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 to_record |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Returns a string constructed from the object's attributes, representing |
|
167
|
|
|
|
|
|
|
the record for use in a batch file: |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
my $line = $Detail->to_record; |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=cut |
|
172
|
|
|
|
|
|
|
|
|
173
|
16
|
|
|
16
|
1
|
65
|
sub to_record ( $self ) { |
|
|
16
|
|
|
|
|
36
|
|
|
|
16
|
|
|
|
|
27
|
|
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
# remove the - char (well, any non-digits). the various specs are |
|
176
|
|
|
|
|
|
|
# a bit all over the place, some keep this char and some don't |
|
177
|
16
|
|
|
|
|
878
|
my $bsb = $self->payment_account_bsb =~ s/\D//gr; |
|
178
|
|
|
|
|
|
|
|
|
179
|
16
|
|
50
|
|
|
52
|
my $record = pack( |
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
180
|
|
|
|
|
|
|
$self->_pack_template(), |
|
181
|
|
|
|
|
|
|
"2", |
|
182
|
|
|
|
|
|
|
sprintf( "%010s", $self->biller_code ), |
|
183
|
|
|
|
|
|
|
$bsb, |
|
184
|
|
|
|
|
|
|
$self->payment_account_number, |
|
185
|
|
|
|
|
|
|
$self->customer_reference_number, |
|
186
|
|
|
|
|
|
|
sprintf( "%013s", $self->amount ), |
|
187
|
|
|
|
|
|
|
$self->lodgement_reference_1 // '', |
|
188
|
|
|
|
|
|
|
$self->lodgement_reference_2 // '', |
|
189
|
|
|
|
|
|
|
$self->lodgement_reference_3 // '', |
|
190
|
|
|
|
|
|
|
); |
|
191
|
|
|
|
|
|
|
|
|
192
|
16
|
|
|
|
|
579
|
return $record; |
|
193
|
|
|
|
|
|
|
} |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
L<Business::NAB::Types> |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=cut |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |