line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::3DSecure; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1340
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
7
|
use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
105
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
982
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require Exporter; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
@ISA = qw( Exporter AutoLoader ); |
13
|
|
|
|
|
|
|
@EXPORT = qw(); |
14
|
|
|
|
|
|
|
@EXPORT_OK = qw(); |
15
|
|
|
|
|
|
|
$VERSION = '0.02'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my %fields = ( |
19
|
|
|
|
|
|
|
is_success => undef, |
20
|
|
|
|
|
|
|
result_code => undef, |
21
|
|
|
|
|
|
|
test_transaction => undef, |
22
|
|
|
|
|
|
|
require_avs => undef, |
23
|
|
|
|
|
|
|
transaction_type => undef, |
24
|
|
|
|
|
|
|
error_message => undef, |
25
|
|
|
|
|
|
|
authorization => undef, |
26
|
|
|
|
|
|
|
server => undef, |
27
|
|
|
|
|
|
|
port => undef, |
28
|
|
|
|
|
|
|
path => undef, |
29
|
|
|
|
|
|
|
server_response => undef, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
0
|
1
|
|
my ( $class, $processor, %data ) = @_; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
Carp::croak( "unspecified processor" ) unless $processor; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $subclass = "${class}::$processor"; |
39
|
|
|
|
|
|
|
|
40
|
0
|
0
|
|
|
|
|
if ( !defined( &$subclass ) ) |
41
|
|
|
|
|
|
|
{ |
42
|
0
|
|
|
|
|
|
eval "use $subclass"; |
43
|
0
|
0
|
|
|
|
|
Carp::croak( "unknown processor $processor ($@)" ) if $@; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $self = bless { processor => $processor }, $subclass; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
$self->build_subs( keys %fields ); |
49
|
0
|
0
|
|
|
|
|
$self->set_defaults() if ( $self->can( "set_defaults" ) ); |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
foreach( keys %data ) |
52
|
|
|
|
|
|
|
{ |
53
|
0
|
|
|
|
|
|
my $key = lc( $_ ); |
54
|
0
|
|
|
|
|
|
my $value = $data{ $_ }; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
$key =~ s/^\-//; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$self->build_subs( $key ); |
59
|
0
|
|
|
|
|
|
$self->$key( $value ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return $self; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub content |
66
|
|
|
|
|
|
|
{ |
67
|
0
|
|
|
0
|
1
|
|
my ( $self, %params ) = @_; |
68
|
|
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
if ( %params ) |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
0
|
|
|
|
|
$self->transaction_type( $params{ type } ) if ( $params{ type } ); |
72
|
0
|
|
|
|
|
|
%{ $self->{ _content } } = %params; |
|
0
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
return %{ $self->{ _content } }; |
|
0
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub required_fields |
79
|
|
|
|
|
|
|
{ |
80
|
0
|
|
|
0
|
1
|
|
my ( $self, @fields ) = @_; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my %content = $self->content(); |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
foreach( @fields ) |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
0
|
|
|
|
|
Carp::croak( "missing required field $_" ) unless exists $content{ $_ }; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub get_fields |
91
|
|
|
|
|
|
|
{ |
92
|
0
|
|
|
0
|
1
|
|
my ( $self, @fields ) = @_; |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
my %content = $self->content(); |
95
|
0
|
|
|
|
|
|
my %new = (); |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
foreach( @fields ) |
98
|
|
|
|
|
|
|
{ |
99
|
0
|
|
|
|
|
|
$new{ $_ } = $content{ $_ }; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
return %new; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub remap_fields |
106
|
|
|
|
|
|
|
{ |
107
|
0
|
|
|
0
|
1
|
|
my ( $self, %map ) = @_; |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
my %content = $self->content(); |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
foreach( %map ) |
112
|
|
|
|
|
|
|
{ |
113
|
0
|
|
|
|
|
|
$content{ $map{ $_ } } = $content{ $_ }; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
$self->content( %content ); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub submit |
120
|
|
|
|
|
|
|
{ |
121
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
Carp::croak( "Processor subclass did not override submit function" ); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub dump_contents |
127
|
|
|
|
|
|
|
{ |
128
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
my %content = $self->content(); |
131
|
0
|
|
|
|
|
|
my $dump = ""; |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
foreach( keys %content ) |
134
|
|
|
|
|
|
|
{ |
135
|
0
|
|
|
|
|
|
$dump .= "$_ = $content{$_}\n"; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
return $dump; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# didnt use AUTOLOAD because Net::SSLeay::AUTOLOAD passes right to |
142
|
|
|
|
|
|
|
# AutoLoader::AUTOLOAD, instead of passing up the chain |
143
|
|
|
|
|
|
|
sub build_subs |
144
|
|
|
|
|
|
|
{ |
145
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
146
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
foreach ( @_ ) |
148
|
|
|
|
|
|
|
{ |
149
|
0
|
|
|
|
|
|
eval "sub $_ { my \$self = shift; if(\@_) { \$self->{$_} = shift; } return \$self->{$_}; }"; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
1; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
__END__ |