File Coverage

blib/lib/Business/OnlinePayment/AuthorizeNet.pm
Criterion Covered Total %
statement 24 32 75.0
branch 2 4 50.0
condition n/a
subroutine 8 9 88.8
pod 1 2 50.0
total 35 47 74.4


line stmt bran cond sub pod time code
1             package Business::OnlinePayment::AuthorizeNet;
2              
3 5     5   42001 use strict;
  5         13  
  5         194  
4 5     5   27 use Carp;
  5         12  
  5         376  
5 5     5   1309 use Business::OnlinePayment;
  5         3670  
  5         168  
6 5     5   29 use vars qw($VERSION @ISA $me);
  5         7  
  5         1607  
7              
8             @ISA = qw(Business::OnlinePayment);
9             $VERSION = '3.22';
10             $me = 'Business::OnlinePayment::AuthorizeNet';
11              
12             sub set_defaults {
13 5     5 0 1443 my $self = shift;
14              
15 5         34 $self->build_subs(qw( order_number md5 avs_code cvv2_response
16             cavv_response
17             ));
18             }
19              
20             sub _map_processor {
21 5     5   10 my($self) = @_;
22              
23 5         17 my %content = $self->content();
24 5         1167 my %processors = ('recurring authorization' => 'ARB',
25             'modify recurring authorization' => 'ARB',
26             'cancel recurring authorization' => 'ARB',
27             );
28 5 100       61 $processors{lc($content{'action'})} || 'AIM';
29             }
30              
31             sub submit {
32 0     0 1 0 my($self) = @_;
33              
34 0         0 my $processor = $me. "::". $self->_map_processor();
35              
36 0     4   0 eval "use $processor";
  4     1   2727  
  3         11  
  3         95  
  1         10  
  1         2  
  1         20  
37 0 0       0 croak("unknown processor $processor ($@)") if $@;
38            
39 0         0 my $object = bless $self, $processor;
40 0         0 $object->set_defaults();
41 0         0 $object->submit();
42 0         0 bless $self, $me;
43             }
44              
45             1;
46             __END__