lib/WebService/Braintree/CreditCard.pm

filter: Statementstmt 73.0% 46 / 63 Branchbran n/a Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 65.2% 15 / 23 Podpod 90.0% 9 / 10 totaltotal 68.6% 70 / 102 CC 3 SCAR 7.1
CC
3
Cov
69%
credit
6.0
sale
6.0
from_nonce
2.0
CRAP 2.0
« lib/WebService/Braintree/_/CreditCard.pm ↑ Summary blib/lib/WebService/Braintree/Test.pm »
1 # vim: sw=4 ts=4 ft=perl
2  
3 package WebService::Braintree::CreditCard;
4 22 $WebService::Braintree::CreditCard::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 22 ▶use WebService::Braintree::CreditCard::CardType;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 22 ▶use WebService::Braintree::CreditCard::Commercial;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 22 ▶use WebService::Braintree::CreditCard::CountryOfIssuance;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 22 ▶use WebService::Braintree::CreditCard::Debit;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 22 ▶use WebService::Braintree::CreditCard::DurbinRegulated;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 22 ▶use WebService::Braintree::CreditCard::Healthcare;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 22 ▶use WebService::Braintree::CreditCard::IssuingBank;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 22 ▶use WebService::Braintree::CreditCard::Location;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 22 ▶use WebService::Braintree::CreditCard::Payroll;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 22 ▶use WebService::Braintree::CreditCard::Prepaid;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 =head1 NAME
20  
21 WebService::Braintree::CreditCard
22  
23 =head1 PURPOSE
24  
25 This class creates, updates, deletes, and finds credit cards.
26  
27 =cut
28  
29 22 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 22 with 'WebService::Braintree::Role::Interface';
32  
33 =head1 CLASS METHODS
34  
35 =head2 create()
36  
37 This takes a hashref of parameters and returns a L<response|WebService::Braintee::Result> with the C<< credit_card() >> set.
38  
39 =cut
40  
41 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
Pod documented
42 1 my ($class, $params) = @_;
43 1 $class->gateway->credit_card->create($params);
44 }
45  
46 =head2 from_nonce()
47  
48 This takes a nonce and returns a L<response|WebService::Braintee::Result> with the C<< credit_card() >> set.
49  
50 =cut
51  
52 0 ▶sub from_nonce {
Subroutine from_nonce: not called CC=1 SCAR=6.9
Pod documented
53 0 my ($class, $nonce) = @_;
54 0 $class->gateway->credit_card->from_nonce($nonce);
55 }
56  
57 =head2 find()
58  
59 This takes a token and returns a L<response|WebService::Braintee::Result> with the C<< credit_card() >> set.
60  
61 =cut
62  
63 2 ▶sub find {
Subroutine find: called CC=1 SCAR=0.0
Pod documented
64 2 my ($class, $token) = @_;
65 2 $class->gateway->credit_card->find($token);
66 }
67  
68 =head2 update()
69  
70 This takes a token and a hashref of parameters. It will update the corresponding
71 credit card (if found) and return a L<response|WebService::Braintee::Result>
72 with the C<< credit_card() >> set.
73  
74 =cut
75  
76 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
Pod documented
77 0 my($class, $token, $params) = @_;
78 0 $class->gateway->credit_card->update($token, $params);
79 }
80  
81 =head2 delete()
82  
83 This takes a token. It will delete the corresponding credit card (if found) and
84 return a L<response|WebService::Braintee::Result> with the C<< credit_card() >> set.
85  
86 =cut
87  
88 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
Pod documented
89 0 my ($class, $token) = @_;
90 0 $class->gateway->credit_card->delete($token);
91 }
92  
93 =head2 credit()
94  
95 This takes a token and an optional hashref of parameters. This delegates to
96 L<WebService::Braintree::Transaction/credit>, setting the
97 C<< payment_method_token >> appropriately.
98  
99 =cut
100  
101 0 ▶sub credit {
Subroutine credit: not called CC=2 SCAR=17.9
Pod documented
102 0 my ($class, $token, $params) = @_;
103 $class->gateway->transaction->credit({
104 0 ▶ %{$params//{}},
Condition0%0/2
$params // {}
l!l
00
MC/DC0%0/1
$params // {}
$params
Truth table0%0/2
A
A= $params
Aresult
11
00
105 payment_method_token => $token,
106 });
107 }
108  
109 =head2 sale()
110  
111 This takes a token and an optional hashref of parameters. This delegates to
112 L<WebService::Braintree::Transaction/sale>, setting the
113 C<< payment_method_token >> appropriately.
114  
115 =cut
116  
117 0 ▶sub sale {
Subroutine sale: not called CC=2 SCAR=17.9
Pod documented
118 0 my ($class, $token, $params) = @_;
119 $class->gateway->transaction->sale({
120 0 ▶ %{$params//{}},
Condition0%0/2
$params // {}
l!l
00
MC/DC0%0/1
$params // {}
$params
Truth table0%0/2
A
A= $params
Aresult
11
00
121 payment_method_token => $token,
122 });
123 }
124  
125 =head2 expired()
126  
127 This returns a L<collection|WebService::Braintree::ResourceCollection> of all
128 the expired L<credit cards|WebService::Braintree::_::CreditCard>.
129  
130 C<< expired_cards() >> is an alias to this method.
131  
132 =cut
133  
134 0 ▶sub expired {
Subroutine expired: not called CC=1 SCAR=6.9
Pod documented
135 0 my ($class) = @_;
136 0 $class->gateway->credit_card->expired();
137 }
138  
139 0 ▶sub expired_cards {
Subroutine expired_cards: not called CC=1 SCAR=6.9
Pod undocumented
140 0 shift->expired(@_);
141 }
142  
143 =head2 expiring_between()
144  
145 This takes two L<DateTime>s and returns a L<collection|WebService::Braintree::ResourceCollection> of all the L<credit cards|WebService::Braintree::_::CreditCard>
146 expiring between them.
147  
148 =cut
149  
150 0 ▶sub expiring_between {
Subroutine expiring_between: not called CC=1 SCAR=6.9
Pod documented
151 0 my ($class, $start, $end) = @_;
152 0 $class->gateway->credit_card->expiring_between($start, $end);
153 }
154  
155 22 __PACKAGE__->meta->make_immutable;
156  
157 22 1;
158 __END__
« lib/WebService/Braintree/_/CreditCard.pm ↑ Summary blib/lib/WebService/Braintree/Test.pm »