line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::BancaSella::Encode::Gateway; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
push @ISA,'Business::BancaSella::Gateway'; |
4
|
2
|
|
|
2
|
|
2625
|
use Business::BancaSella::Gateway; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
55
|
|
5
|
2
|
|
|
2
|
|
806
|
use URI::Escape; |
|
2
|
|
|
|
|
1533
|
|
|
2
|
|
|
|
|
138
|
|
6
|
2
|
|
|
2
|
|
926
|
use HTML::Entities; |
|
2
|
|
|
|
|
7022
|
|
|
2
|
|
|
|
|
220
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = "0.11"; |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
0
|
0
|
sub Version { $VERSION; } |
11
|
|
|
|
|
|
|
require 5.004; |
12
|
2
|
|
|
2
|
|
15
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
55
|
|
13
|
2
|
|
|
2
|
|
10
|
use Carp; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
1261
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my %fields = |
16
|
|
|
|
|
|
|
( |
17
|
|
|
|
|
|
|
base_url => 'https://ecomm.sella.it/gestpay/pagam.asp' |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my @fields_req = qw/shopping amount id otp tid/; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new |
23
|
|
|
|
|
|
|
{ |
24
|
1
|
|
|
1
|
1
|
17
|
my $proto = shift; |
25
|
1
|
|
33
|
|
|
8
|
my $class = ref($proto) || $proto; |
26
|
1
|
|
|
|
|
3
|
my $self = {}; |
27
|
1
|
|
|
|
|
3
|
bless $self,$class; |
28
|
1
|
|
|
|
|
6
|
$self->init(@_); |
29
|
1
|
|
|
|
|
4
|
return $self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub init { |
33
|
2
|
|
|
2
|
0
|
5
|
my $self = shift; |
34
|
2
|
|
|
|
|
15
|
my (%options) = @_; |
35
|
2
|
|
|
|
|
23
|
$self->SUPER::init(@_); |
36
|
|
|
|
|
|
|
# Assign default options |
37
|
2
|
|
|
|
|
12
|
while (my ($key,$value) = each(%fields)) { |
38
|
2
|
|
33
|
|
|
19
|
$self->{$key} = $self->{$key} || $value; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
# Assign options |
41
|
2
|
|
|
|
|
12
|
while (my ($key,$value) = each(%options)) { |
42
|
11
|
|
|
|
|
33
|
$self->{$key} = $value |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
# Check required params |
45
|
2
|
|
|
|
|
7
|
foreach (@fields_req) { |
46
|
10
|
50
|
|
|
|
39
|
croak "You must declare '$_' in " . ref($self) . "::new" |
47
|
|
|
|
|
|
|
if (!defined $self->{$_}); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub uri { |
53
|
2
|
|
|
2
|
1
|
18
|
my $self = shift; |
54
|
2
|
|
|
|
|
41
|
my $uri = 'a=' . uri_escape($self->shopping) . '&b=' . |
55
|
|
|
|
|
|
|
uri_escape($self->getB) . '&c=' . uri_escape($self->otp) . |
56
|
|
|
|
|
|
|
'&d=' . uri_escape($self->id); |
57
|
2
|
|
|
|
|
50
|
return $self->base_url . '?' . $uri; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub form { |
61
|
2
|
|
|
2
|
1
|
16
|
my $self = shift; |
62
|
2
|
|
50
|
|
|
16
|
my $frmName = shift || ''; |
63
|
2
|
|
|
|
|
10
|
my $ret = ' |
|
|
|
|
|
|
$self->base_url . '">' . "\n"; |
65
|
2
|
|
|
|
|
11
|
$ret .= '
66
|
|
|
|
|
|
|
encode_entities($self->shopping) . |
67
|
|
|
|
|
|
|
'">' . "\n"; |
68
|
2
|
|
|
|
|
40
|
$ret .= '
69
|
|
|
|
|
|
|
encode_entities($self->getB) . '">' . "\n"; |
70
|
2
|
|
|
|
|
34
|
$ret .= '
71
|
|
|
|
|
|
|
encode_entities($self->otp) . |
72
|
|
|
|
|
|
|
'">' . "\n"; |
73
|
2
|
|
|
|
|
28
|
$ret .= '
74
|
|
|
|
|
|
|
encode_entities($self->id) . |
75
|
|
|
|
|
|
|
'">' . "\n"; |
76
|
2
|
|
|
|
|
472
|
$ret .= "\n"; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub getB { |
80
|
4
|
|
|
4
|
0
|
117
|
my $self = shift; |
81
|
4
|
|
|
|
|
24
|
return int($self->amount * $self->tid); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
4
|
50
|
|
4
|
0
|
9
|
sub base_url { my $s=shift; return @_ ? ($s->{base_url}=shift) : $s->{base_url} } |
|
4
|
|
|
|
|
402
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |