blib/lib/Business/OnlinePayment/CardConnect.pm

filter: Statementstmt 66.1% 133 / 201 Branchbran 45.1% 28 / 62 Conditioncond 33.3% 7 / 21 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 86.2% 25 / 29 Podpod 100% 7 / 7 totaltotal 60.2% 200 / 332 CC 43 SCAR 20.3
CC
43
Cov
59%
_cardconnect_auth
22.6
_cardconnect_add_level2
15.6
_cardconnect_refund
12.0
CRAP 7.6
↑ Summary
1 package Business::OnlinePayment::CardConnect;
2 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 ▶use Business::OnlinePayment;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Business::OnlinePayment::HTTPS;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use vars qw(@ISA $me $DEBUG);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use URI::Escape;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use HTTP::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use JSON qw(to_json from_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Business::CreditCard qw(cardtype);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use Log::Scrubber qw(disable $SCRUBBER scrubber :Carp scrubber_add_scrubber);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 2 @ISA = qw(Business::OnlinePayment::HTTPS);
17 2 $me = 'Business::OnlinePayment::CardConnect';
18 2 $DEBUG = 0;
19 2 our $VERSION = '0.004'; # VERSION
20  
21 # PODNAME: Business::OnlinePayment::CardConnect
22  
23 # ABSTRACT: Business::OnlinePayment::CardConnect - CardConnect Backend for Business::OnlinePayment
24  
25 =head1 SYNOPSIS
26  
27 This is a plugin for the Business::OnlinePayment interface. Please refer to that documentation for general usage, and here for CardConnect specific usage.
28  
29 In order to use this module, you will need to have an account set up with CardConnect L<https://cardconnect.com>
30  
31 use Business::OnlinePayment;
32 my $tx = Business::OnlinePayment->new("CardConnect");
33  
34 $tx->content(
35 type => 'CC',
36 login => 'testdrive',
37 password => '123qwe',
38 action => 'Normal Authorization',
39 description => 'FOO*Business::OnlinePayment test',
40 amount => '49.95',
41 customer_id => 'tfb',
42 name => 'Tofu Beast',
43 address => '123 Anystreet',
44 city => 'Anywhere',
45 state => 'UT',
46 zip => '84058',
47 card_number => '4007000000027',
48 expiration => '09/02',
49 cvv2 => '1234', #optional
50 invoice_number => '54123',
51 );
52 $tx->submit();
53  
54 if($tx->is_success()) {
55 print "Card processed successfully: ".$tx->authorization."\n";
56 } else {
57 print "Card was rejected: ".$tx->error_message."\n";
58 }
59  
60 =head1 METHODS AND FUNCTIONS
61  
62 See L<Business::OnlinePayment> for the complete list. The following methods either override the methods in L<Business::OnlinePayment> or provide additional functions.
63  
64 =head2 result_code
65  
66 Returns the response error code.
67  
68 =head2 error_message
69  
70 Returns the response error description text.
71  
72 =head2 server_request
73  
74 Returns the complete request that was sent to the server. The request has been stripped of card_num, cvv2, and password. So it should be safe to log.
75  
76 =cut
77  
78 2 ▶sub server_request {
Subroutine server_request: called CC=3 SCAR=11.0
Pod documented
79 2 my ( $self, $val, $tf ) = @_;
80 2 ▶ if ($val) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val) 1 1 2
81 1 $self->{server_request} = scrubber $val;
82 1 ▶ $self->server_request_dangerous($val,1) unless $tf;
Branch: 1 branch
BranchTrueFalseTotal
unless $tf 1 0 1
83 }
84 2 return $self->{server_request};
85 }
86  
87 =head2 server_request_dangerous
88  
89 Returns the complete request that was sent to the server. This could contain data that is NOT SAFE to log. It should only be used in a test environment, or in a PCI compliant manner.
90  
91 =cut
92  
93 1 ▶sub server_request_dangerous {
Subroutine server_request_dangerous: called CC=3 SCAR=11.3
Pod documented
94 1 my ( $self, $val, $tf ) = @_;
95 1 ▶ if ($val) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val) 1 0 1
96 1 $self->{server_request_dangerous} = $val;
97 1 ▶ $self->server_request($val,1) unless $tf;
Branch: 1 branch
BranchTrueFalseTotal
unless $tf 0 1 1
98 }
99 1 return $self->{server_request_dangerous};
100 }
101  
102 =head2 server_response
103  
104 Returns the complete response from the server. The response has been stripped of card_num, cvv2, and password. So it should be safe to log.
105  
106 =cut
107  
108 2 ▶sub server_response {
Subroutine server_response: called CC=3 SCAR=11.0
Pod documented
109 2 my ( $self, $val, $tf ) = @_;
110 2 ▶ if ($val) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val) 1 1 2
111 1 $self->{server_response} = scrubber $val;
112 1 ▶ $self->server_response_dangerous($val,1) unless $tf;
Branch: 1 branch
BranchTrueFalseTotal
unless $tf 1 0 1
113 }
114 2 return $self->{server_response};
115 }
116  
117 =head2 server_response_dangerous
118  
119 Returns the complete response from the server. This could contain data that is NOT SAFE to log. It should only be used in a test environment, or in a PCI compliant manner.
120  
121 =cut
122  
123 1 ▶sub server_response_dangerous {
Subroutine server_response_dangerous: called CC=3 SCAR=11.3
Pod documented
124 1 my ( $self, $val, $tf ) = @_;
125 1 ▶ if ($val) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val) 1 0 1
126 1 $self->{server_response_dangerous} = $val;
127 1 ▶ $self->server_response($val,1) unless $tf;
Branch: 1 branch
BranchTrueFalseTotal
unless $tf 0 1 1
128 }
129 1 return $self->{server_response_dangerous};
130 }
131  
132 =head1 Handling of content(%content) data:
133  
134 =head2 action
135  
136 The following actions are valid
137  
138 normal authorization
139 authorization only
140 post authorization
141 credit
142 void
143 auth reversal
144  
145 =head1 TESTING
146  
147 In order to run the provided test suite, you will first need to apply and get your account setup with CyberSource. Then you can use the test account information they give you to run the test suite. The scripts will look for three environment variables to connect: BOP_USERNAME, BOP_PASSWORD, BOP_MERCHANTID
148  
149 =head1 FUNCTIONS
150  
151 =head2 _info
152  
153 Return the introspection hash for BOP 3.x
154  
155 =cut
156  
157 =head2 _info
158  
159 Return the introspection hash for BOP 3.x
160  
161 =cut
162  
163 0 ▶sub _info {
Subroutine _info: not called CC=1 SCAR=6.9
164 return {
165 0 info_compat => '0.01',
166 gateway_name => 'CyberSource - SOAP Toolkit API',
167 gateway_url => 'http://www.cybersource.com',
168 module_version => $Business::OnlinePayment::CardConnect::VERSION,
169 supported_types => ['CC','ECHECK'],
170 supported_actions => {
171 CC => [
172 'Normal Authorization',
173 'Post Authorization',
174 'Authorization Only',
175 'Credit',
176 'Void',
177 'Auth Reversal',
178 ],
179 },
180 };
181 }
182  
183 =head2 set_defaults
184  
185 Used by BOP to set default values during "new"
186  
187 =cut
188  
189 1 ▶sub set_defaults {
Subroutine set_defaults: called CC=1 SCAR=0.0
Pod documented
190 1 my $self = shift;
191 1 my %opts = @_;
192  
193 1 $self->build_subs(
194 qw( order_number md5 avs_code cvv2_response card_token cavv_response failure_status verify_SSL )
195 );
196  
197 1 $self->build_subs( # built only for backwards compatibily with old cybersource moose version
198 qw( response_code response_headers response_page login password require_avs )
199 );
200  
201 1 $self->test_transaction(0);
202 1 $self->{_scrubber} = \&_default_scrubber;
203 }
204  
205 =head2 test_transaction
206  
207 Get/set the server used for processing transactions. Possible values are Live, Certification, and Sandbox
208 Default: Live
209  
210 #Live
211 $self->test_transaction(0);
212  
213 #Test
214 $self->test_transaction(1); # currently not different from live
215  
216 #Read current value
217 $val = $self->test_transaction();
218  
219 =cut
220  
221 2 ▶sub test_transaction {
Subroutine test_transaction: called CC=3 SCAR=11.7
Pod documented
222 2 my $self = shift;
223 2 my $testMode = shift;
224 0 ▶ if (! defined $testMode) { $testMode = $self->{'test_transaction'} || 0; }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $testMode) 0 2 2
Condition0%0/2
$self->{'test_transaction'} || 0
l!l
00
MC/DC0%0/1
$self->{'test_transaction'} || 0
$self->{'test_transaction'}
Truth table0%0/2
A
A= $self->{'test_transaction'}
Aresult
11
00
225  
226 2 $self->require_avs(0);
227 2 $self->verify_SSL(0);
228 2 $self->port('6443');
229 2 $self->path('/cardconnect/rest/auth');
230 2 $self->server('fts.cardconnect.com');
231 2 $self->SUPER::test_transaction($testMode);
232 }
233  
234 =head2 submit
235  
236 Submit your transaction to cybersource
237  
238 =cut
239  
240 1 ▶sub submit {
Subroutine submit: called CC=4 SCAR=14.5
Pod documented
241 1 my ($self) = @_;
242 1 local $SCRUBBER=1;
243 1 $self->_cardconnect_init;
244 1 my %content = $self->content();
245  
246 1 my $action_map = {
247 'Normal Authorization' => 'auth', # this method auto detects when capture is needed
248 'Authorization Only' => 'auth',
249 'Post Authorization' => 'capture',
250 'Void' => 'void',
251 'Auth Reversal' => 'void',
252 'Credit' => 'refund',
253 };
254 1 ▶ my $action = $action_map->{$content{'action'}} || die "Unsupported action: ".$content{'action'};
Condition50%1/2
$$action_map{$content{'action'}} || die('Unsupported action: ' . $content{'action'})
l!l
10
MC/DC0%0/1
$$action_map{$content{'action'}} || die('Unsupported action: ' . $content{'action'})
$$action_map{$content{'action'}}
Truth table50%1/2
A
A= $$action_map{$content{'action'}}
Aresult
11
00
255 1 ▶ die 'Amount must contain a decimal' if defined $content{'amount'} && $content{'amount'} !~ /\./;
Branch: 1 branch
BranchTrueFalseTotal
if defined $content{"amount"} and not $content{"amount"} =~ /\./ 0 1 1
Condition33%1/3
defined $content{"amount"} and not $content{"amount"} =~ /\./
!ll&&!rl&&r
010
MC/DC0%0/2
defined $content{"amount"} and not $content{"amount"} =~ /\./
defined $content{"amount"} not $content{"amount"} =~ /\./
Truth table33%1/3
A and not(B)
A= defined $content{"amount"}B= not $content{"amount"} =~ /\./
ABresult
0X0
100
111
256  
257 1 my $method = '_cardconnect_'.$action;
258 1 return $self->$method();
259 }
260  
261 0 ▶sub _cardconnect_void {
Subroutine _cardconnect_void: not called CC=2 SCAR=17.9
262 0 my ($self) = @_;
263 0 my %content = $self->content();
264  
265 my $post_data = {
266 retref => $content{'order_number'},
267 0 merchid => $content{'merchantid'},
268 };
269  
270 0 my $page = $self->_do_put_request( 'void', $post_data );
271 0 my $response = $page->{'content_json'};
272  
273 0 ▶ $self->is_success($response->{'respstat'} eq 'A' ? $response : undef);
Branch: 1 branch
BranchTrueFalseTotal
$response->{'respstat'} eq 'A' ? : 0 0 0
274 0 $self->result_code($response->{'respstat'});
275 0 $self->order_number($response->{'retref'});
276 0 $self->error_message($response->{'resptext'});
277  
278 0 return $response;
279 }
280  
281 0 ▶sub _cardconnect_refund {
Subroutine _cardconnect_refund: not called CC=3 SCAR=24.8
282 0 my ($self) = @_;
283 0 my %content = $self->content();
284  
285 my $post_data = {
286 retref => $content{'order_number'},
287 0 merchid => $content{'merchantid'},
288 };
289 0 ▶ $post_data->{'amount'} = $content{'amount'} if defined $content{'amount'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $content{"amount"} 0 0 0
290  
291 0 my $page = $self->_do_put_request( 'capture', $post_data );
292 0 my $response = $page->{'content_json'};
293  
294 0 ▶ $self->is_success($response->{'respstat'} eq 'A' ? $response : undef);
Branch: 1 branch
BranchTrueFalseTotal
$response->{'respstat'} eq 'A' ? : 0 0 0
295 0 $self->result_code($response->{'respstat'});
296 0 $self->order_number($response->{'retref'});
297 0 $self->error_message($response->{'resptext'});
298 0 $self->order_number($response->{'retref'});
299 0 $self->error_message($response->{'resptext'});
300 0 $self->card_token($response->{'token'});
301  
302 0 return $response;
303 }
304  
305 0 ▶sub _cardconnect_capture {
Subroutine _cardconnect_capture: not called CC=3 SCAR=24.8
306 0 my ($self) = @_;
307 0 my %content = $self->content();
308  
309 my $post_data = {
310 retref => $content{'order_number'},
311 0 merchid => $content{'merchantid'},
312 };
313 0 ▶ $post_data->{'amount'} = $content{'amount'} if defined $content{'amount'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $content{"amount"} 0 0 0
314 0 $self->_cardconnect_add_level2($post_data);
315  
316 0 my $page = $self->_do_put_request( 'capture', $post_data );
317 0 my $response = $page->{'content_json'};
318  
319 0 ▶ $self->is_success($response->{'respstat'} eq 'A' ? $response : undef);
Branch: 1 branch
BranchTrueFalseTotal
$response->{'respstat'} eq 'A' ? : 0 0 0
320 0 $self->result_code($response->{'respstat'});
321 0 $self->order_number($response->{'retref'});
322 0 $self->error_message($response->{'resptext'});
323 0 $self->order_number($response->{'retref'});
324 0 $self->error_message($response->{'resptext'});
325 0 $self->card_token($response->{'token'});
326  
327 0 return $response;
328 }
329  
330 1 ▶sub _cardconnect_add_level2 {
Subroutine _cardconnect_add_level2: called CC=7 SCAR=27.5
331 1 my ($self,$post_data) = @_;
332 1 my %content = $self->content();
333 1 ▶ $post_data->{'ponumber'} = $content{'po_number'} if defined $content{'po_number'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $content{"po_number"} 0 1 1
334 1 ▶ $post_data->{'shiptozip'} = $content{'ship_zip'} if defined $content{'ship_zip'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $content{"ship_zip"} 0 1 1
335 1 ▶ $post_data->{'taxamnt'} = $content{'tax'} if defined $content{'tax'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $content{"tax"} 0 1 1
336 0 ▶ if ( defined $content{'products'} && scalar( @{ $content{'products'} } ) < 100 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $content{"products"} and scalar @{$content{"products"};} < 100) 0 1 1
Condition33%1/3
defined $content{"products"} and scalar @{$content{"products"};} < 100
!ll&&!rl&&r
100
MC/DC0%0/2
defined $content{"products"} and scalar @{$content{"products"};} < 100
defined $content{"products"} scalar @{$content{"products"};} < 100
Truth table33%1/3
A and B
A= defined $content{"products"}B= scalar @{$content{"products"};} < 100
ABresult
0X0
100
111
337 0 my @products;
338 0 my $lineno = 0;
339 0 foreach my $productOrig ( @{ $content{'products'} } ) {
340 0 $lineno++;
341 my $item = {
342 "discamnt" => $productOrig->{'discount'},
343 "unitcost" => $productOrig->{'cost'},
344 "lineno" => $lineno,
345 "description" => $productOrig->{'description'},
346 "taxamnt" => $productOrig->{'tax'},
347 "quantity" => $productOrig->{'quantity'},
348 0 "netamnt" => $productOrig->{'amount'},
349 #"upc" => "UPC-1",
350 #"material" => "MATERIAL-1"
351 };
352 0 push @products, $item;
353 }
354 }
355 }
356  
357 1 ▶sub _cardconnect_auth {
Subroutine _cardconnect_auth: called CC=8 SCAR=31.2
358 1 my ($self) = @_;
359 1 my %content = $self->content();
360  
361 1 my $post_data = {};
362 1 ▶ if ($content{'routing_code'} && $content{'account_number'}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($content{'routing_code'} and $content{'account_number'}) { } 0 1 1
elsif ($content{'card_number'}) { } 1 0 1
Condition33%1/3
$content{"routing_code"} and $content{"account_number"}
!ll&&!rl&&r
100
MC/DC0%0/2
$content{"routing_code"} and $content{"account_number"}
$content{"routing_code"} $content{"account_number"}
Truth table33%1/3
A and B
A= $content{"routing_code"}B= $content{"account_number"}
ABresult
0X0
100
111
363 $post_data = {
364 accttype => 'ECHK',
365 account => $content{'account_number'},
366 bankaba => $content{'routing_code'},
367 merchid => $content{'merchantid'},
368 name => $content{'first_name'}.' '.$content{'last_name'},
369 amount => $content{'amount'},
370 0 ▶ currency => $content{'currency'} || "USD",
Condition0%0/2
$content{'currency'} || 'USD'
l!l
00
MC/DC0%0/1
$content{'currency'} || 'USD'
$content{'currency'}
Truth table0%0/2
A
A= $content{'currency'}
Aresult
11
00
371 }
372 } elsif ($content{'card_number'}) {
373 1 $content{'expiration'} =~ s/\///; # CardConnect doesn't want the / between MM and YY
374 $post_data = {
375 merchid => $content{'merchantid'},
376 orderid => $content{'invoice_number'},
377  
378 account => $content{'card_number'},
379 expiry => $content{'expiration'},
380 cvv2 => $content{'cvv2'},
381  
382 amount => $content{'amount'},
383 currency => $content{'currency'} || "USD",
384 name => $content{'first_name'}.' '.$content{'last_name'},
385 address => $content{'address'},
386 city => $content{'city'},
387 region => $content{'state'},
388 country => $content{'country'},
389 postal => $content{'zip'},
390 email => $content{'email'},
391 ecomind => "E",
392 track => undef,
393 tokenize => "Y",
394 userfields => [
395 1 ▶ { description => $content{'description'} },
Condition50%1/2
$content{'currency'} || 'USD'
l!l
01
MC/DC0%0/1
$content{'currency'} || 'USD'
$content{'currency'}
Truth table50%1/2
A
A= $content{'currency'}
Aresult
11
00
396 ],
397 };
398 1 $self->_cardconnect_add_level2($post_data);
399 } else {
400 0 die 'Unsupported payment method';
401 }
402 1 ▶ $post_data->{'capture'} = "Y" if $content{'action'} eq 'Normal Authorization';
Branch: 1 branch
BranchTrueFalseTotal
if $content{"action"} eq "Normal Authorization" 0 1 1
403  
404 1 my $page = $self->_do_put_request( 'auth', $post_data );
405 0 my $response = $page->{'content_json'};
406  
407 0 ▶ $self->is_success($response->{'respstat'} eq 'A' ? $response : undef);
Branch: 1 branch
BranchTrueFalseTotal
$response->{'respstat'} eq 'A' ? : 0 0 0
408 0 $self->result_code($response->{'respstat'});
409 0 $self->authorization($response->{'authcode'});
410 0 $self->order_number($response->{'retref'});
411 0 $self->error_message($response->{'resptext'});
412 0 $self->card_token($response->{'token'});
413 0 $self->avs_code($response->{'avsresp'});
414 0 $self->cvv2_response($response->{'cvvresp'});
415  
416 0 return $response;
417 }
418  
419 1 ▶sub _do_put_request {
Subroutine _do_put_request: called CC=6 SCAR=20.7
420 1 my ($self, $action, $post_data) = @_;
421 1 my %content = $self->content(); # needed for basic auth
422 1 my $options = {
423 headers => {
424 'Content-Type' => 'application/json',
425 },
426 content => to_json $post_data,
427 };
428 1 $self->login($content{'login'});
429 1 $self->password($content{'password'});
430 1 my $url= 'https://'.uri_escape($content{'login'}).':'.uri_escape($content{'password'}).'@fts.cardconnect.com:6443/cardconnect/rest/'.$action;
431 1 $self->server_request( $url."\n\n".$options->{'content'} );
432 1 ▶ warn $self->server_request if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Business::OnlinePayment::CardConnect::DEBUG 0 1 1
433 1 my $page = HTTP::Tiny->new->request('PUT', $url, $options);
434 1 $self->server_response( $page );
435 1 ▶ warn Dumper $self->server_response if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Business::OnlinePayment::CardConnect::DEBUG 0 1 1
436 1 ▶ if ($page->{'status'} eq '200') {
Branch: 2 branches
BranchTrueFalseTotal
if ($page->{'status'} eq '200') { } 0 1 1
elsif ($page->{'status'} eq '401') { } 0 1 1
437 0 $page->{'content_json'} = eval { from_json $page->{'content'}; }
438 } elsif ($page->{'status'} eq '401') {
439 0 $page->{'content_json'} = {
440 respstat => 'U',
441 resptext => 'This request requires authentication.',
442 };
443 } else {
444 1 $page->{'content_json'} = {
445 respstat => 'U',
446 resptext => 'Unknown response from payment gateway.',
447 };
448 }
449 1 my $e = $@;
450 1 ▶ die "Could not process JSON: ".$e if ($e);
Branch: 1 branch
BranchTrueFalseTotal
if $e 1 0 1
451 0 $self->response_code($page->{'status'});
452 0 $self->response_headers($page->{'headers'});
453 0 $self->response_page($page->{'content'});
454 0 return $page;
455 }
456  
457 1 ▶sub _default_scrubber {
Subroutine _default_scrubber: called CC=1 SCAR=0.0
458 1 my $cc = shift;
459 1 my $del = substr($cc,0,6).('X'x(length($cc)-10)).substr($cc,-4,4); # show first 6 and last 4
460 1 return $del;
461 }
462  
463 1 ▶sub _cardconnect_scrubber_add_card {
Subroutine _cardconnect_scrubber_add_card: called CC=2 SCAR=7.0
464 1 my ( $self, $cc ) = @_;
465 1 ▶ return if ! $cc;
Branch: 1 branch
BranchTrueFalseTotal
unless $cc 0 1 1
466 1 my $scrubber = $self->{_scrubber};
467 1 scrubber_add_scrubber({quotemeta($cc)=>&{$scrubber}($cc)});
468 }
469  
470 1 ▶sub _cardconnect_init {
Subroutine _cardconnect_init: called CC=6 SCAR=18.2
471 1 my ( $self, $opts ) = @_;
472  
473 # initialize/reset the reporting methods
474 1 $self->is_success(0);
475 1 $self->server_request('');
476 1 $self->server_response('');
477 1 $self->error_message('');
478  
479 # some calls are passed via the content method, others are direct arguments... this way we cover both
480 1 my %content = $self->content();
481 1 foreach my $ptr (\%content,$opts) {
482 2 ▶ next if ! $ptr;
Branch: 1 branch
BranchTrueFalseTotal
unless $ptr 1 1 2
483 scrubber_init({
484 quotemeta($ptr->{'password'}||'')=>'DELETED',
485 quotemeta($ptr->{'ftp_password'}||'')=>'DELETED',
486 1 ▶ ($ptr->{'cvv2'} ? '(?<=[^\d])'.quotemeta($ptr->{'cvv2'}).'(?=[^\d])' : '')=>'DELETED',
Branch: 1 branch
BranchTrueFalseTotal
$ptr->{'cvv2'} ? : 1 0 1
Condition50%2/4
$ptr->{'password'} || ''
l!l
10
$ptr->{'ftp_password'} || ''
l!l
01
MC/DC0%0/1
$ptr->{'password'} || ''
$ptr->{'password'}
MC/DC0%0/1
$ptr->{'ftp_password'} || ''
$ptr->{'ftp_password'}
Truth table50%1/2
A
A= $ptr->{'password'}
Aresult
11
00
Truth table50%1/2
A
A= $ptr->{'ftp_password'}
Aresult
11
00
487 });
488 1 $self->_cardconnect_scrubber_add_card($ptr->{'card_number'});
489 }
490 }
491  
492 2 1;
↑ Summary