| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Business::OnlinePayment::Exact; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
37646
|
use 5.006001; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
48
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
5
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
36
|
|
|
6
|
1
|
|
|
1
|
|
524
|
use SOAP::Lite; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Business::OnlinePayment; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Business::OnlinePayment); |
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = (); |
|
11
|
|
|
|
|
|
|
our @EXPORT = qw(); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub set_defaults { |
|
16
|
|
|
|
|
|
|
my $self = shift; |
|
17
|
|
|
|
|
|
|
$self->build_subs(qw(proxy on_action uri tns types process encodingstyle |
|
18
|
|
|
|
|
|
|
order_number)); |
|
19
|
|
|
|
|
|
|
$self->proxy('https://secure2.e-xact.com/vpos/process/vpos.asmx'); |
|
20
|
|
|
|
|
|
|
$self->on_action('http://secure2.e-xact.com/vpos/process/Process'); |
|
21
|
|
|
|
|
|
|
$self->uri('http://secure2.e-xact.com/vpos/process/'); |
|
22
|
|
|
|
|
|
|
$self->tns('http://secure2.e-xact.com/vpos/process/'); |
|
23
|
|
|
|
|
|
|
$self->types('http://secure2.e-xact.com/vpos/process/encodedTypes'); |
|
24
|
|
|
|
|
|
|
$self->process('http://secure2.e-xact.com/vpos/process/Request'); |
|
25
|
|
|
|
|
|
|
$self->encodingstyle('http://schemas.xmlsoap.org/soap/encoding/'); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub map_fields { |
|
29
|
|
|
|
|
|
|
my $self = shift; |
|
30
|
|
|
|
|
|
|
my %content = $self->content(); |
|
31
|
|
|
|
|
|
|
my %actions = ('normal authorization' => '00', |
|
32
|
|
|
|
|
|
|
'authorization only' => '01', |
|
33
|
|
|
|
|
|
|
'credit' => '04', |
|
34
|
|
|
|
|
|
|
'post authorization' => '02', |
|
35
|
|
|
|
|
|
|
'void' => '13', |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
$content{'action'} = $actions{lc($content{'action'})}; |
|
38
|
|
|
|
|
|
|
$content{'name'} = $content{'first_name'}.' '.$content{'last_name'} || |
|
39
|
|
|
|
|
|
|
$content{'name'} if $content{'first_name'} and $content{'last_name'}; |
|
40
|
|
|
|
|
|
|
$content{'expiration'} =~ /(\d\d)\D*(\d\d)/ if $content{'expiration'}; |
|
41
|
|
|
|
|
|
|
$content{'expiration_month'} = $1 || $content{'expiration_month'}; |
|
42
|
|
|
|
|
|
|
$content{'expiration_year'} = $2 || $content{'expiration_year'}; |
|
43
|
|
|
|
|
|
|
$content{'expiration'} = $content{'expiration_month'}. |
|
44
|
|
|
|
|
|
|
$content{'expiration_year'} || $content{'expiration'}; |
|
45
|
|
|
|
|
|
|
$self->content(%content); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub remap_fields { |
|
49
|
|
|
|
|
|
|
my($self,%map) = @_; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my %content = $self->content(); |
|
52
|
|
|
|
|
|
|
foreach(keys %map) { |
|
53
|
|
|
|
|
|
|
$content{$map{$_}} = $content{$_}; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
$self->content(%content); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub submit { |
|
59
|
|
|
|
|
|
|
my $self = shift; |
|
60
|
|
|
|
|
|
|
$self->map_fields; |
|
61
|
|
|
|
|
|
|
$self->remap_fields( |
|
62
|
|
|
|
|
|
|
login => 'ExactID', |
|
63
|
|
|
|
|
|
|
password => 'Password', |
|
64
|
|
|
|
|
|
|
action => 'Transaction_Type', |
|
65
|
|
|
|
|
|
|
amount => 'DollarAmount', |
|
66
|
|
|
|
|
|
|
customer_ip => 'Client_IP', |
|
67
|
|
|
|
|
|
|
order_number => 'Reference_No', |
|
68
|
|
|
|
|
|
|
name => 'CardHoldersName', |
|
69
|
|
|
|
|
|
|
address => 'VerificationStr1', |
|
70
|
|
|
|
|
|
|
email => 'Client_Email', |
|
71
|
|
|
|
|
|
|
card_number => 'Card_Number', |
|
72
|
|
|
|
|
|
|
expiration => 'Expiry_Date', |
|
73
|
|
|
|
|
|
|
referer => 'Customer_Ref', |
|
74
|
|
|
|
|
|
|
); |
|
75
|
|
|
|
|
|
|
my %content = $self->content(); |
|
76
|
|
|
|
|
|
|
#make data here |
|
77
|
|
|
|
|
|
|
my @data; |
|
78
|
|
|
|
|
|
|
foreach (keys %content) { |
|
79
|
|
|
|
|
|
|
push @data, SOAP::Data->name($_ => $content{$_})->type('string'); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $data = |
|
83
|
|
|
|
|
|
|
SOAP::Data->attr({'xsi:type' => 'types:Transaction'}) |
|
84
|
|
|
|
|
|
|
->name('Transaction')->value(\SOAP::Data->value(@data)); |
|
85
|
|
|
|
|
|
|
#figure out action |
|
86
|
|
|
|
|
|
|
#make request |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
my $s = SOAP::Lite |
|
89
|
|
|
|
|
|
|
->proxy($self->proxy) |
|
90
|
|
|
|
|
|
|
->on_action(sub{return $self->on_action}) |
|
91
|
|
|
|
|
|
|
->uri($self->uri) |
|
92
|
|
|
|
|
|
|
->readable(1); |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
$s->serializer->register_ns($self->tns => 'tns'); |
|
95
|
|
|
|
|
|
|
$s->serializer->register_ns($self->types => 'types'); |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
my $m = SOAP::Data->name('q1:Process') |
|
98
|
|
|
|
|
|
|
->attr({'xmlns:q1' => $self->process, |
|
99
|
|
|
|
|
|
|
'soap:encodingStyle' => $self->encodingstyle}); |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
my $result = $s->call($m => $data); |
|
102
|
|
|
|
|
|
|
#get result |
|
103
|
|
|
|
|
|
|
if ($result->fault) { |
|
104
|
|
|
|
|
|
|
$self->is_success(0); |
|
105
|
|
|
|
|
|
|
$self->error_message($result->faultstring); |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
else { |
|
108
|
|
|
|
|
|
|
if ($result->valueof('//TransactionResult/Transaction_Approved') |
|
109
|
|
|
|
|
|
|
eq '1' and $result->valueof('//TransactionResult/EXact_Resp_Code') |
|
110
|
|
|
|
|
|
|
eq '00' and $result->valueof('//TransactionResult/Transaction_Error') |
|
111
|
|
|
|
|
|
|
eq '0') { |
|
112
|
|
|
|
|
|
|
$self->is_success(1); |
|
113
|
|
|
|
|
|
|
$self->error_message( |
|
114
|
|
|
|
|
|
|
$result->valueof('//TransactionResult/EXact_Message')); |
|
115
|
|
|
|
|
|
|
$self->authorization( |
|
116
|
|
|
|
|
|
|
$result->valueof('//TransactionResult/Authorization_Num')); |
|
117
|
|
|
|
|
|
|
$self->order_number( |
|
118
|
|
|
|
|
|
|
$result->valueof('//TransactionResult/SequenceNo')); |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
else { |
|
121
|
|
|
|
|
|
|
$self->is_success(0); |
|
122
|
|
|
|
|
|
|
$self->error_message( |
|
123
|
|
|
|
|
|
|
$result->valueof('//TransactionResult/EXact_Message')); |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; |
|
131
|
|
|
|
|
|
|
__END__ |