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 7     7   28440 use strict;
  7         18  
  7         203  
4 6     6   28 use Carp;
  6         10  
  6         342  
5 6     6   1624 use Business::OnlinePayment;
  6         6929  
  6         151  
6 6     6   31 use vars qw($VERSION @ISA $me);
  6         11  
  6         1691  
7              
8             @ISA = qw(Business::OnlinePayment);
9             $VERSION = '3.23';
10             $me = 'Business::OnlinePayment::AuthorizeNet';
11              
12             sub set_defaults {
13 5     5 0 2357 my $self = shift;
14              
15 5         33 $self->build_subs(qw( order_number md5 avs_code cvv2_response
16             cavv_response
17             ));
18             }
19              
20             sub _map_processor {
21 7     7   14 my($self) = @_;
22              
23 7         27 my %content = $self->content();
24 7         141 my %processors = ('recurring authorization' => 'ARB',
25             'modify recurring authorization' => 'ARB',
26             'cancel recurring authorization' => 'ARB',
27             );
28 7 100       104 $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     2   2729  
  4         13  
  4         130  
  2         21  
  2         5  
  2         40  
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__