« lib/WebService/Braintree/_/MasterpassCard.pm
↑ Summary
lib/WebService/Braintree/ClientTokenGateway.pm »
| 1 | # vim: sw=4 ts=4 ft=perl | ||||||||||||
| 2 | |||||||||||||
| 3 | package WebService::Braintree::_::VisaCheckoutCard; | ||||||||||||
| 4 | 22 | $WebService::Braintree::_::VisaCheckoutCard::VERSION = '1.7'; | |||||||||||
| 5 | 22 | ▶ | use 5.010_001; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 22 | ▶ | use strictures 1; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | =head1 NAME | ||||||||||||
| 9 | |||||||||||||
| 10 | WebService::Braintree::_::VisaCheckoutCard | ||||||||||||
| 11 | |||||||||||||
| 12 | =head1 PURPOSE | ||||||||||||
| 13 | |||||||||||||
| 14 | This class represents a Visa Checkout card. | ||||||||||||
| 15 | |||||||||||||
| 16 | This class will only be created as part of a L<response|WebService::Braintree::Result> or L<error response|WebService::Braintree::ErrorResult>. | ||||||||||||
| 17 | |||||||||||||
| 18 | =cut | ||||||||||||
| 19 | |||||||||||||
| 20 | 22 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 21 | 22 | ▶ | use MooX::Aliases; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | |||||||||||||
| 23 | 22 | extends 'WebService::Braintree::_'; | |||||||||||
| 24 | |||||||||||||
| 25 | 22 | ▶ | use Types::Standard qw(ArrayRef); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 26 | 22 | ▶ | use WebService::Braintree::Types qw( | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 27 | Address | ||||||||||||
| 28 | CreditCardVerification | ||||||||||||
| 29 | Subscription | ||||||||||||
| 30 | 22 | ); | |||||||||||
| 31 | |||||||||||||
| 32 | =head1 ATTRIBUTES | ||||||||||||
| 33 | |||||||||||||
| 34 | =cut | ||||||||||||
| 35 | |||||||||||||
| 36 | =head2 billing_address() | ||||||||||||
| 37 | |||||||||||||
| 38 | This returns the card's billing address. This will be an object of type | ||||||||||||
| 39 | L<address|WebService::Braintree::_::Address/>. | ||||||||||||
| 40 | |||||||||||||
| 41 | =cut | ||||||||||||
| 42 | |||||||||||||
| 43 | 22 | has billing_address => ( | |||||||||||
| 44 | is => 'ro', | ||||||||||||
| 45 | isa => Address, | ||||||||||||
| 46 | coerce => 1, | ||||||||||||
| 47 | ); | ||||||||||||
| 48 | |||||||||||||
| 49 | =head2 bin() | ||||||||||||
| 50 | |||||||||||||
| 51 | This returns the card's bin. | ||||||||||||
| 52 | |||||||||||||
| 53 | =cut | ||||||||||||
| 54 | |||||||||||||
| 55 | 22 | has bin => ( | |||||||||||
| 56 | is => 'ro', | ||||||||||||
| 57 | ); | ||||||||||||
| 58 | |||||||||||||
| 59 | =head2 call_id() | ||||||||||||
| 60 | |||||||||||||
| 61 | This returns the card's call ID. | ||||||||||||
| 62 | |||||||||||||
| 63 | =cut | ||||||||||||
| 64 | |||||||||||||
| 65 | 22 | has call_id => ( | |||||||||||
| 66 | is => 'ro', | ||||||||||||
| 67 | ); | ||||||||||||
| 68 | |||||||||||||
| 69 | =head2 card_type() | ||||||||||||
| 70 | |||||||||||||
| 71 | This is the type for this card. | ||||||||||||
| 72 | |||||||||||||
| 73 | =cut | ||||||||||||
| 74 | |||||||||||||
| 75 | 22 | has card_type => ( | |||||||||||
| 76 | is => 'ro', | ||||||||||||
| 77 | ); | ||||||||||||
| 78 | |||||||||||||
| 79 | =head2 cardholder_name() | ||||||||||||
| 80 | |||||||||||||
| 81 | This is the cardholder name for this card. | ||||||||||||
| 82 | |||||||||||||
| 83 | =cut | ||||||||||||
| 84 | |||||||||||||
| 85 | 22 | has cardholder_name => ( | |||||||||||
| 86 | is => 'ro', | ||||||||||||
| 87 | ); | ||||||||||||
| 88 | |||||||||||||
| 89 | =head2 commercial() | ||||||||||||
| 90 | |||||||||||||
| 91 | This is true if this card is commerical. | ||||||||||||
| 92 | |||||||||||||
| 93 | =cut | ||||||||||||
| 94 | |||||||||||||
| 95 | 22 | has commercial => ( | |||||||||||
| 96 | is => 'ro', | ||||||||||||
| 97 | ); | ||||||||||||
| 98 | |||||||||||||
| 99 | =head2 country_of_issuance() | ||||||||||||
| 100 | |||||||||||||
| 101 | This is true if this card is country-of-issuance. | ||||||||||||
| 102 | |||||||||||||
| 103 | =cut | ||||||||||||
| 104 | |||||||||||||
| 105 | 22 | has country_of_issuance => ( | |||||||||||
| 106 | is => 'ro', | ||||||||||||
| 107 | ); | ||||||||||||
| 108 | |||||||||||||
| 109 | =head2 created_at() | ||||||||||||
| 110 | |||||||||||||
| 111 | This returns when this card was created. | ||||||||||||
| 112 | |||||||||||||
| 113 | =cut | ||||||||||||
| 114 | |||||||||||||
| 115 | 22 | has created_at => ( | |||||||||||
| 116 | is => 'ro', | ||||||||||||
| 117 | ); | ||||||||||||
| 118 | |||||||||||||
| 119 | =head2 customer_id() | ||||||||||||
| 120 | |||||||||||||
| 121 | This is the customer ID for this card. | ||||||||||||
| 122 | |||||||||||||
| 123 | =cut | ||||||||||||
| 124 | |||||||||||||
| 125 | 22 | has customer_id => ( | |||||||||||
| 126 | is => 'ro', | ||||||||||||
| 127 | ); | ||||||||||||
| 128 | |||||||||||||
| 129 | =head2 customer_location() | ||||||||||||
| 130 | |||||||||||||
| 131 | This is the customer location for this card. | ||||||||||||
| 132 | |||||||||||||
| 133 | =cut | ||||||||||||
| 134 | |||||||||||||
| 135 | 22 | has customer_location => ( | |||||||||||
| 136 | is => 'ro', | ||||||||||||
| 137 | ); | ||||||||||||
| 138 | |||||||||||||
| 139 | =head2 debit() | ||||||||||||
| 140 | |||||||||||||
| 141 | This is true if this card is debit. | ||||||||||||
| 142 | |||||||||||||
| 143 | =cut | ||||||||||||
| 144 | |||||||||||||
| 145 | 22 | has debit => ( | |||||||||||
| 146 | is => 'ro', | ||||||||||||
| 147 | ); | ||||||||||||
| 148 | |||||||||||||
| 149 | =head2 default() | ||||||||||||
| 150 | |||||||||||||
| 151 | This is true if this card is default. | ||||||||||||
| 152 | |||||||||||||
| 153 | C<< is_default() >> is an alias for this attribute. | ||||||||||||
| 154 | |||||||||||||
| 155 | =cut | ||||||||||||
| 156 | |||||||||||||
| 157 | 22 | has default => ( | |||||||||||
| 158 | is => 'ro', | ||||||||||||
| 159 | alias => 'is_default', | ||||||||||||
| 160 | ); | ||||||||||||
| 161 | |||||||||||||
| 162 | =head2 durbin_regulated() | ||||||||||||
| 163 | |||||||||||||
| 164 | This is true if this card is Durbin-regulated. | ||||||||||||
| 165 | |||||||||||||
| 166 | =cut | ||||||||||||
| 167 | |||||||||||||
| 168 | 22 | has durbin_regulated => ( | |||||||||||
| 169 | is => 'ro', | ||||||||||||
| 170 | ); | ||||||||||||
| 171 | |||||||||||||
| 172 | =head2 expiration_month() | ||||||||||||
| 173 | |||||||||||||
| 174 | This is the expiration month for this card. | ||||||||||||
| 175 | |||||||||||||
| 176 | =cut | ||||||||||||
| 177 | |||||||||||||
| 178 | 22 | has expiration_month => ( | |||||||||||
| 179 | is => 'ro', | ||||||||||||
| 180 | ); | ||||||||||||
| 181 | |||||||||||||
| 182 | =head2 expiration_year() | ||||||||||||
| 183 | |||||||||||||
| 184 | This is the expiration year for this card. | ||||||||||||
| 185 | |||||||||||||
| 186 | =cut | ||||||||||||
| 187 | |||||||||||||
| 188 | 22 | has expiration_year => ( | |||||||||||
| 189 | is => 'ro', | ||||||||||||
| 190 | ); | ||||||||||||
| 191 | |||||||||||||
| 192 | =head2 expired() | ||||||||||||
| 193 | |||||||||||||
| 194 | This is true if this card is expired. | ||||||||||||
| 195 | |||||||||||||
| 196 | C<< is_expired() >> is an alias for this attribute. | ||||||||||||
| 197 | |||||||||||||
| 198 | =cut | ||||||||||||
| 199 | |||||||||||||
| 200 | 22 | has expired => ( | |||||||||||
| 201 | is => 'ro', | ||||||||||||
| 202 | alias => 'is_expired', | ||||||||||||
| 203 | ); | ||||||||||||
| 204 | |||||||||||||
| 205 | =head2 healthcare() | ||||||||||||
| 206 | |||||||||||||
| 207 | This is true if this card is healthcare. | ||||||||||||
| 208 | |||||||||||||
| 209 | =cut | ||||||||||||
| 210 | |||||||||||||
| 211 | 22 | has healthcare => ( | |||||||||||
| 212 | is => 'ro', | ||||||||||||
| 213 | ); | ||||||||||||
| 214 | |||||||||||||
| 215 | =head2 image_url() | ||||||||||||
| 216 | |||||||||||||
| 217 | This is the image URL for this card. | ||||||||||||
| 218 | |||||||||||||
| 219 | =cut | ||||||||||||
| 220 | |||||||||||||
| 221 | 22 | has image_url => ( | |||||||||||
| 222 | is => 'ro', | ||||||||||||
| 223 | ); | ||||||||||||
| 224 | |||||||||||||
| 225 | =head2 issuing_bank() | ||||||||||||
| 226 | |||||||||||||
| 227 | This is the issuing bank for this card. | ||||||||||||
| 228 | |||||||||||||
| 229 | =cut | ||||||||||||
| 230 | |||||||||||||
| 231 | 22 | has issuing_bank => ( | |||||||||||
| 232 | is => 'ro', | ||||||||||||
| 233 | ); | ||||||||||||
| 234 | |||||||||||||
| 235 | =head2 last_4() | ||||||||||||
| 236 | |||||||||||||
| 237 | This is the last-4 for this card. | ||||||||||||
| 238 | |||||||||||||
| 239 | =cut | ||||||||||||
| 240 | |||||||||||||
| 241 | 22 | has last_4 => ( | |||||||||||
| 242 | is => 'ro', | ||||||||||||
| 243 | ); | ||||||||||||
| 244 | |||||||||||||
| 245 | =head2 payroll() | ||||||||||||
| 246 | |||||||||||||
| 247 | This is true if this card is payroll. | ||||||||||||
| 248 | |||||||||||||
| 249 | =cut | ||||||||||||
| 250 | |||||||||||||
| 251 | 22 | has payroll => ( | |||||||||||
| 252 | is => 'ro', | ||||||||||||
| 253 | ); | ||||||||||||
| 254 | |||||||||||||
| 255 | =head2 prepaid() | ||||||||||||
| 256 | |||||||||||||
| 257 | This is true if this card is prepaid. | ||||||||||||
| 258 | |||||||||||||
| 259 | =cut | ||||||||||||
| 260 | |||||||||||||
| 261 | 22 | has prepaid => ( | |||||||||||
| 262 | is => 'ro', | ||||||||||||
| 263 | ); | ||||||||||||
| 264 | |||||||||||||
| 265 | =head2 product_id() | ||||||||||||
| 266 | |||||||||||||
| 267 | This is the product ID for this card. | ||||||||||||
| 268 | |||||||||||||
| 269 | =cut | ||||||||||||
| 270 | |||||||||||||
| 271 | 22 | has product_id => ( | |||||||||||
| 272 | is => 'ro', | ||||||||||||
| 273 | ); | ||||||||||||
| 274 | |||||||||||||
| 275 | =head2 subscriptions() | ||||||||||||
| 276 | |||||||||||||
| 277 | This returns the card's subscriptions. This will be an arrayref of | ||||||||||||
| 278 | L<subscriptions|WebService::Braintree::_::Subscription/>. | ||||||||||||
| 279 | |||||||||||||
| 280 | =cut | ||||||||||||
| 281 | |||||||||||||
| 282 | 22 | has subscriptions => ( | |||||||||||
| 283 | is => 'ro', | ||||||||||||
| 284 | isa => ArrayRef[Subscription], | ||||||||||||
| 285 | coerce => 1, | ||||||||||||
| 286 | ); | ||||||||||||
| 287 | |||||||||||||
| 288 | =head2 token() | ||||||||||||
| 289 | |||||||||||||
| 290 | This is the token for this card. | ||||||||||||
| 291 | |||||||||||||
| 292 | =cut | ||||||||||||
| 293 | |||||||||||||
| 294 | 22 | has token => ( | |||||||||||
| 295 | is => 'ro', | ||||||||||||
| 296 | ); | ||||||||||||
| 297 | |||||||||||||
| 298 | =head2 unique_number_identifier() | ||||||||||||
| 299 | |||||||||||||
| 300 | This is the unique number identifier for this card. | ||||||||||||
| 301 | |||||||||||||
| 302 | =cut | ||||||||||||
| 303 | |||||||||||||
| 304 | 22 | has unique_number_identifier => ( | |||||||||||
| 305 | is => 'ro', | ||||||||||||
| 306 | ); | ||||||||||||
| 307 | |||||||||||||
| 308 | =head2 updated() | ||||||||||||
| 309 | |||||||||||||
| 310 | This returns when this card was last updated. | ||||||||||||
| 311 | |||||||||||||
| 312 | =cut | ||||||||||||
| 313 | |||||||||||||
| 314 | 22 | has updated_at => ( | |||||||||||
| 315 | is => 'ro', | ||||||||||||
| 316 | ); | ||||||||||||
| 317 | |||||||||||||
| 318 | =head2 verifications() | ||||||||||||
| 319 | |||||||||||||
| 320 | This returns the card's credit card verifications. This will be an arrayref of | ||||||||||||
| 321 | L<credit card verifications|WebService::Braintree::_::CreditCardVerification/>. | ||||||||||||
| 322 | |||||||||||||
| 323 | =cut | ||||||||||||
| 324 | |||||||||||||
| 325 | 22 | has verifications => ( | |||||||||||
| 326 | is => 'ro', | ||||||||||||
| 327 | isa => ArrayRef[CreditCardVerification], | ||||||||||||
| 328 | coerce => 1, | ||||||||||||
| 329 | ); | ||||||||||||
| 330 | |||||||||||||
| 331 | =head1 METHODS | ||||||||||||
| 332 | |||||||||||||
| 333 | =head2 expiration_date() | ||||||||||||
| 334 | |||||||||||||
| 335 | This returns the expiration date in MM/YYYY format. | ||||||||||||
| 336 | |||||||||||||
| 337 | =cut | ||||||||||||
| 338 | |||||||||||||
| 339 | 0 | ▶ | sub expiration_date { | ||||||||||
|
Subroutine
expiration_date: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 340 | 0 | my $self = shift; | |||||||||||
| 341 | 0 | return join('/', $self->expiration_month, $self->expiration_year); | |||||||||||
| 342 | } | ||||||||||||
| 343 | |||||||||||||
| 344 | =head2 masked_number() | ||||||||||||
| 345 | |||||||||||||
| 346 | This returns the card number with the center masked out. | ||||||||||||
| 347 | |||||||||||||
| 348 | =cut | ||||||||||||
| 349 | |||||||||||||
| 350 | 0 | ▶ | sub masked_number { | ||||||||||
|
Subroutine
masked_number: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 351 | 0 | my $self = shift; | |||||||||||
| 352 | 0 | return join('******', $self->bin, $self->last_4); | |||||||||||
| 353 | } | ||||||||||||
| 354 | |||||||||||||
| 355 | =head2 verification() | ||||||||||||
| 356 | |||||||||||||
| 357 | This returns the most recent verification from the arrayref in L</verifications()>. | ||||||||||||
| 358 | |||||||||||||
| 359 | =cut | ||||||||||||
| 360 | |||||||||||||
| 361 | 0 | ▶ | sub verification { | ||||||||||
|
Subroutine
verification: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 362 | 0 | my $self = shift; | |||||||||||
| 363 | |||||||||||||
| 364 | return ( | ||||||||||||
| 365 | sort { | ||||||||||||
| 366 | 0 | $b->created_at cmp $a->created_at | |||||||||||
| 367 | 0 | ▶ | } @{$self->verifications // []} | ||||||||||
|
Condition0%0/2
$self->verifications // []
MC/DC0%0/1
$self->verifications // []
$self->verifications
Truth table0%0/2
A
A= $self->verifications
| |||||||||||||
| 368 | )[0]; | ||||||||||||
| 369 | } | ||||||||||||
| 370 | |||||||||||||
| 371 | 22 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 372 | |||||||||||||
| 373 | 22 | 1; | |||||||||||
| 374 | __END__ | ||||||||||||