lib/WebService/Braintree/PaymentMethod.pm

filter: Statementstmt 50.0% 12 / 24 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 33.3% 3 / 9 Podpod 83.3% 5 / 6 totaltotal 47.6% 20 / 42 CC 2 SCAR 9.2
CC
2
Cov
46%
grant
6.0
create
2.0
update
2.0
CRAP 2.5
« lib/WebService/Braintree/CreditCardVerificationGateway.pm ↑ Summary lib/WebService/Braintree/CustomerGateway.pm »
1 # vim: sw=4 ts=4 ft=perl
2  
3 package WebService::Braintree::PaymentMethod;
4 22 $WebService::Braintree::PaymentMethod::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::PaymentMethod
11  
12 =head1 PURPOSE
13  
14 This class creates and finds payment methods.
15  
16 =cut
17  
18 22 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 22 with 'WebService::Braintree::Role::Interface';
21  
22 =head1 CLASS METHODS
23  
24 =head2 create()
25  
26 This takes a hashref of parameters and returns the payment method created.
27  
28 =cut
29  
30 0 ▶sub create {
Subroutine create: not called CC=1 SCAR=6.9
Pod documented
31 0 my ($class, $params) = @_;
32 0 $class->gateway->payment_method->create($params);
33 }
34  
35 =head2 update()
36  
37 This takes a token and a hashref of parameters. It will update the
38 corresponding payment method (if found) and returns the updated payment method.
39  
40 =cut
41  
42 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
Pod documented
43 0 my ($class, $token, $params) = @_;
44 0 $class->gateway->payment_method->update($token, $params);
45 }
46  
47 =head2 delete()
48  
49 This takes a token and an optional hashref of parameters. It will delete the
50 corresponding payment method (if found).
51  
52 The optional hashref can contain the following key(s):
53  
54 =over 4
55  
56 =item * revoke_all_grants
57  
58 =back
59  
60 =cut
61  
62 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
Pod documented
63 0 my ($class, $token, $params) = @_;
64 0 $class->gateway->payment_method->delete($token, $params);
65 }
66  
67 =head2 grant()
68  
69 This takes a token and grants the corresponding payment method (if found).
70  
71 =cut
72  
73 0 ▶sub grant {
Subroutine grant: not called CC=2 SCAR=17.9
Pod documented
74 0 my ($class, $token, $params) = @_;
75 0 ▶ $class->gateway->payment_method->grant($token, ($params//{}));
Condition0%0/2
$params // {}
l!l
00
MC/DC0%0/1
$params // {}
$params
Truth table0%0/2
A
A= $params
Aresult
11
00
76 }
77  
78 =head2 revoke()
79  
80 This takes a token and revokes the corresponding payment method (if found).
81  
82 =cut
83  
84 0 ▶sub revokes {
Subroutine revokes: not called CC=1 SCAR=6.9
Pod undocumented
85 0 my ($class, $token) = @_;
86 0 $class->gateway->payment_method->revokes($token);
87 }
88  
89 =head2 find()
90  
91 This takes a token and returns the payment method (if it exists).
92  
93 =cut
94  
95 0 ▶sub find {
Subroutine find: not called CC=1 SCAR=6.9
Pod documented
96 0 my ($class, $token) = @_;
97 0 $class->gateway->payment_method->find($token);
98 }
99  
100 22 __PACKAGE__->meta->make_immutable;
101  
102 22 1;
103 __END__
« lib/WebService/Braintree/CreditCardVerificationGateway.pm ↑ Summary lib/WebService/Braintree/CustomerGateway.pm »