Braintree/CreditCardVerificationGateway.pm

filter: Statementstmt 34.3% 11 / 32 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 3 / 9 Podpod 0.0% 0 / 4 totaltotal 28.5% 14 / 49 CC 3 SCAR 11.6
CC
3
Cov
31%
find
6.0
fetch_verifications
6.0
search
2.0
CRAP 3.2
« Braintree/CustomerGateway.pm ↑ Summary Braintree/SettlementBatchSummaryGateway.pm »
1 package Net::Braintree::CreditCardVerificationGateway;
2 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Net::Braintree::CreditCardVerificationSearch;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Net::Braintree::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 has 'gateway' => (is => 'ro');
7  
8 sub find {
9 0 ▶ my ($self, $id) = @_;
Subroutine find: not called CC=2 SCAR=17.9
Pod undocumented
10 0 ▶ confess "NotFoundError" unless validate_id($id);
Branch: 1 branch
BranchTrueFalseTotal
unless validate_id($id) 0 0 0
11 0 my $response = $self->gateway->http->get("/verifications/$id");
12 0 return Net::Braintree::CreditCardVerification->new($response->{'verification'});
13 }
14  
15 sub search {
16 0 ▶ my ($self, $block) = @_;
Subroutine search: not called CC=1 SCAR=6.9
Pod undocumented
17 0 my $search = Net::Braintree::CreditCardVerificationSearch->new;
18 0 my $params = $block->($search)->to_hash;
19 0 my $response = $self->gateway->http->post("/verifications/advanced_search_ids", {search => $params});
20 return Net::Braintree::ResourceCollection->new()->init($response, sub {
21 0 ▶ $self->fetch_verifications($search, shift);
Subroutine __ANON__: not called CC=1 SCAR=6.9
22 0 });
23 }
24  
25 sub all {
26 0 ▶ my $self = shift;
Subroutine all: not called CC=1 SCAR=6.9
Pod undocumented
27 0 my $response = $self->gateway->http->post("/verifications/advanced_search_ids");
28 return Net::Braintree::ResourceCollection->new()->init($response, sub {
29 0 ▶ $self->fetch_verifications(Net::Braintree::CreditCardVerificationSearch->new, shift);
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 0 });
31 }
32  
33 sub fetch_verifications {
34 0 ▶ my ($self, $search, $ids) = @_;
Subroutine fetch_verifications: not called CC=2 SCAR=17.9
Pod undocumented
35 0 $search->ids->in($ids);
36 0 ▶ return [] if scalar @{$ids} == 0;
Branch: 1 branch
BranchTrueFalseTotal
if scalar @{$ids;} == 0 0 0 0
37 0 my $response = $self->gateway->http->post("/verifications/advanced_search/", {search => $search->to_hash});
38 0 my $attrs = $response->{'credit_card_verifications'}->{'verification'};
39 0 return to_instance_array($attrs, "Net::Braintree::CreditCardVerification");
40 }
41  
42 1 1;
« Braintree/CustomerGateway.pm ↑ Summary Braintree/SettlementBatchSummaryGateway.pm »