line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::BancaSella::Decode::Gestpay; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
push @ISA,'Business::BancaSella::Gestpay'; |
4
|
2
|
|
|
2
|
|
2028
|
use Business::BancaSella::Gestpay; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
83
|
|
5
|
2
|
|
|
2
|
|
2936
|
use URI; |
|
2
|
|
|
|
|
28103
|
|
|
2
|
|
|
|
|
72
|
|
6
|
2
|
|
|
2
|
|
29
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
277
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$VERSION = "0.12"; |
10
|
0
|
|
|
0
|
0
|
0
|
sub Version { $VERSION; } |
11
|
|
|
|
|
|
|
require 5.004; |
12
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1492
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $bKeys = { |
15
|
|
|
|
|
|
|
currency => 'PAY1_UICCODE', |
16
|
|
|
|
|
|
|
amount => 'PAY1_AMOUNT', |
17
|
|
|
|
|
|
|
id => 'PAY1_SHOPTRANSACTIONID', |
18
|
|
|
|
|
|
|
otp => 'PAY1_OTP', |
19
|
|
|
|
|
|
|
language => 'PAY1_IDLANGUAGE', |
20
|
|
|
|
|
|
|
result => 'PAY1_TRANSACTIONRESULT', |
21
|
|
|
|
|
|
|
authcode => 'PAY1_AUTHORIZATIONCODE', |
22
|
|
|
|
|
|
|
bankid => 'PAY1_BANKTRANSACTIONID', |
23
|
|
|
|
|
|
|
errcode => 'PAY1_ERRORCODE', |
24
|
|
|
|
|
|
|
errstr => 'PAY1_ERRORDESCRIPTION' |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#use Class::MethodMaker |
28
|
|
|
|
|
|
|
# new_with_init => 'new' |
29
|
|
|
|
|
|
|
# ,get_set => [qw/base_url query_string/]; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my %fields = |
32
|
|
|
|
|
|
|
( |
33
|
|
|
|
|
|
|
query_string => undef |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my @fields_req = qw/query_string/; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new |
39
|
|
|
|
|
|
|
{ |
40
|
1
|
|
|
1
|
1
|
18
|
my $proto = shift; |
41
|
1
|
|
33
|
|
|
8
|
my $class = ref($proto) || $proto; |
42
|
1
|
|
|
|
|
2
|
my $self = {}; |
43
|
1
|
|
|
|
|
4
|
bless $self,$class; |
44
|
1
|
|
|
|
|
4
|
$self->init(@_); |
45
|
1
|
|
|
|
|
5
|
return $self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub init { |
49
|
2
|
|
|
2
|
0
|
5
|
my $self = shift; |
50
|
2
|
|
|
|
|
9
|
my (%options) = @_; |
51
|
|
|
|
|
|
|
# Assign default options |
52
|
2
|
|
|
|
|
18
|
while (my ($key,$value) = each(%fields)) { |
53
|
2
|
|
66
|
|
|
47
|
$self->{$key} = $self->{$key} || $value; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
# Assign options |
56
|
2
|
|
|
|
|
14
|
while (my ($key,$value) = each(%options)) { |
57
|
4
|
|
|
|
|
16
|
$self->{$key} = $value |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
# Check required params |
60
|
2
|
|
|
|
|
7
|
foreach (@fields_req) { |
61
|
2
|
50
|
|
|
|
10
|
croak "You must declare '$_' in " . ref($self) . "::new" |
62
|
|
|
|
|
|
|
if (!defined $self->{$_}); |
63
|
|
|
|
|
|
|
} |
64
|
2
|
|
|
|
|
14
|
$self->_split_uri; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
sub _split_uri { |
67
|
2
|
|
|
2
|
|
4
|
my $self = shift; |
68
|
2
|
|
|
|
|
4
|
my %lbKeys = %{$bKeys}; |
|
2
|
|
|
|
|
26
|
|
69
|
2
|
|
|
|
|
10
|
my $qs = '?' . $self->{query_string}; |
70
|
2
|
|
|
|
|
19
|
my %qs = URI->new($qs)->query_form; |
71
|
2
|
50
|
33
|
|
|
38335
|
die "Malformed uri definition: " . $self->{uri} |
72
|
|
|
|
|
|
|
if (!(exists $qs{a} && exists $qs{b})); |
73
|
2
|
|
|
|
|
14
|
$self->{shopping} = $qs{a}; |
74
|
2
|
|
|
|
|
16
|
my @b = split(/\*P1\*/,$qs{b}); |
75
|
2
|
|
|
|
|
6
|
my %b; |
76
|
2
|
|
|
|
|
7
|
foreach (@b) { |
77
|
7
|
|
|
|
|
18
|
my ($key,$value) = split(/=/,$_); |
78
|
7
|
|
|
|
|
22
|
$b{$key} = $value; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
# assign default keys |
81
|
2
|
|
|
|
|
18
|
foreach (keys %lbKeys) { |
82
|
20
|
100
|
|
|
|
52
|
if (exists $b{$lbKeys{$_}}) { |
83
|
5
|
|
|
|
|
20
|
$self->{$_} = $b{$lbKeys{$_}}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# now we try to fill user personalized keys |
88
|
2
|
|
|
|
|
30
|
foreach (keys %{$self->{user_params}}) { |
|
2
|
|
|
|
|
25
|
|
89
|
2
|
50
|
|
|
|
4
|
if (exists $b{$_}) { |
90
|
2
|
|
|
|
|
12
|
$self->{user_params}->{$_} = $b{$_} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub result { |
97
|
1
|
|
|
1
|
1
|
16
|
my $self = shift; |
98
|
1
|
50
|
|
|
|
6
|
if (@_) { $self->SUPER::result(shift) }; |
|
0
|
|
|
|
|
0
|
|
99
|
1
|
|
|
|
|
14
|
return $self->SUPER::result eq 'OK'; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
0
|
0
|
|
0
|
0
|
|
sub query_string { my $s=shift; return @_ ? ($s->{query_string}=shift) : $s->{query_string} } |
|
0
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# Preloaded methods go here. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |
107
|
|
|
|
|
|
|
__END__ |