Business/CyberSource/RequestPart/BillTo.pm

filter: Statementstmt 98.5% 70 / 71 Branchbran 87.5% 7 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 93.7% 15 / 16 Podpod 0.0% 0 / 1 totaltotal 92.0% 93 / 101 CC 7 SCAR 8.3
CC
7
Cov
95%
BUILD
5.3
__ANON__
3.0
__ANON__
2.0
CRAP 2.3
« Business/CyberSource/Rule.pm ↑ Summary Business/CyberSource/Factory/Response.pm »
1 package Business::CyberSource::RequestPart::BillTo;
2 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 7 our $VERSION = '0.010008'; # VERSION
7  
8 7 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 7 extends 'Business::CyberSource::MessagePart';
10 7 with 'MooseX::RemoteHelper::CompositeSerialization';
11  
12 7 ▶use MooseX::Aliases;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 7 ▶use MooseX::Types::Common::String qw( NonEmptySimpleStr );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 7 ▶use MooseX::Types::Email qw( EmailAddress );
Subroutine BEGIN: called CC=1 SCAR=0.0
15 7 ▶use MooseX::Types::NetAddr::IP qw( NetAddrIPv4 );
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 7 ▶use MooseX::Types::CyberSource qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
18 CountryCode
19 _VarcharTen
20 _VarcharTwenty
21 _VarcharFifty
22 _VarcharSixty
23 7 );
24  
25 7 ▶use Moose::Util 'throw_exception';
Subroutine BEGIN: called CC=1 SCAR=0.0
26 7 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 10 ▶sub BUILD { ## no critic ( Subroutines::RequireFinalReturn )
Subroutine BUILD: called CC=5 SCAR=16.7
Pod undocumented
29 10 my $self = shift;
30 10 ▶ if ( $self->country eq 'US' or $self->country eq 'CA' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->country eq "US" or $self->country eq "CA") 10 0 10
Condition33%1/3
$self->country eq "US" or $self->country eq "CA"
l!l&&r!l&&!r
1000
MC/DC0%0/2
$self->country eq "US" or $self->country eq "CA"
$self->country eq "US" $self->country eq "CA"
Truth table33%1/3
A or B
A= $self->country eq "US"B= $self->country eq "CA"
ABresult
1X1
011
000
31 10 ▶ throw_exception(AttributeIsRequired =>
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_postal_code 1 9 10
32 attribute_name => 'postal_code',
33 class_name => __PACKAGE__,
34 message => 'Attribute ('
35 . 'postal_code'
36 . ') is required for US or Canada',
37 ) unless $self->has_postal_code;
38  
39 9 ▶ throw_exception(AttributeIsRequired =>
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_state 1 8 9
40 attribute_name => 'state',
41 class_name => __PACKAGE__,
42 message => 'Attribute ('
43 . 'state'
44 . ') is required for US or Canada',
45 ) unless $self->has_state;
46 }
47 }
48  
49 7 has first_name => (
50 remote_name => 'firstName',
51 required => 1,
52 is => 'ro',
53 isa => _VarcharSixty,
54 );
55  
56 7 has last_name => (
57 remote_name => 'lastName',
58 required => 1,
59 is => 'ro',
60 isa => _VarcharSixty,
61 );
62  
63 7 has street1 => (
64 remote_name => 'street1',
65 required => 1,
66 is => 'ro',
67 isa => _VarcharSixty,
68 alias => 'street',
69 );
70  
71 7 has street2 => (
72 remote_name => 'street2',
73 isa => _VarcharSixty,
74 traits => ['SetOnce'],
75 is => 'rw',
76 predicate => 'has_street2',
77 );
78  
79 7 has street3 => (
80 remote_name => 'street3',
81 isa => _VarcharSixty,
82 traits => ['SetOnce'],
83 is => 'rw',
84 predicate => 'has_street3',
85 );
86  
87 7 has street4 => (
88 remote_name => 'street4',
89 isa => _VarcharSixty,
90 traits => ['SetOnce'],
91 is => 'rw',
92 predicate => 'has_street4',
93 );
94  
95 7 has city => (
96 remote_name => 'city',
97 isa => _VarcharFifty,
98 required => 1,
99 is => 'ro',
100 );
101  
102 has state => (
103 remote_name => 'state',
104 9 ▶ isa => subtype( NonEmptySimpleStr, where { length $_ == 2 }),
Subroutine __ANON__: called CC=1 SCAR=0.0
105 traits => ['SetOnce'],
106 alias => 'province',
107 is => 'ro',
108 predicate => 'has_state',
109 );
110  
111 7 has country => (
112 remote_name => 'country',
113 required => 1,
114 coerce => 1,
115 is => 'ro',
116 isa => CountryCode,
117 );
118  
119 7 has postal_code => (
120 remote_name => 'postalCode',
121 isa => _VarcharTen,
122 traits => ['SetOnce'],
123 alias => 'zip',
124 is => 'rw',
125 predicate => 'has_postal_code',
126 );
127  
128 7 has phone_number => (
129 remote_name => 'phoneNumber',
130 isa => _VarcharTwenty,
131 traits => ['SetOnce'],
132 alias => 'phone',
133 is => 'rw',
134 predicate => 'has_phone_number',
135 );
136  
137 7 has email => (
138 remote_name => 'email',
139 required => 1,
140 is => 'ro',
141 isa => EmailAddress,
142 );
143  
144 has ip => (
145 remote_name => 'ipAddress',
146 traits => ['SetOnce'],
147 is => 'rw',
148 coerce => 1,
149 isa => NetAddrIPv4,
150 predicate => 'has_ip',
151 5 ▶ serializer => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
152 5 my ( $attr, $instance ) = @_;
153 5 return $attr->get_value( $instance )->addr;
154 },
155 7 );
156  
157 7 my @deprecated = ( qw( street province zip phone ) );
158 11 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
159 11 my $orig = shift;
160 11 my $self = shift;
161  
162 11 my $args = $self->$orig( @_ );
163  
164 11 foreach my $attr (@deprecated ) {
165 44 ▶ if ( exists $args->{$attr} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{$attr}) 9 35 44
166 9 warnings::warnif('deprecated', # this is due to Moose::Exception conflict
167 "$attr deprecated check the perldoc for the actual attribute"
168 );
169 }
170 }
171  
172 11 return $args;
173 7 };
174  
175 7 foreach my $attr (@deprecated ) {
176 0 ▶ my $deprecated = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
177 0 warnings::warnif('deprecated', # this is due to Moose::Exception conflict
178 "$attr deprecated check the perldoc for the actual attribute"
179 );
180 28 };
181  
182 28 before( $attr, $deprecated );
183 }
184  
185 7 __PACKAGE__->meta->make_immutable;
186 7 1;
187  
188 # ABSTRACT: BillTo information
189  
190 __END__
« Business/CyberSource/Rule.pm ↑ Summary Business/CyberSource/Factory/Response.pm »