| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Business::NAB::BPAY::Payments::Results::DetailRecord; |
|
2
|
|
|
|
|
|
|
$Business::NAB::BPAY::Payments::Results::DetailRecord::VERSION = '0.03'; |
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::NAB::BPAY::Payments::Results::DetailRecord |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Business::NAB::BPAY::Payments::Results::DetailRecord; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# parse |
|
12
|
|
|
|
|
|
|
my $Detail = Business::NAB::BPAY::Payments::Results::DetailRecord; |
|
13
|
|
|
|
|
|
|
->new_from_record( $line ); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# create |
|
16
|
|
|
|
|
|
|
my $Detail = Business::NAB::BPAY::Payments::Results::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
|
|
|
|
|
|
|
return_code => $return_code, |
|
26
|
|
|
|
|
|
|
return_code_desc => $return_code_desc, |
|
27
|
|
|
|
|
|
|
transaction_reference_number => $transaction_reference_number, |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $line = $Detail->to_record; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Class for detail record in the "BPAY Batch User Guide" responses |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
All methods and attributes are inherited from |
|
37
|
|
|
|
|
|
|
L<Business::NAB::BPAY::Payments::DetailRecord> |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
|
40
|
|
|
|
|
|
|
|
|
41
|
2
|
|
|
2
|
|
1044567
|
use strict; |
|
|
2
|
|
|
|
|
85
|
|
|
|
2
|
|
|
|
|
98
|
|
|
42
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
206
|
|
|
43
|
2
|
|
|
2
|
|
14
|
use feature qw/ signatures /; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
352
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
2
|
|
|
2
|
|
753
|
use Moose; |
|
|
2
|
|
|
|
|
644940
|
|
|
|
2
|
|
|
|
|
24
|
|
|
46
|
|
|
|
|
|
|
extends 'Business::NAB::BPAY::Payments::DetailRecord'; |
|
47
|
|
|
|
|
|
|
|
|
48
|
2
|
|
|
2
|
|
21302
|
use Carp qw/ croak /; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
173
|
|
|
49
|
2
|
|
|
2
|
|
17
|
no warnings qw/ experimental::signatures /; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
1677
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Additional attributes are inherited from |
|
54
|
|
|
|
|
|
|
L<Business::NAB::BPAY::Payments::DetailRecord> |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=over |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item return_code (Str, max length 4) |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item return_code_desc (Str, max length 50) |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item transaction_reference_number (Str, max length 21) |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=back |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
foreach my $str_attr ( |
|
69
|
|
|
|
|
|
|
'return_code[4]', |
|
70
|
|
|
|
|
|
|
'return_code_desc[50]', |
|
71
|
|
|
|
|
|
|
'transaction_reference_number[21]', |
|
72
|
|
|
|
|
|
|
) { |
|
73
|
|
|
|
|
|
|
__PACKAGE__->add_max_string_attribute( |
|
74
|
|
|
|
|
|
|
$str_attr, |
|
75
|
|
|
|
|
|
|
is => 'ro', |
|
76
|
|
|
|
|
|
|
required => 0, |
|
77
|
|
|
|
|
|
|
); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub _pack_template { |
|
81
|
23
|
|
|
23
|
|
113
|
return "A1 A10 A6 A9 A20 A13 A10 A20 A50 A4 A50 A21"; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 METHODS |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
See L<Business::NAB::BPAY::Payments::DetailRecord> for details of |
|
87
|
|
|
|
|
|
|
C<new_from_record> and C<to_record> |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
|
90
|
|
|
|
|
|
|
|
|
91
|
7
|
|
|
7
|
1
|
3823
|
sub new_from_record ( $class, $line ) { |
|
|
7
|
|
|
|
|
14
|
|
|
|
7
|
|
|
|
|
16
|
|
|
|
7
|
|
|
|
|
10
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# undef being "this space intentionally left blank" |
|
94
|
|
|
|
|
|
|
my ( |
|
95
|
7
|
|
|
|
|
23
|
$record_type, |
|
96
|
|
|
|
|
|
|
$biller_code, |
|
97
|
|
|
|
|
|
|
$payment_account_bsb, |
|
98
|
|
|
|
|
|
|
$payment_account_number, |
|
99
|
|
|
|
|
|
|
$customer_reference_number, |
|
100
|
|
|
|
|
|
|
$amount, |
|
101
|
|
|
|
|
|
|
$lodgement_reference_1, |
|
102
|
|
|
|
|
|
|
$lodgement_reference_2, |
|
103
|
|
|
|
|
|
|
$lodgement_reference_3, |
|
104
|
|
|
|
|
|
|
$return_code, |
|
105
|
|
|
|
|
|
|
$return_code_desc, |
|
106
|
|
|
|
|
|
|
$trans_ref_number, |
|
107
|
|
|
|
|
|
|
) = unpack( $class->_pack_template(), $line ); |
|
108
|
|
|
|
|
|
|
|
|
109
|
7
|
100
|
|
|
|
25
|
if ( $record_type ne '2' ) { |
|
110
|
1
|
|
|
|
|
23
|
croak( "unsupported record type ($record_type)" ); |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
6
|
|
|
|
|
25
|
$biller_code =~ s/^0+//; |
|
114
|
6
|
|
|
|
|
17
|
$amount =~ s/^0+//; |
|
115
|
|
|
|
|
|
|
|
|
116
|
6
|
|
|
|
|
232
|
return $class->new( |
|
117
|
|
|
|
|
|
|
biller_code => $biller_code, |
|
118
|
|
|
|
|
|
|
payment_account_bsb => $payment_account_bsb, |
|
119
|
|
|
|
|
|
|
payment_account_number => $payment_account_number, |
|
120
|
|
|
|
|
|
|
customer_reference_number => $customer_reference_number, |
|
121
|
|
|
|
|
|
|
amount => $amount, |
|
122
|
|
|
|
|
|
|
lodgement_reference_1 => $lodgement_reference_1, |
|
123
|
|
|
|
|
|
|
lodgement_reference_2 => $lodgement_reference_2, |
|
124
|
|
|
|
|
|
|
lodgement_reference_3 => $lodgement_reference_3, |
|
125
|
|
|
|
|
|
|
return_code => $return_code, |
|
126
|
|
|
|
|
|
|
return_code_desc => $return_code_desc, |
|
127
|
|
|
|
|
|
|
transaction_reference_number => $trans_ref_number, |
|
128
|
|
|
|
|
|
|
); |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 is_successful |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 is_failed |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Boolean check on if the transaction in question was successful or not |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
if ( $Detail->is_successful ) { |
|
138
|
|
|
|
|
|
|
... |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
|
142
|
|
|
|
|
|
|
|
|
143
|
7
|
|
|
7
|
1
|
567
|
sub is_successful ( $self ) { return $self->return_code eq '0000' } |
|
|
7
|
|
|
|
|
12
|
|
|
|
7
|
|
|
|
|
11
|
|
|
|
7
|
|
|
|
|
25
|
|
|
144
|
1
|
|
|
1
|
1
|
5577
|
sub is_failed ( $self ) { return !$self->is_successful } |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
6
|
|
|
145
|
|
|
|
|
|
|
|
|
146
|
16
|
|
|
16
|
1
|
55
|
sub to_record ( $self ) { |
|
|
16
|
|
|
|
|
21
|
|
|
|
16
|
|
|
|
|
19
|
|
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
# remove the - char (well, any non-digits). the various specs are |
|
149
|
|
|
|
|
|
|
# a bit all over the place, some keep this char and some don't |
|
150
|
16
|
|
|
|
|
524
|
my $bsb = $self->payment_account_bsb =~ s/\D//gr; |
|
151
|
|
|
|
|
|
|
|
|
152
|
16
|
|
50
|
|
|
40
|
my $record = pack( |
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
153
|
|
|
|
|
|
|
$self->_pack_template(), |
|
154
|
|
|
|
|
|
|
"2", |
|
155
|
|
|
|
|
|
|
sprintf( "%010s", $self->biller_code ), |
|
156
|
|
|
|
|
|
|
$bsb, |
|
157
|
|
|
|
|
|
|
$self->payment_account_number, |
|
158
|
|
|
|
|
|
|
$self->customer_reference_number, |
|
159
|
|
|
|
|
|
|
sprintf( "%013s", $self->amount ), |
|
160
|
|
|
|
|
|
|
$self->lodgement_reference_1 // '', |
|
161
|
|
|
|
|
|
|
$self->lodgement_reference_2 // '', |
|
162
|
|
|
|
|
|
|
$self->lodgement_reference_3 // '', |
|
163
|
|
|
|
|
|
|
$self->return_code, |
|
164
|
|
|
|
|
|
|
$self->return_code_desc, |
|
165
|
|
|
|
|
|
|
$self->transaction_reference_number, |
|
166
|
|
|
|
|
|
|
); |
|
167
|
|
|
|
|
|
|
|
|
168
|
16
|
|
|
|
|
582
|
return $record; |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
L<Business::NAB::Types> |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
L<Business::NAB::BPAY::Payments::Results::DetailRecord> |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |