| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Business::NAB::BPAY::Payments::HeaderRecord; |
|
2
|
|
|
|
|
|
|
$Business::NAB::BPAY::Payments::HeaderRecord::VERSION = '0.03'; |
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::NAB::BPAY::Payments::HeaderRecord |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Business::NAB::BPAY::Payments::HeaderRecord; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# parse |
|
12
|
|
|
|
|
|
|
my $Header = Business::NAB::BPAY::Payments::HeaderRecord |
|
13
|
|
|
|
|
|
|
->new_from_record( $line ); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# create |
|
16
|
|
|
|
|
|
|
my $Header = Business::NAB::BPAY::Payments::HeaderRecord->new( |
|
17
|
|
|
|
|
|
|
bpay_batch_user_id => '01', |
|
18
|
|
|
|
|
|
|
customer_short_name => 'NAB', |
|
19
|
|
|
|
|
|
|
processing_date => DateTime->now, |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $line = $Header->to_record; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Class for header record in the "BPAY Batch User Guide" |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut; |
|
29
|
|
|
|
|
|
|
|
|
30
|
5
|
|
|
5
|
|
960333
|
use strict; |
|
|
5
|
|
|
|
|
13
|
|
|
|
5
|
|
|
|
|
243
|
|
|
31
|
5
|
|
|
5
|
|
33
|
use warnings; |
|
|
5
|
|
|
|
|
34
|
|
|
|
5
|
|
|
|
|
372
|
|
|
32
|
5
|
|
|
5
|
|
40
|
use feature qw/ signatures /; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
814
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
5
|
|
|
5
|
|
38
|
use Carp qw/ croak /; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
402
|
|
|
35
|
5
|
|
|
5
|
|
538
|
use Moose; |
|
|
5
|
|
|
|
|
450694
|
|
|
|
5
|
|
|
|
|
44
|
|
|
36
|
5
|
|
|
|
|
509
|
use Business::NAB::Types qw/ |
|
37
|
|
|
|
|
|
|
add_max_string_attribute |
|
38
|
5
|
|
|
5
|
|
46528
|
/; |
|
|
5
|
|
|
|
|
20
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
5
|
|
|
5
|
|
44
|
no warnings qw/ experimental::signatures /; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
2451
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=over |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item bpay_batch_user_id (Str, max length 16) |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item processing_date (NAB::Type::StatementDate, coerced from Str) |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item customer_short_name (Str, max length 20) |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=back |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has [ |
|
57
|
|
|
|
|
|
|
qw/ |
|
58
|
|
|
|
|
|
|
processing_date |
|
59
|
|
|
|
|
|
|
/ |
|
60
|
|
|
|
|
|
|
] => ( |
|
61
|
|
|
|
|
|
|
is => 'ro', |
|
62
|
|
|
|
|
|
|
isa => 'NAB::Type::StatementDate', |
|
63
|
|
|
|
|
|
|
required => 1, |
|
64
|
|
|
|
|
|
|
coerce => 1, |
|
65
|
|
|
|
|
|
|
); |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
foreach my $str_attr ( |
|
68
|
|
|
|
|
|
|
'bpay_batch_user_id[16]', |
|
69
|
|
|
|
|
|
|
'customer_short_name[20]', |
|
70
|
|
|
|
|
|
|
) { |
|
71
|
|
|
|
|
|
|
__PACKAGE__->add_max_string_attribute( |
|
72
|
|
|
|
|
|
|
$str_attr, |
|
73
|
|
|
|
|
|
|
is => 'ro', |
|
74
|
|
|
|
|
|
|
required => 1, |
|
75
|
|
|
|
|
|
|
); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub _pack_template { |
|
79
|
14
|
|
|
14
|
|
145
|
return "A1 A16 A20 A8 A99"; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 METHODS |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 new_from_record |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Returns a new instance of the class with attributes populated from |
|
87
|
|
|
|
|
|
|
the result of parsing the passed line: |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
my $Record = Business::NAB::BPAY::Payments::HeaderRecord |
|
90
|
|
|
|
|
|
|
->new_from_record( $line ); |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
|
93
|
|
|
|
|
|
|
|
|
94
|
6
|
|
|
6
|
1
|
19550
|
sub new_from_record ( $class, $line ) { |
|
|
6
|
|
|
|
|
17
|
|
|
|
6
|
|
|
|
|
23
|
|
|
|
6
|
|
|
|
|
13
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# undef being "this space intentionally left blank" |
|
97
|
|
|
|
|
|
|
my ( |
|
98
|
6
|
|
|
|
|
57
|
$record_type, |
|
99
|
|
|
|
|
|
|
$bpay_batch_user_id, |
|
100
|
|
|
|
|
|
|
$customer_short_name, |
|
101
|
|
|
|
|
|
|
$processing_date, |
|
102
|
|
|
|
|
|
|
undef, |
|
103
|
|
|
|
|
|
|
) = unpack( $class->_pack_template(), $line ); |
|
104
|
|
|
|
|
|
|
|
|
105
|
6
|
100
|
|
|
|
31
|
if ( $record_type ne '1' ) { |
|
106
|
2
|
|
|
|
|
48
|
croak( "unsupported record type ($record_type)" ); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
4
|
|
|
|
|
220
|
return $class->new( |
|
110
|
|
|
|
|
|
|
bpay_batch_user_id => $bpay_batch_user_id, |
|
111
|
|
|
|
|
|
|
customer_short_name => $customer_short_name, |
|
112
|
|
|
|
|
|
|
processing_date => $processing_date, |
|
113
|
|
|
|
|
|
|
); |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 to_record |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Returns a string constructed from the object's attributes, representing |
|
119
|
|
|
|
|
|
|
the record for use in a batch file: |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
my $line = $Header->to_record; |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
|
124
|
|
|
|
|
|
|
|
|
125
|
8
|
|
|
8
|
1
|
118
|
sub to_record ( $self ) { |
|
|
8
|
|
|
|
|
19
|
|
|
|
8
|
|
|
|
|
16
|
|
|
126
|
|
|
|
|
|
|
|
|
127
|
8
|
|
|
|
|
38
|
my $record = pack( |
|
128
|
|
|
|
|
|
|
$self->_pack_template(), |
|
129
|
|
|
|
|
|
|
"1", |
|
130
|
|
|
|
|
|
|
$self->bpay_batch_user_id, |
|
131
|
|
|
|
|
|
|
$self->customer_short_name, |
|
132
|
|
|
|
|
|
|
$self->processing_date->strftime( '%Y%m%d' ), |
|
133
|
|
|
|
|
|
|
"", |
|
134
|
|
|
|
|
|
|
); |
|
135
|
|
|
|
|
|
|
|
|
136
|
8
|
|
|
|
|
937
|
return $record; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
L<Business::NAB::Types> |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |