Business/CyberSource/RequestPart/ShipTo.pm

filter: Statementstmt 100% 52 / 52 Branchbran 100% 8 / 8 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 1 totaltotal 96.1% 75 / 78 CC 6 SCAR 10.2
CC
6
Cov
98%
BUILD
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« Business/CyberSource/RequestPart/Card.pm ↑ Summary Business/CyberSource/Request/FollowOnCredit.pm »
1 package Business::CyberSource::RequestPart::ShipTo;
2 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 our $VERSION = '0.010008'; # VERSION
7  
8 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use MooseX::RemoteHelper;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 extends 'Business::CyberSource::MessagePart';
11 6 with 'MooseX::RemoteHelper::CompositeSerialization';
12 6 ▶use MooseX::Aliases;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 6 ▶use MooseX::Types::Common::String qw( NonEmptySimpleStr );
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 6 ▶use MooseX::Types::CyberSource qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
17 CountryCode
18 _VarcharTen
19 _VarcharFifteen
20 _VarcharTwenty
21 _VarcharFifty
22 _VarcharSixty
23 ShippingMethod
24 6 );
25  
26 6 ▶use Moose::Util 'throw_exception';
Subroutine BEGIN: called CC=1 SCAR=0.0
27 6 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 10 ▶sub BUILD {
Subroutine BUILD: called CC=6 SCAR=17.9
Pod undocumented
30 10 my $self = shift;
31 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") 9 1 10
Condition66%2/3
$self->country eq "US" or $self->country eq "CA"
l!l&&r!l&&!r
901
MC/DC50%1/2
$self->country eq "US" or $self->country eq "CA"
$self->country eq "US" $self->country eq "CA"
Truth table66%2/3
A or B
A= $self->country eq "US"B= $self->country eq "CA"
ABresult
1X1
011
000
32 9 ▶ throw_exception(
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_city 1 8 9
33 AttributeIsRequired => attribute_name => 'city',
34 class_name => __PACKAGE__,
35 message => 'Attribute (' . 'city'
36 . ') is required for US or Canada',
37 ) unless $self->has_city;
38  
39 8 ▶ throw_exception(
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_postal_code 1 7 8
40 AttributeIsRequired => attribute_name => 'postal_code',
41 class_name => __PACKAGE__,
42 message => 'Attribute ('
43 . 'postal_code'
44 . ') is required for US or Canada',
45 ) unless $self->has_postal_code;
46  
47 7 ▶ throw_exception(
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_state 1 6 7
48 AttributeIsRequired => attribute_name => 'state',
49 class_name => __PACKAGE__,
50 message => 'Attribute (' . 'state'
51 . ') is required for US or Canada',
52 ) unless $self->has_state;
53 }
54  
55 7 return;
56 }
57  
58 6 has first_name => (
59 remote_name => 'firstName',
60 is => 'ro',
61 isa => _VarcharSixty,
62 );
63  
64 6 has last_name => (
65 remote_name => 'lastName',
66 is => 'ro',
67 isa => _VarcharSixty,
68 );
69  
70 6 has street1 => (
71 remote_name => 'street1',
72 required => 1,
73 is => 'ro',
74 isa => _VarcharSixty,
75 );
76  
77 6 has street2 => (
78 remote_name => 'street2',
79 isa => _VarcharSixty,
80 is => 'ro',
81 );
82  
83 6 has city => (
84 remote_name => 'city',
85 isa => _VarcharFifty,
86 is => 'ro',
87 predicate => 'has_city',
88 );
89  
90 has state => (
91 remote_name => 'state',
92 8 ▶ isa => subtype( NonEmptySimpleStr, where { length $_ == 2 } ),
Subroutine __ANON__: called CC=1 SCAR=0.0
93 is => 'ro',
94 predicate => 'has_state',
95 );
96  
97 6 has country => (
98 remote_name => 'country',
99 required => 1,
100 coerce => 1,
101 is => 'ro',
102 isa => CountryCode,
103 );
104  
105 6 has postal_code => (
106 remote_name => 'postalCode',
107 isa => _VarcharTen,
108 is => 'ro',
109 predicate => 'has_postal_code',
110 );
111  
112 6 has phone_number => (
113 remote_name => 'phoneNumber',
114 isa => _VarcharFifteen,
115 is => 'ro',
116 );
117  
118 6 has shipping_method => (
119 remote_name => 'shippingMethod',
120 isa => ShippingMethod,
121 is => 'ro',
122 );
123  
124 6 __PACKAGE__->meta->make_immutable;
125 6 1;
126  
127 # ABSTRACT: ShipTo information
128  
129 __END__
« Business/CyberSource/RequestPart/Card.pm ↑ Summary Business/CyberSource/Request/FollowOnCredit.pm »