File Coverage

blib/lib/Business/CyberSource/RequestPart/ShipTo.pm
Criterion Covered Total %
statement 36 36 100.0
branch 8 8 100.0
condition 2 3 66.6
subroutine 11 11 100.0
pod 0 1 0.0
total 57 59 96.6


line stmt bran cond sub pod time code
1             package Business::CyberSource::RequestPart::ShipTo;
2 5     5   19974 use strict;
  5         12  
  5         145  
3 5     5   18 use warnings;
  5         8  
  5         131  
4 5     5   777 use namespace::autoclean;
  5         16022  
  5         31  
5              
6             our $VERSION = '0.010008'; # VERSION
7              
8 5     5   1189 use Moose;
  5         494016  
  5         32  
9 5     5   23097 use MooseX::RemoteHelper;
  5         18730  
  5         29  
10             extends 'Business::CyberSource::MessagePart';
11             with 'MooseX::RemoteHelper::CompositeSerialization';
12 5     5   146960 use MooseX::Aliases;
  5         2656  
  5         32  
13              
14 5     5   118220 use MooseX::Types::Common::String qw( NonEmptySimpleStr );
  5         197744  
  5         50  
15              
16 5         41 use MooseX::Types::CyberSource qw(
17             CountryCode
18             _VarcharTen
19             _VarcharFifteen
20             _VarcharTwenty
21             _VarcharFifty
22             _VarcharSixty
23             ShippingMethod
24 5     5   10635 );
  5         13  
25              
26 5     5   39329 use Moose::Util 'throw_exception';
  5         9  
  5         38  
27 5     5   759 use Moose::Util::TypeConstraints;
  5         6  
  5         32  
28              
29             sub BUILD {
30 10     10 0 18 my $self = shift;
31 10 100 66     314 if ( $self->country eq 'US' or $self->country eq 'CA' ) {
32 9 100       277 throw_exception(
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 100       275 throw_exception(
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 100       222 throw_exception(
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         184 return;
56             }
57              
58             has first_name => (
59             remote_name => 'firstName',
60             is => 'ro',
61             isa => _VarcharSixty,
62             );
63              
64             has last_name => (
65             remote_name => 'lastName',
66             is => 'ro',
67             isa => _VarcharSixty,
68             );
69              
70             has street1 => (
71             remote_name => 'street1',
72             required => 1,
73             is => 'ro',
74             isa => _VarcharSixty,
75             );
76              
77             has street2 => (
78             remote_name => 'street2',
79             isa => _VarcharSixty,
80             is => 'ro',
81             );
82              
83             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             isa => subtype( NonEmptySimpleStr, where { length $_ == 2 } ),
93             is => 'ro',
94             predicate => 'has_state',
95             );
96              
97             has country => (
98             remote_name => 'country',
99             required => 1,
100             coerce => 1,
101             is => 'ro',
102             isa => CountryCode,
103             );
104              
105             has postal_code => (
106             remote_name => 'postalCode',
107             isa => _VarcharTen,
108             is => 'ro',
109             predicate => 'has_postal_code',
110             );
111              
112             has phone_number => (
113             remote_name => 'phoneNumber',
114             isa => _VarcharFifteen,
115             is => 'ro',
116             );
117              
118             has shipping_method => (
119             remote_name => 'shippingMethod',
120             isa => ShippingMethod,
121             is => 'ro',
122             );
123              
124             __PACKAGE__->meta->make_immutable;
125             1;
126              
127             # ABSTRACT: ShipTo information
128              
129             __END__
130              
131             =pod
132              
133             =encoding UTF-8
134              
135             =head1 NAME
136              
137             Business::CyberSource::RequestPart::ShipTo - ShipTo information
138              
139             =head1 VERSION
140              
141             version 0.010008
142              
143             =head1 EXTENDS
144              
145             L<Business::CyberSource::MessagePart>
146              
147             =head1 ATTRIBUTES
148              
149             =head2 first_name
150              
151             =head2 last_name
152              
153             =head2 city
154              
155             =head2 state
156              
157             =head2 postal_code
158              
159             =head2 street1
160              
161             =head2 street2
162              
163             =head2 country
164              
165             =head2 phone_number
166              
167             =head2 shipping_method
168              
169             =for Pod::Coverage BUILD
170              
171             =head1 BUGS
172              
173             Please report any bugs or feature requests on the bugtracker website
174             https://github.com/hostgator/business-cybersource/issues
175              
176             When submitting a bug or request, please include a test-file or a
177             patch to an existing test-file that illustrates the bug or desired
178             feature.
179              
180             =head1 AUTHOR
181              
182             Caleb Cushing <xenoterracide@gmail.com>
183              
184             =head1 COPYRIGHT AND LICENSE
185              
186             This software is Copyright (c) 2017 by Caleb Cushing <xenoterracide@gmail.com>.
187              
188             This is free software, licensed under:
189              
190             The Artistic License 2.0 (GPL Compatible)
191              
192             =cut