Braintree/MerchantAccountGateway.pm

filter: Statementstmt 44.7% 17 / 38 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 38.4% 5 / 13 Podpod 0.0% 0 / 3 totaltotal 35.4% 22 / 62 CC 5 SCAR 12.8
CC
5
Cov
37%
create
6.0
update
6.0
find
6.0
CRAP 3.6
« Braintree/DisbursementDetails.pm ↑ Summary Braintree/MerchantAccount/BusinessDetails.pm »
1 package Net::Braintree::MerchantAccountGateway;
2 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Carp qw(confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Net::Braintree::Validations qw(verify_params);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Net::Braintree::Util qw(validate_id);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Net::Braintree::Result;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 has 'gateway' => (is => 'ro');
9  
10 0 ▶sub create {
Subroutine create: not called CC=2 SCAR=17.9
Pod undocumented
11 0 my ($self, $params) = @_;
12 0 ▶ confess "ArgumentError" unless verify_params($params, _detect_signature($params));
Branch: 1 branch
BranchTrueFalseTotal
unless verify_params($params, _detect_signature($params)) 0 0 0
13 0 $self->_make_request("/merchant_accounts/create_via_api", "post", {merchant_account => $params});
14 }
15  
16 0 ▶sub update {
Subroutine update: not called CC=2 SCAR=17.9
Pod undocumented
17 0 my ($self, $merchant_account_id, $params) = @_;
18 0 ▶ confess "ArgumentError" unless verify_params($params, _update_signature());
Branch: 1 branch
BranchTrueFalseTotal
unless verify_params($params, _update_signature()) 0 0 0
19 0 $self->_make_request("/merchant_accounts/${merchant_account_id}/update_via_api", "put", {merchant_account => $params});
20 }
21  
22 0 ▶sub find {
Subroutine find: not called CC=2 SCAR=17.9
Pod undocumented
23 0 my ($self, $id) = @_;
24 0 ▶ confess "NotFoundError" unless validate_id($id);
Branch: 1 branch
BranchTrueFalseTotal
unless validate_id($id) 0 0 0
25 0 my $result = $self->_make_request("/merchant_accounts/$id", "get", undef)->merchant_account;
26 }
27  
28 0 ▶sub _make_request {
Subroutine _make_request: not called CC=1 SCAR=6.9
29 0 my($self, $path, $verb, $params) = @_;
30 0 my $response = $self->gateway->http->$verb($path, $params);
31 0 my $result = Net::Braintree::Result->new(response => $response);
32 0 return $result;
33 }
34  
35 0 ▶sub _detect_signature {
Subroutine _detect_signature: not called CC=2 SCAR=17.9
36 0 my ($params) = @_;
37 0 ▶ if (ref($params->{applicant_details}) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $params->{'applicant_details'} eq 'HASH') { } 0 0 0
38 0 warnings::warnif("deprecated", "[DEPRECATED] Passing applicant_details to create is deprecated. Please use individual, business, and funding.");
39 0 return _deprecated_create_signature();
40 } else {
41 0 return _create_signature();
42 }
43 }
44  
45 0 ▶sub _deprecated_create_signature{
Subroutine _deprecated_create_signature: not called CC=1 SCAR=6.9
46 return {
47 0 applicant_details => {
48 company_name => ".",
49 first_name => ".",
50 last_name => ".",
51 email => ".",
52 phone => ".",
53 date_of_birth => ".",
54 ssn => ".",
55 tax_id => ".",
56 routing_number => ".",
57 account_number => ".",
58 address => {
59 street_address => ".",
60 postal_code => ".",
61 locality => ".",
62 region => ".",
63 }
64 },
65 tos_accepted => ".",
66 master_merchant_account_id => ".",
67 id => "."
68 };
69 }
70  
71 0 ▶sub _create_signature{
Subroutine _create_signature: not called CC=1 SCAR=6.9
72 return {
73 0 individual => {
74 first_name => ".",
75 last_name => ".",
76 email => ".",
77 phone => ".",
78 date_of_birth => ".",
79 ssn => ".",
80 address => {
81 street_address => ".",
82 postal_code => ".",
83 locality => ".",
84 region => ".",
85 }
86 },
87 business => {
88 legal_name => ".",
89 dba_name => ".",
90 tax_id => ".",
91 address => {
92 street_address => ".",
93 postal_code => ".",
94 locality => ".",
95 region => ".",
96 }
97 },
98 funding => {
99 destination => ".",
100 email => ".",
101 mobile_phone => ".",
102 routing_number => ".",
103 account_number => ".",
104 descriptor => ".",
105 },
106 tos_accepted => ".",
107 master_merchant_account_id => ".",
108 id => "."
109 };
110 }
111  
112 0 ▶sub _update_signature{
Subroutine _update_signature: not called CC=1 SCAR=6.9
113 return {
114 0 individual => {
115 first_name => ".",
116 last_name => ".",
117 email => ".",
118 phone => ".",
119 date_of_birth => ".",
120 ssn => ".",
121 address => {
122 street_address => ".",
123 postal_code => ".",
124 locality => ".",
125 region => ".",
126 }
127 },
128 business => {
129 legal_name => ".",
130 dba_name => ".",
131 tax_id => ".",
132 address => {
133 street_address => ".",
134 postal_code => ".",
135 locality => ".",
136 region => ".",
137 }
138 },
139 funding => {
140 destination => ".",
141 email => ".",
142 mobile_phone => ".",
143 routing_number => ".",
144 account_number => ".",
145 descriptor => ".",
146 },
147 master_merchant_account_id => ".",
148 id => "."
149 };
150 }
151  
152 1 1;
« Braintree/DisbursementDetails.pm ↑ Summary Braintree/MerchantAccount/BusinessDetails.pm »