NAB/Acknowledgement/Issue.pm

filter: Statementstmt 97.3% 36 / 37 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod n/a totaltotal 92.0% 46 / 50 CC 3 SCAR 4.4
CC
3
Cov
93%
is_ready
2.5
is_uploaded
2.5
BEGIN
1.0
CRAP 1.5
« NAB/CSV.pm ↑ Summary NAB/BPAY/Remittance/File/TrailerRecord.pm »
1 package Business::NAB::Acknowledgement::Issue;
2 1 $Business::NAB::Acknowledgement::Issue::VERSION = '0.11';
3 =head1 NAME
4  
5 Business::NAB::Acknowledgement::Issue
6  
7 =head1 SYNOPSIS
8  
9 my $Issue = Business::NAB::Acknowledgement::Issue->new(
10 code => "290049",
11 detail => "Uploaded Interchange 60063804 for ...",
12 );
13  
14 =head1 DESCRIPTION
15  
16 Class for NAB file acknowledgement issues. You probably don't want
17 to interact with this class and instead use the parent class
18 L<Business::NAB::Acknowledgement>.
19  
20 =cut
21  
22 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use feature qw/ signatures /;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 2 ▶no warnings qw/ experimental::signatures /;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 =head1 ATTRIBUTES
32  
33 =over
34  
35 =item code (Str)
36  
37 =item detail (Str)
38  
39 =item itemId (Int)
40  
41 =back
42  
43 =cut
44  
45 1 has [ qw/ code detail itemId type / ] => (
46 is => 'ro',
47 isa => 'Maybe[Str]',
48 required => 0,
49 );
50  
51 =head1 METHODS
52  
53 =head2 is_approved
54  
55 =head2 is_authorised
56  
57 =head2 is_changed
58  
59 =head2 is_checked
60  
61 =head2 is_corrected
62  
63 =head2 is_error
64  
65 =head2 is_failed
66  
67 =head2 is_held
68  
69 =head2 is_invalid
70  
71 =head2 is_partially_failed
72  
73 =head2 is_ready
74  
75 =head2 is_ready_for_auth
76  
77 =head2 is_referred
78  
79 =head2 is_released
80  
81 =head2 is_report
82  
83 =head2 is_reserved
84  
85 =head2 is_uploaded
86  
87 =head2 is_validated
88  
89 =head2 is_warning
90  
91 Boolean checks on the issue type
92  
93 =cut
94  
95 # type codes map to the transaction state, which is *inferred*
96 # from the detail in the text the Issue contains
97 1 my %type_lookup = (
98 error => 'is_error',
99 warning => 'is_warning',
100 2025 => 'is_uploaded',
101 5013 => 'is_corrected',
102 6010 => 'is_ready_for_auth',
103 6014 => 'is_authorised',
104 50040 => 'is_changed',
105 104503 => 'is_validated',
106 104506 => 'is_invalid',
107 112215 => 'is_invalid',
108 130000 => 'is_checked',
109 130001 => 'is_reserved',
110 130003 => 'is_referred',
111 133610 => 'is_failed',
112 140000 => 'is_reserved',
113 180004 => 'is_rejected',
114 180054 => 'is_referred',
115 180055 => 'is_approved',
116 180057 => 'is_approved',
117 181002 => 'is_validated',
118 181004 => 'is_invalid',
119 181015 => 'is_partially_failed',
120 181016 => 'is_invalid',
121 181026 => 'is_invalid',
122 181100 => 'is_held',
123 181104 => 'is_released',
124 181253 => 'is_authorised',
125 181258 => 'is_rejected',
126 181259 => 'is_authorised',
127 190108 => 'is_invalid',
128 181301 => 'is_ready',
129 194500 => 'is_report',
130 290049 => 'is_report',
131 );
132  
133 1 my %reverse_type_lookup = reverse( %type_lookup );
134  
135 1 foreach my $method ( keys %reverse_type_lookup ) {
136  
137 __PACKAGE__->meta()->add_method(
138 $method,
139 0 ▶ sub ( $self ) {
Subroutine is_ready: not called CC=2 SCAR=9.2
Subroutine is_uploaded: called CC=2 SCAR=9.2
140 0 ▶ return $type_lookup{ $self->type } eq $method
Branch: 2 branches
BranchTrueFalseTotal
$type_lookup{$self->type} eq $method ? : 0 0 0
$type_lookup{$self->type} eq $method ? : 33 3 36
141 ? 1 : 0;
142 },
143 20 );
144 }
145  
146 =head1 SEE ALSO
147  
148 L<Business::NAB::Acknowledgement>
149  
150 =cut
151  
152 1 __PACKAGE__->meta->make_immutable;
« NAB/CSV.pm ↑ Summary NAB/BPAY/Remittance/File/TrailerRecord.pm »