Braintree/WebhookNotification.pm

filter: Statementstmt 20.9% 9 / 43 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 2 / 6 Podpod 0.0% 0 / 4 totaltotal 15.9% 11 / 69 CC 9 SCAR 40.7
CC
9
Cov
15%
BUILD
90.0
parse
2.0
verify
2.0
CRAP 58.4
↑ Summary Braintree/Validations.pm »
1 package Net::Braintree::WebhookNotification;
2  
3 1 ▶use Net::Braintree::WebhookNotification::Kind;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 extends 'Net::Braintree::ResultObject';
7  
8 1 my $meta = __PACKAGE__->meta;
9  
10 0 ▶sub BUILD {
Subroutine BUILD: not called CC=9 SCAR=45.0
Pod undocumented
11 0 my ($self, $attributes) = @_;
12  
13 0 my $wrapper_node = $attributes->{subject};
14  
15 0 ▶ if (ref($wrapper_node->{api_error_response}) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $wrapper_node->{"api_error_response"} eq "HASH") 0 0 0
16 0 $wrapper_node = $wrapper_node->{api_error_response};
17 }
18  
19 0 ▶ if (ref($wrapper_node->{subscription}) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $wrapper_node->{"subscription"} eq "HASH") 0 0 0
20 0 $meta->add_attribute('subscription', is => 'rw');
21 0 $self->subscription(Net::Braintree::Subscription->new($wrapper_node->{subscription}));
22 }
23  
24 0 ▶ if (ref($wrapper_node->{merchant_account}) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $wrapper_node->{"merchant_account"} eq "HASH") 0 0 0
25 0 $meta->add_attribute('merchant_account', is => 'rw');
26 0 $self->merchant_account(Net::Braintree::MerchantAccount->new($wrapper_node->{merchant_account}));
27 }
28  
29 0 ▶ if (ref($wrapper_node->{disbursement}) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $wrapper_node->{"disbursement"} eq "HASH") 0 0 0
30 0 $meta->add_attribute('disbursement', is => 'rw');
31 0 $self->disbursement(Net::Braintree::Disbursement->new($wrapper_node->{disbursement}));
32 }
33  
34 0 ▶ if (ref($wrapper_node->{transaction}) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $wrapper_node->{"transaction"} eq "HASH") 0 0 0
35 0 $meta->add_attribute('transaction', is => 'rw');
36 0 $self->transaction(Net::Braintree::Transaction->new($wrapper_node->{transaction}));
37 }
38  
39 0 ▶ if (ref($wrapper_node->{partner_merchant}) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $wrapper_node->{"partner_merchant"} eq "HASH") 0 0 0
40 0 $meta->add_attribute('partner_merchant', is => 'rw');
41 0 $self->partner_merchant(Net::Braintree::PartnerMerchant->new($wrapper_node->{partner_merchant}));
42 }
43  
44 0 ▶ if (ref($wrapper_node->{dispute}) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $wrapper_node->{"dispute"} eq "HASH") 0 0 0
45 0 $meta->add_attribute('dispute', is => 'rw');
46 0 $self->dispute(Net::Braintree::Dispute->new($wrapper_node->{dispute}));
47 }
48  
49 0 ▶ if (ref($wrapper_node->{errors}) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $wrapper_node->{"errors"} eq "HASH") 0 0 0
50 0 $meta->add_attribute('errors', is => 'rw');
51 0 $meta->add_attribute('message', is => 'rw');
52 0 $self->errors(Net::Braintree::ValidationErrorCollection->new($wrapper_node->{errors}));
53 0 $self->message($wrapper_node->{message});
54 }
55  
56 0 delete($attributes->{subject});
57 0 $self->set_attributes_from_hash($self, $attributes);
58 }
59  
60 0 ▶sub parse {
Subroutine parse: not called CC=1 SCAR=6.9
Pod undocumented
61 0 my ($class, $signature, $payload) = @_;
62 0 $class->gateway->webhook_notification->parse($signature, $payload);
63 }
64  
65 0 ▶sub verify {
Subroutine verify: not called CC=1 SCAR=6.9
Pod undocumented
66 0 my ($class, $params) = @_;
67 0 $class->gateway->webhook_notification->verify($params);
68 }
69  
70 0 ▶sub gateway {
Subroutine gateway: not called CC=1 SCAR=6.9
Pod undocumented
71 0 return Net::Braintree->configuration->gateway;
72 }
73  
74 1 1;
↑ Summary Braintree/Validations.pm »