line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
6
|
|
|
6
|
|
31
|
use strict;
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
301
|
|
2
|
|
|
|
|
|
|
package Business::OnlinePayment::PPIPayMover::TransactionResponse;
|
3
|
6
|
|
|
6
|
|
30
|
use Business::OnlinePayment::PPIPayMover::constants;
|
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
9112
|
|
4
|
|
|
|
|
|
|
1;
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new {
|
7
|
0
|
|
|
0
|
0
|
|
my $class = shift;
|
8
|
0
|
|
|
|
|
|
my @param = @_;
|
9
|
0
|
|
|
|
|
|
my $paramNo = @param;
|
10
|
0
|
|
|
|
|
|
my $self = {};
|
11
|
0
|
|
|
|
|
|
bless $self, $class;
|
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
$self->{strError} = "";
|
14
|
0
|
|
|
|
|
|
$self->{iRetVal} = undef;
|
15
|
0
|
|
|
|
|
|
$self->{iResponseCode} = undef;
|
16
|
0
|
|
|
|
|
|
$self->{strResponseCode} = undef;
|
17
|
0
|
|
|
|
|
|
$self->{strResponseCodeText} = undef;
|
18
|
0
|
|
|
|
|
|
$self->{strTimeStamp} = undef;
|
19
|
0
|
|
|
|
|
|
$self->{bRetryRecommended} = undef;
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# constructor for only one or two string arguement
|
23
|
0
|
0
|
0
|
|
|
|
if ($paramNo == 1 || $paramNo == 2) {
|
|
|
0
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $InString = shift;
|
25
|
0
|
|
|
|
|
|
my $prefix = "";
|
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
if($paramNo == 2){
|
28
|
0
|
|
|
|
|
|
$prefix = shift;
|
29
|
|
|
|
|
|
|
}
|
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
if ($$InString eq "") {
|
32
|
0
|
|
|
|
|
|
$self->{strError} .= "Empty response string";
|
33
|
0
|
|
|
|
|
|
$self->{iRetVal} = 0;
|
34
|
0
|
|
|
|
|
|
return $self;
|
35
|
|
|
|
|
|
|
}
|
36
|
0
|
|
|
|
|
|
my @tmp;
|
37
|
0
|
|
|
|
|
|
@tmp = split(/\n/, $$InString);
|
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $name;
|
40
|
|
|
|
|
|
|
my $value;
|
41
|
0
|
|
|
|
|
|
foreach (@tmp) {
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Anything after the first = is part
|
44
|
|
|
|
|
|
|
# of the value (including other ='s)
|
45
|
0
|
|
|
|
|
|
($name, $value) = split(/=/, $_, 2);
|
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if (index($name, "<") == 0) {
|
48
|
0
|
|
|
|
|
|
$self->{strError} .= "Server not available";
|
49
|
0
|
|
|
|
|
|
$self->{iRetVal} = 0;
|
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$self->{iResponseCode} = TRANSACTION_SERVER_ERROR;
|
52
|
0
|
|
|
|
|
|
$self->{strResponseCode} = "".$self->{iResponseCode};
|
53
|
0
|
|
|
|
|
|
$self->{strResponseCodeText} = "The Transaction Server is currently not available";
|
54
|
0
|
|
|
|
|
|
return $self;
|
55
|
|
|
|
|
|
|
}
|
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
if ($name eq $prefix."response_code") {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
0
|
0
|
0
|
|
|
|
if($value."" eq "0" || $value."" eq "") {
|
60
|
0
|
|
|
|
|
|
$self->{strError} .= "Invalid response code";
|
61
|
0
|
|
|
|
|
|
$self->{iRetVal} = 0;
|
62
|
0
|
|
|
|
|
|
return $self;
|
63
|
|
|
|
|
|
|
}
|
64
|
|
|
|
|
|
|
else {
|
65
|
0
|
|
|
|
|
|
$self->{strResponseCode} = $value;
|
66
|
0
|
|
|
|
|
|
$self->{iResponseCode} = 1 * $value;
|
67
|
|
|
|
|
|
|
}
|
68
|
|
|
|
|
|
|
}
|
69
|
|
|
|
|
|
|
elsif ($name eq $prefix."response_code_text"){
|
70
|
0
|
|
|
|
|
|
$self->{strResponseCodeText} = $value;
|
71
|
|
|
|
|
|
|
}
|
72
|
|
|
|
|
|
|
elsif ($name eq $prefix."time_stamp") {
|
73
|
0
|
|
|
|
|
|
$self->{strTimeStamp} = $value;
|
74
|
|
|
|
|
|
|
}
|
75
|
|
|
|
|
|
|
elsif ($name eq $prefix."retry_recommended") {
|
76
|
0
|
0
|
|
|
|
|
if ($value eq "true") {
|
|
|
0
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
$self->{bRetryRecommended} = 1;
|
78
|
|
|
|
|
|
|
}
|
79
|
|
|
|
|
|
|
elsif ($value eq "false") {
|
80
|
0
|
|
|
|
|
|
$self->{bRetryRecommended} = 0;
|
81
|
|
|
|
|
|
|
}
|
82
|
|
|
|
|
|
|
else {
|
83
|
0
|
|
|
|
|
|
$self->{strError} .= "invalid retry flag";
|
84
|
0
|
|
|
|
|
|
return $self;
|
85
|
|
|
|
|
|
|
}
|
86
|
|
|
|
|
|
|
}
|
87
|
|
|
|
|
|
|
else {
|
88
|
0
|
|
|
|
|
|
$self->{strError} .= "Invalid data name: ";
|
89
|
|
|
|
|
|
|
}
|
90
|
|
|
|
|
|
|
}
|
91
|
|
|
|
|
|
|
}
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# constructor for 4 arguements. More arguements are ignored
|
94
|
|
|
|
|
|
|
# (1) ResponseCode(integer), (2) ResponseCodeText(string), (3) TimeStamp(string),
|
95
|
|
|
|
|
|
|
# (4) RetryRecommended(bool: 1 or 0 in the form of integer)
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
elsif ($paramNo >= 4) {
|
98
|
0
|
|
|
|
|
|
my ($iResponseCode, $strResponseCodeText, $strTimeStamp, $bRetryRecommended) = @param[0..3];
|
99
|
0
|
0
|
0
|
|
|
|
if (!defined($iResponseCode) || $iResponseCode < 1 || !defined($strResponseCodeText) ||
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
100
|
|
|
|
|
|
|
!defined($strTimeStamp) || !defined($bRetryRecommended)) {
|
101
|
0
|
|
|
|
|
|
$self->{strError} .= "Wrong parameter";
|
102
|
0
|
|
|
|
|
|
return $self;
|
103
|
|
|
|
|
|
|
}
|
104
|
0
|
|
|
|
|
|
$self->{iResponseCode} = $iResponseCode;
|
105
|
0
|
|
|
|
|
|
$self->{strResponseCode} = "".$iResponseCode;
|
106
|
0
|
|
|
|
|
|
$self->{strResponseCodeText} = $strResponseCodeText;
|
107
|
0
|
|
|
|
|
|
$self->{strTimeStamp} = $strTimeStamp;
|
108
|
0
|
|
|
|
|
|
$self->{bRetryRecommended} = $bRetryRecommended;
|
109
|
|
|
|
|
|
|
}
|
110
|
|
|
|
|
|
|
else {
|
111
|
0
|
|
|
|
|
|
$self->{strError} .= "Parameter number is only $paramNo and more are needed";
|
112
|
0
|
|
|
|
|
|
return $self;
|
113
|
|
|
|
|
|
|
}
|
114
|
0
|
|
|
|
|
|
return $self;
|
115
|
|
|
|
|
|
|
}
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub GetError {
|
119
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
120
|
0
|
|
|
|
|
|
$self->{strError};
|
121
|
|
|
|
|
|
|
}
|
122
|
|
|
|
|
|
|
sub GetResponseCode {
|
123
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
124
|
0
|
|
|
|
|
|
$self->{iResponseCode};
|
125
|
|
|
|
|
|
|
}
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub GetResponseCodeStrVal {
|
128
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
129
|
0
|
|
|
|
|
|
$self->{strResponseCode};
|
130
|
|
|
|
|
|
|
}
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub GetResponseCodeText{
|
133
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
134
|
0
|
|
|
|
|
|
$self->{strResponseCodeText};
|
135
|
|
|
|
|
|
|
}
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub GetTimeStamp {
|
138
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
139
|
0
|
|
|
|
|
|
$self->{strTimeStamp};
|
140
|
|
|
|
|
|
|
}
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub GetRetryRecommended {
|
143
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
144
|
0
|
|
|
|
|
|
$self->{bRetryRecommended};
|
145
|
|
|
|
|
|
|
}
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub WriteResponse {
|
149
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
150
|
0
|
|
|
|
|
|
my $outString = shift;
|
151
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
$self->{strResponseCodeText} =~ tr/\n/ /;
|
153
|
0
|
|
|
|
|
|
$self->{strTimeStamp} =~ tr/\n/ /;
|
154
|
0
|
|
|
|
|
|
$$outString .= "response_code=";
|
155
|
0
|
|
|
|
|
|
$$outString .= $self->{strResponseCode};
|
156
|
0
|
|
|
|
|
|
$$outString .= "\n";
|
157
|
0
|
|
|
|
|
|
$$outString .= "response_code_text=";
|
158
|
0
|
|
|
|
|
|
$$outString .= $self->{strResponseCodeText};
|
159
|
0
|
|
|
|
|
|
$$outString .= "\n";
|
160
|
0
|
|
|
|
|
|
$$outString .= "time_stamp=";
|
161
|
0
|
|
|
|
|
|
$$outString .= $self->{strTimeStamp};
|
162
|
0
|
|
|
|
|
|
$$outString .= "\n";
|
163
|
|
|
|
|
|
|
|
164
|
0
|
0
|
|
|
|
|
if ($self->{bRetryRecommended}) {
|
165
|
0
|
|
|
|
|
|
$$outString .= "retry_recommended=true\n";
|
166
|
|
|
|
|
|
|
}
|
167
|
|
|
|
|
|
|
else {
|
168
|
0
|
|
|
|
|
|
$$outString .= "retry_recommended=false\n";
|
169
|
|
|
|
|
|
|
}
|
170
|
0
|
|
|
|
|
|
return CCR_NO_ERROR;
|
171
|
|
|
|
|
|
|
}
|