| 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.010007'; # 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( | |||||||||||||||||||||||||||
| 18 | CountryCode | ||||||||||||||||||||||||||||
| 19 | _VarcharTen | ||||||||||||||||||||||||||||
| 20 | _VarcharTwenty | ||||||||||||||||||||||||||||
| 21 | _VarcharFifty | ||||||||||||||||||||||||||||
| 22 | _VarcharSixty | ||||||||||||||||||||||||||||
| 23 | 7 | ▶ | ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 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 | sub BUILD { ## no critic ( Subroutines::RequireFinalReturn ) | ||||||||||||||||||||||||||||
| 29 | 10 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=5 SCAR=16.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 30 | 10 | ▶ | if ( $self->country eq 'US' or $self->country eq 'CA' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->country eq "US" or $self->country eq "CA"
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"
| |||||||||||||||||||||||||||||
| 31 | 10 | ▶ | throw_exception(AttributeIsRequired => | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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 | serializer => sub { | ||||||||||||||||||||||||||||
| 152 | 5 | ▶ | my ( $attr, $instance ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 153 | 5 | return $attr->get_value( $instance )->addr; | |||||||||||||||||||||||||||
| 154 | }, | ||||||||||||||||||||||||||||
| 155 | 7 | ); | |||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 7 | my @deprecated = ( qw( street province zip phone ) ); | |||||||||||||||||||||||||||
| 158 | around BUILDARGS => sub { | ||||||||||||||||||||||||||||
| 159 | 11 | ▶ | my $orig = shift; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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 | my $deprecated = sub { | ||||||||||||||||||||||||||||
| 177 | 0 | ▶ | warnings::warnif('deprecated', # this is due to Moose::Exception conflict | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | =pod | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | =head1 NAME | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | Business::CyberSource::RequestPart::BillTo - BillTo information | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | =head1 VERSION | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | version 0.010007 | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | =head1 EXTENDS | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | L<Business::CyberSource::MessagePart> | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | =head2 ip | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | Customer's IP address, meaning the IP that the request was made from. | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | =head2 first_name | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | Customer's first name. The value should be the same as the one that is on the | ||||||||||||||||||||||||||||
| 217 | card. | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | =head2 last_name | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | Customer's last name. The value should be the same as the one that is on the card. | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | =head2 email | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | Customer's email address, including the full domain name | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | =head2 phone_number | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | =head2 street1 | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | First line of the billing street address as it appears on the credit card issuer's records. | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | =head2 street2 | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | =head2 street3 | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | =head2 street4 | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | =head2 city | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | City of the billing address. | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | =head2 state | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | State or province of the billing address. Use the two-character codes. | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | =head2 country | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | ISO 2 character country code (as it would apply to a credit card billing statement) | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | =head2 postal_code | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | Postal code for the billing address. The postal code must consist of 5 to 9 | ||||||||||||||||||||||||||||
| 254 | digits. | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | Required if C<country> is "US" or "CA". | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | =for Pod::Coverage BUILD | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | =head1 BUGS | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | Please report any bugs or feature requests on the bugtracker website | ||||||||||||||||||||||||||||
| 263 | https://github.com/xenoterracide/business-cybersource/issues | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | When submitting a bug or request, please include a test-file or a | ||||||||||||||||||||||||||||
| 266 | patch to an existing test-file that illustrates the bug or desired | ||||||||||||||||||||||||||||
| 267 | feature. | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | Caleb Cushing <xenoterracide@gmail.com> | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | This software is Copyright (c) 2016 by Caleb Cushing <xenoterracide@gmail.com>. | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | This is free software, licensed under: | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | The Artistic License 2.0 (GPL Compatible) | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | =cut | ||||||||||||||||||||||||||||