File Coverage

blib/lib/Business/Payment/CreditCard.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 15 15 100.0


line stmt bran cond sub pod time code
1             package Business::Payment::CreditCard;
2 1     1   49567 use Moose;
  1         334099  
  1         4  
3              
4 1     1   4836 use Business::Payment::Types;
  1         3  
  1         7  
5              
6             extends 'Business::Payment::Charge';
7              
8             with 'MooseX::Traits';
9              
10             has '+_trait_namespace' => (
11             default => 'Business::Payment::CreditCard'
12             );
13              
14             has 'csc' => (
15             is => 'rw',
16             isa => 'Num'
17             );
18              
19             has 'expiration' => (
20             is => 'rw',
21             isa => 'DateTime',
22             coerce => 1,
23             required => 1
24             );
25              
26             has 'number' => (
27             is => 'rw',
28             isa => 'Str',
29             required => 1
30             );
31              
32             sub expiration_formatted {
33 1     1 1 757 shift->expiration->strftime(shift);
34             }
35              
36 1     1   365 no Moose;
  1         2  
  1         5  
37             __PACKAGE__->meta->make_immutable;
38              
39             =head1 NAME
40              
41             Business::Payment::CreditCard - Credit Card object
42              
43             =head1 SYNOPSIS
44              
45             use Business::Payment::CreditCard;
46              
47             my $bp = Business::Payment::CreditCard->new(
48             number => '4111111111111111'
49             );
50              
51             =head1 DESCRIPTION
52              
53             Business::Payment::CreditCard provides a model for passing Credit Card
54             information to a Charge.
55              
56             =head1 ATTRIBUTES
57              
58             =head2 csc
59              
60             Set/Get the Card Security Code for this Credit Card. This is also
61             referred to as the CVV, CVV2, CVVC, CVC, V-Code or CCV.
62              
63             http://en.wikipedia.org/wiki/Card_Verification_Value
64              
65             =head2 expiration
66              
67             Set/Get the expiration for this Credit Card. Expects a DateTime object,
68             but can coerce a String.
69              
70             =head2 number
71              
72             Set/Get the credit card number.
73              
74             =head1 METHODS
75              
76             =head2 expiration_formatted ($format)
77              
78             Returns a stringified version of the expiration date using the supplied
79             format. (See DateTime's strftime)
80              
81             =head1 AUTHOR
82              
83             Jay Shirley, C<< <jshirley@cpan.org> >>
84              
85             =head1 COPYRIGHT & LICENSE
86              
87             Copyright 2009 Cold Hard Code, LLC, all rights reserved.
88              
89             This program is free software; you can redistribute it and/or modify it
90             under the same terms as Perl itself.