| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# * AdditionalFields are used to hold fields that do not have separate
|
|
3
|
|
|
|
|
|
|
# * specifications. Each AdditionalField consists of a name and a value,
|
|
4
|
|
|
|
|
|
|
# * which are set in the constructor and are retrieved using the get methods.
|
|
5
|
|
|
|
|
|
|
# *
|
|
6
|
|
|
|
|
|
|
# * TransactionRequests (including CreditCardRequests) hold
|
|
7
|
|
|
|
|
|
|
# * a Vector of AdditionalField objects to permit them to be
|
|
8
|
|
|
|
|
|
|
# * interoperable with future releases.
|
|
9
|
|
|
|
|
|
|
# *
|
|
10
|
|
|
|
|
|
|
# * @see TransactionRequest#setAdditionalField
|
|
11
|
|
|
|
|
|
|
# * @see TransactionRequest#setAdditionalFields
|
|
12
|
|
|
|
|
|
|
# */
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#*
|
|
16
|
|
|
|
|
|
|
# * Make an AdditionalField object with the given name and value.
|
|
17
|
|
|
|
|
|
|
# *
|
|
18
|
|
|
|
|
|
|
# * @param name Must not be NULL or "". May not contain ' ', '=', or '+'.
|
|
19
|
|
|
|
|
|
|
# */
|
|
20
|
|
|
|
|
|
|
|
|
21
|
6
|
|
|
6
|
|
31
|
use strict;
|
|
|
6
|
|
|
|
|
12
|
|
|
|
6
|
|
|
|
|
327
|
|
|
22
|
|
|
|
|
|
|
#use overload;
|
|
23
|
|
|
|
|
|
|
package Business::OnlinePayment::PPIPayMover::AdditionalField;
|
|
24
|
|
|
|
|
|
|
use overload
|
|
25
|
6
|
|
|
6
|
|
11904
|
'== ' => \=
|
|
|
6
|
|
|
|
|
2308
|
|
|
|
6
|
|
|
|
|
60
|
|
|
26
|
|
|
|
|
|
|
my $paramSeparator = "&";
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new {
|
|
29
|
0
|
|
|
0
|
0
|
|
my $class = shift;
|
|
30
|
0
|
|
|
|
|
|
my $self = {};
|
|
31
|
0
|
|
|
|
|
|
my ($name, $value) = @_; # name and value as two arguements
|
|
32
|
0
|
|
|
|
|
|
$self->{strError} = "";
|
|
33
|
0
|
0
|
0
|
|
|
|
if (!$name || $name eq "" ) {
|
|
34
|
0
|
|
|
|
|
|
$self->{strError} .= "AdditionalField constructor: must provide a name";
|
|
35
|
|
|
|
|
|
|
}
|
|
36
|
0
|
0
|
0
|
|
|
|
if (!$value || $value eq "") {
|
|
37
|
0
|
|
|
|
|
|
$self->{strError} .= "AdditionalField constructor: must provide a value";
|
|
38
|
|
|
|
|
|
|
}
|
|
39
|
0
|
0
|
0
|
|
|
|
if (index($name, " ") != -1 || index($name, "=") != -1) {
|
|
40
|
0
|
|
|
|
|
|
$self->{strError} .= "AdditionalField constructor: name may not contain space or =";
|
|
41
|
|
|
|
|
|
|
}
|
|
42
|
0
|
0
|
0
|
|
|
|
if (index($value, " ") != -1 || index($value, "=") != -1) {
|
|
43
|
0
|
|
|
|
|
|
$self->{strError} .= "AdditionalField constructor: value may not contain space or =";
|
|
44
|
|
|
|
|
|
|
}
|
|
45
|
0
|
0
|
|
|
|
|
if (index($value, "+") != -1) {
|
|
46
|
0
|
|
|
|
|
|
$self->{strError} .= "AdditionalField constructor: value may not contain +";
|
|
47
|
|
|
|
|
|
|
}
|
|
48
|
0
|
0
|
|
|
|
|
if (defined $name) { $self->{name} = $name }
|
|
|
0
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
if (defined $value) { $self->{value} = $value }
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
bless $self, $class;
|
|
52
|
|
|
|
|
|
|
}
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#**
|
|
55
|
|
|
|
|
|
|
# * Get the name associated with this AdditionalField object.
|
|
56
|
|
|
|
|
|
|
# *
|
|
57
|
|
|
|
|
|
|
# * @return The name of the additional field.
|
|
58
|
|
|
|
|
|
|
#
|
|
59
|
|
|
|
|
|
|
sub getName {
|
|
60
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
|
61
|
0
|
|
|
|
|
|
$self->{name};
|
|
62
|
|
|
|
|
|
|
}
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#**
|
|
65
|
|
|
|
|
|
|
# * Get the value associated with this AdditionalField object.
|
|
66
|
|
|
|
|
|
|
# *
|
|
67
|
|
|
|
|
|
|
# * @return The value of the additional field.
|
|
68
|
|
|
|
|
|
|
#
|
|
69
|
|
|
|
|
|
|
sub getValue {
|
|
70
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
|
71
|
0
|
|
|
|
|
|
$self->{value};
|
|
72
|
|
|
|
|
|
|
}
|
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub getError {
|
|
75
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
|
76
|
0
|
|
|
|
|
|
$self->{strError};
|
|
77
|
|
|
|
|
|
|
}
|
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
#**
|
|
80
|
|
|
|
|
|
|
# * This method only checks the name field. This is ok because
|
|
81
|
|
|
|
|
|
|
# * a TransactionRequest is not allowed to have two AdditionalField
|
|
82
|
|
|
|
|
|
|
# * objects with the same name.
|
|
83
|
|
|
|
|
|
|
#
|
|
84
|
|
|
|
|
|
|
sub equals {
|
|
85
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
|
86
|
0
|
|
|
|
|
|
my $other = shift;
|
|
87
|
0
|
0
|
|
|
|
|
if($self->{name} eq $other->getName) { return 1 }
|
|
|
0
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
else { return 0 };
|
|
89
|
|
|
|
|
|
|
}
|
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub write {
|
|
93
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
|
94
|
0
|
|
|
|
|
|
my $outString = shift;
|
|
95
|
0
|
|
|
|
|
|
$self->{value} =~ tr/ /+/;
|
|
96
|
0
|
|
|
|
|
|
$$outString .= $self->{name};
|
|
97
|
0
|
|
|
|
|
|
$$outString .= "=";
|
|
98
|
0
|
|
|
|
|
|
$$outString .= $self->{value};
|
|
99
|
0
|
|
|
|
|
|
$$outString .= $paramSeparator;
|
|
100
|
|
|
|
|
|
|
}
|
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1;
|