| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Business::NoChex; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.005_62; |
|
4
|
1
|
|
|
1
|
|
785
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
39
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
40
|
|
|
6
|
1
|
|
|
1
|
|
16
|
use vars qw/%ENV/; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
52
|
|
|
7
|
1
|
|
|
1
|
|
1147
|
use LWP::UserAgent; |
|
|
1
|
|
|
|
|
49435
|
|
|
|
1
|
|
|
|
|
42
|
|
|
8
|
1
|
|
|
1
|
|
5369
|
use CGI qw/:cgi/; |
|
|
1
|
|
|
|
|
22136
|
|
|
|
1
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
2187
|
use Class::MethodMaker; |
|
|
1
|
|
|
|
|
24390
|
|
|
|
1
|
|
|
|
|
8
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $REFERAL_URL = 'https://www.nochex.com/nochex.dll/apc/apc'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Class::MethodMaker |
|
17
|
1
|
|
|
|
|
8
|
new_with_init => 'new', |
|
18
|
|
|
|
|
|
|
new_hash_init => 'hash_init', |
|
19
|
|
|
|
|
|
|
grouped_fields => [ post_fields =>[ qw/to_email from_email transaction_date transaction_id security_key order_id amount/ ] ], |
|
20
|
|
|
|
|
|
|
get_set => [ qw/ recipient query cgi/], |
|
21
|
1
|
|
|
1
|
|
178
|
boolean => [ qw/ authorised declined no_response is_valid /]; |
|
|
1
|
|
|
|
|
2
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub init { |
|
24
|
|
|
|
|
|
|
my ($self,$args) = @_; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
if(ref($args) eq 'HASH'){ |
|
27
|
|
|
|
|
|
|
$self->hash_init($args); |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$self->cgi(new CGI); |
|
31
|
|
|
|
|
|
|
$self->parse; |
|
32
|
|
|
|
|
|
|
$self->verify; |
|
33
|
|
|
|
|
|
|
$self->set_is_valid if (($self->recipient eq $self->to_email) && $self->authorised); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub parse{ |
|
37
|
|
|
|
|
|
|
my($self)=shift; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
foreach my $field ($self->post_fields){ |
|
40
|
|
|
|
|
|
|
$self->$field($self->cgi->param($field)); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub verify{ |
|
45
|
|
|
|
|
|
|
my($self)=shift; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my($ua) = new LWP::UserAgent; |
|
48
|
|
|
|
|
|
|
my($req) = new HTTP::Request 'POST',$REFERAL_URL; |
|
49
|
|
|
|
|
|
|
$req->content_type('application/x-www-form-urlencoded'); |
|
50
|
|
|
|
|
|
|
$req->content($self->cgi->query_string); |
|
51
|
|
|
|
|
|
|
my($res) = $ua->request($req); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
if ($res->content eq 'AUTHORISED'){ $self->set_authorised; return 1 } |
|
54
|
|
|
|
|
|
|
elsif ($res->content eq 'DECLINED'){ $self->set_declined; return 0 } |
|
55
|
|
|
|
|
|
|
else { $self->set_no_response; return 0; } |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
|
60
|
|
|
|
|
|
|
__END__ |