line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::OnlinePayment::PayConnect; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2787
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
106
|
|
4
|
3
|
|
|
3
|
|
16
|
use Carp; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
495
|
|
5
|
3
|
|
|
3
|
|
927
|
use Business::OnlinePayment; |
|
3
|
|
|
|
|
3911
|
|
|
3
|
|
|
|
|
92
|
|
6
|
|
|
|
|
|
|
#use Business::CreditCard; |
7
|
3
|
|
|
3
|
|
3315
|
use Net::SSLeay qw( make_form post_https get_https make_headers ); |
|
3
|
|
|
|
|
63264
|
|
|
3
|
|
|
|
|
2045
|
|
8
|
3
|
|
|
3
|
|
40
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $DEBUG); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
3075
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require Exporter; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
@ISA = qw(Exporter AutoLoader Business::OnlinePayment); |
13
|
|
|
|
|
|
|
@EXPORT = qw(); |
14
|
|
|
|
|
|
|
@EXPORT_OK = qw(); |
15
|
|
|
|
|
|
|
$VERSION = '0.02'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$DEBUG = 0; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub set_defaults { |
20
|
5
|
|
|
5
|
0
|
2557
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#test |
23
|
5
|
|
|
|
|
158
|
$self->server('zavijah.e-ebi.net'); |
24
|
5
|
|
|
|
|
191
|
$self->port('443'); |
25
|
5
|
|
|
|
|
175
|
$self->path('/rtv/servlet/aio'); |
26
|
|
|
|
|
|
|
|
27
|
5
|
|
|
|
|
68
|
$self->build_subs(qw( partner )); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub revmap_fields { |
31
|
5
|
|
|
5
|
0
|
87
|
my($self, %map) = @_; |
32
|
5
|
|
|
|
|
17
|
my %content = $self->content(); |
33
|
5
|
|
|
|
|
104
|
foreach(keys %map) { |
34
|
35
|
|
|
|
|
78
|
$content{$_} = ref($map{$_}) |
35
|
80
|
100
|
|
|
|
213
|
? ${ $map{$_} } |
36
|
|
|
|
|
|
|
: $content{$map{$_}}; |
37
|
|
|
|
|
|
|
} |
38
|
5
|
|
|
|
|
54
|
$self->content(%content); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub submit { |
42
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
43
|
0
|
|
|
|
|
|
my %content = $self->content(); |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my $action = lc($content{'action'}); |
46
|
0
|
0
|
|
|
|
|
if ( $action eq 'authorization only' ) { |
47
|
|
|
|
|
|
|
} else { |
48
|
0
|
|
|
|
|
|
croak "$action not (yet) supported"; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $type = lc($content{'type'}); |
52
|
0
|
0
|
|
|
|
|
if ( $type eq 'lec' ) { |
53
|
|
|
|
|
|
|
} else { |
54
|
0
|
|
|
|
|
|
croak "$type not (yet) supported"; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
$content{'zip'} =~ s/\D//g; |
58
|
0
|
|
|
|
|
|
$content{'zip'} =~ /^(\d{5})(\d*)$/; |
59
|
0
|
|
|
|
|
|
my($zip, $zip4) = ($1, $2); |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my $phone = $content{'phone'}; |
62
|
0
|
|
|
|
|
|
$phone =~ s/\D//g; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$self->revmap_fields( |
65
|
|
|
|
|
|
|
ebiinfo => \'AIO-1.0', |
66
|
|
|
|
|
|
|
clientid => 'login', |
67
|
|
|
|
|
|
|
password => 'password', |
68
|
|
|
|
|
|
|
partner => \($self->partner()), |
69
|
|
|
|
|
|
|
#sysid |
70
|
|
|
|
|
|
|
transtype => \'A', #action |
71
|
|
|
|
|
|
|
paytype => \'lec', #type |
72
|
|
|
|
|
|
|
trackid => 'invoice_number', |
73
|
|
|
|
|
|
|
acctid => 'customer_id', |
74
|
|
|
|
|
|
|
billname => 'name', |
75
|
|
|
|
|
|
|
billaddr1 => 'address', |
76
|
|
|
|
|
|
|
#billaddr2 => |
77
|
|
|
|
|
|
|
billcity => 'city', |
78
|
|
|
|
|
|
|
billstate => 'state', |
79
|
|
|
|
|
|
|
billzip => \$zip, |
80
|
|
|
|
|
|
|
billzip4 => \$zip4, |
81
|
|
|
|
|
|
|
amt => 'amount', |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
#LEC |
84
|
|
|
|
|
|
|
#ani |
85
|
|
|
|
|
|
|
btn => \$phone, |
86
|
|
|
|
|
|
|
#dni |
87
|
|
|
|
|
|
|
#traffic |
88
|
|
|
|
|
|
|
#planid |
89
|
|
|
|
|
|
|
#pincode |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
my %post_data = $self->get_fields(qw( |
93
|
|
|
|
|
|
|
ebiinfo clientid password partner transtype paytype trackid acctid |
94
|
|
|
|
|
|
|
billname billaddr1 billcity billstate billzip billzip4 amt btn |
95
|
|
|
|
|
|
|
)); |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my $s = $self->server(); |
98
|
0
|
|
|
|
|
|
my $p = $self->port(); |
99
|
0
|
|
|
|
|
|
my $t = $self->path(); |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
my $pd = make_form(%post_data); |
102
|
0
|
|
|
|
|
|
my($page,$server_response,%headers) = post_https($s,$p,$t,'',$pd); |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
$page =~ s/\r*\n*$//; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
#warn join('-',%headers); |
107
|
|
|
|
|
|
|
#warn $page; |
108
|
0
|
|
|
|
|
|
my %response = map { split('=',$_,2) } split(/\|/,$page); |
|
0
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
#warn "$_: $response{$_}\n" foreach keys %response; |
110
|
|
|
|
|
|
|
|
111
|
0
|
0
|
|
|
|
|
if ( $response{'response'} eq '0000' ) { |
112
|
0
|
|
|
|
|
|
$self->is_success(1); |
113
|
0
|
|
|
|
|
|
$self->result_code('0000'); |
114
|
0
|
|
|
|
|
|
$self->authorization($response{'trackid'}); |
115
|
|
|
|
|
|
|
} else { |
116
|
0
|
|
|
|
|
|
$self->is_success(0); |
117
|
0
|
|
|
|
|
|
$self->result_code($response{'response'}); |
118
|
0
|
|
|
|
|
|
$self->error_message($response{'respmsg'}); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
1; |
124
|
|
|
|
|
|
|
__END__ |