line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############################################################################## |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (c) 2000 Jan 'Kozo' Vajda |
4
|
|
|
|
|
|
|
# All rights reserved. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
############################################################################## |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Finance::Bank::Sporo; |
9
|
|
|
|
|
|
|
require Exporter; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
644
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
12
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
89
|
|
13
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
93
|
|
14
|
1
|
|
|
1
|
|
791
|
use URI::Escape; |
|
1
|
|
|
|
|
1547
|
|
|
1
|
|
|
|
|
973
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
### my initial version was 0.11 |
17
|
|
|
|
|
|
|
$VERSION = '0.16'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Items to export into callers namespace by default |
22
|
|
|
|
|
|
|
@EXPORT = qw(); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Other items we are prepared to export if requested |
25
|
|
|
|
|
|
|
@EXPORT_OK = qw(); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Finance::Bank::Sporo - Perl extension for B of Slovenska Sporitelna. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 VERSION |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
0.16 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SYNOPSIS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use Finance::Bank::Sporo; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$sporo_obj = Bank::Sporo->new($prenumber,$number); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
$sporo_obj->configure( |
43
|
|
|
|
|
|
|
amt => $amt, |
44
|
|
|
|
|
|
|
vs => $vs, |
45
|
|
|
|
|
|
|
ss => $ss, |
46
|
|
|
|
|
|
|
rurl => $rurl, |
47
|
|
|
|
|
|
|
param => $param, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
print $sporo_obj->pay_form(); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Module for generating pay forms and links for B of Slovenska |
56
|
|
|
|
|
|
|
Sporitelna (http://www.slsp.sk/). |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 USE |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 Functions ( or Methods ? ) |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item new |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
$sporo_obj = Finance::Bank::Sporo->new($prenumber,$number); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This creates a new Finance::Bank::Sporo object using $prenumber as a "Predcisle uctu" |
67
|
|
|
|
|
|
|
and $number as a "Cislo uctu" |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub new { |
73
|
0
|
|
|
0
|
1
|
|
my $type = shift; |
74
|
0
|
|
0
|
|
|
|
my $class = ref($type) || $type; |
75
|
0
|
0
|
|
|
|
|
croak "Usage $class->new (PRENUMBER, NUMBER)" if ( @_ != 2 ) ; |
76
|
0
|
|
|
|
|
|
my $self = {}; |
77
|
0
|
|
|
|
|
|
bless $self, $class; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
$self->{'prenumber'} = shift; |
80
|
0
|
|
|
|
|
|
$self->{'prenumber'} = sprintf("%06.0d",$self->{'prenumber'}); |
81
|
0
|
|
|
|
|
|
$self->{'number'} = shift; |
82
|
0
|
|
|
|
|
|
$self->{'number'} = sprintf("%010.0d",$self->{'number'}); |
83
|
|
|
|
|
|
|
|
84
|
0
|
0
|
|
|
|
|
croak "Number must be 10 numbers" if ( length($self->{'number'}) != 10 ); |
85
|
0
|
0
|
|
|
|
|
croak "PreNumber must be 6 numbers" if ( length($self->{'prenumber'}) != 6 ); |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
$self->_init; |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
return($self); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _init { |
93
|
0
|
|
|
0
|
|
|
my $self = shift; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
### default values |
96
|
0
|
|
|
|
|
|
$self->{'action_url'} = "https://ib.slsp.sk/epayment/epayment/epayment.xml"; |
97
|
0
|
|
|
|
|
|
$self->{'image_src'} = '/PICS/sporopay_logo.gif'; |
98
|
0
|
|
|
|
|
|
$self->{'currency'} = 'SKK'; |
99
|
0
|
|
|
|
|
|
$self->{'kbanky'} = '0900'; |
100
|
0
|
|
|
|
|
|
$self->{'ss'} = ''; |
101
|
0
|
|
|
|
|
|
return($self); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item configure |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
$sporo_obj->configure( |
108
|
|
|
|
|
|
|
amt => $amt, |
109
|
|
|
|
|
|
|
vs => $vs, |
110
|
|
|
|
|
|
|
ss => $ss, |
111
|
|
|
|
|
|
|
rurl => $rurl, |
112
|
|
|
|
|
|
|
param => $param, |
113
|
|
|
|
|
|
|
image_src => '/PICS/sporopay_logo.gif', |
114
|
|
|
|
|
|
|
); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Set correct values to object. |
118
|
|
|
|
|
|
|
Possible parameters is: |
119
|
|
|
|
|
|
|
amt => Amount |
120
|
|
|
|
|
|
|
vs => Variable Symbol |
121
|
|
|
|
|
|
|
ss => Specific Symbol |
122
|
|
|
|
|
|
|
rurl => Redirect URL |
123
|
|
|
|
|
|
|
image_src => Path to image ( relative to DocumentRoot ) |
124
|
|
|
|
|
|
|
param => any parameter |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Possible but default correct parameter is: |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
action_url => SporoPayPay action URL |
129
|
|
|
|
|
|
|
default: |
130
|
|
|
|
|
|
|
https://ib.slsp.sk/epayment/epayment/epayment.xml |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
image_src => Path to image ( relative to DocumentRoot ) |
133
|
|
|
|
|
|
|
default: |
134
|
|
|
|
|
|
|
/PICS/sporopay_logo.gif |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub configure { |
141
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
142
|
0
|
|
|
|
|
|
my (%arg) = @_; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
### normalization |
145
|
0
|
|
|
|
|
|
foreach (keys %arg) { |
146
|
|
|
|
|
|
|
### konvert name to lowercase |
147
|
0
|
|
|
|
|
|
$self->{"\L$_"} = $arg{$_}; |
148
|
|
|
|
|
|
|
} |
149
|
0
|
|
|
|
|
|
return($self); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item pay_form |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
print $sporo_obj->pay_form(); |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Return HTML FORM. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub pay_form { |
161
|
0
|
|
|
0
|
1
|
|
my $self =shift; |
162
|
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
|
my $action = $self->{action_url}; |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
0
|
|
|
|
|
|
my $sporo_form = <
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
EOM |
182
|
|
|
|
|
|
|
|
183
|
0
|
|
|
|
|
|
return($sporo_form); |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item generic_pay_form |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
print $sporo_obj->generic_pay_form($type); |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Return HTML FORM for payment with submit button. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=cut |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
sub generic_pay_form { |
195
|
0
|
|
|
0
|
1
|
|
my $self =shift; |
196
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
my $action = $self->{action_url}; |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
|
200
|
0
|
|
|
|
|
|
my $sporo_form = <
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
EOM |
216
|
|
|
|
|
|
|
|
217
|
0
|
|
|
|
|
|
return($sporo_form); |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=item pay_link |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
print $sporo_obj->pay_link(); |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Return URL for payment. |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=cut |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
sub pay_link { |
231
|
0
|
|
|
0
|
1
|
|
my $self =shift; |
232
|
|
|
|
|
|
|
|
233
|
0
|
|
|
|
|
|
my $action = $self->{action_url}; |
234
|
|
|
|
|
|
|
|
235
|
0
|
|
|
|
|
|
my $sporo_form = <
|
236
|
|
|
|
|
|
|
$action ? |
237
|
|
|
|
|
|
|
pu_predcislo=$self->{prenumber} & |
238
|
|
|
|
|
|
|
pu_cislo=$self->{number} & |
239
|
|
|
|
|
|
|
pu_kbanky=$self->{kbanky} & |
240
|
|
|
|
|
|
|
suma=$self->{amt} & |
241
|
|
|
|
|
|
|
mena=$self->{currency} & |
242
|
|
|
|
|
|
|
vs=$self->{vs} & |
243
|
|
|
|
|
|
|
ss=$self->{ss} & |
244
|
|
|
|
|
|
|
url=$self->{rurl} & |
245
|
|
|
|
|
|
|
EOM |
246
|
|
|
|
|
|
|
|
247
|
0
|
0
|
|
|
|
|
if ( $self->{param} ) { |
248
|
0
|
|
|
|
|
|
my $param = uri_escape($self->{param},"^A-Za-z0-9"); |
249
|
0
|
|
|
|
|
|
$sporo_form .= <
|
250
|
|
|
|
|
|
|
param=$param |
251
|
|
|
|
|
|
|
EOM |
252
|
|
|
|
|
|
|
} |
253
|
0
|
|
|
|
|
|
$sporo_form =~ s/\n//og; |
254
|
0
|
|
|
|
|
|
$sporo_form =~ s/\s+//og; |
255
|
|
|
|
|
|
|
|
256
|
0
|
|
|
|
|
|
return($sporo_form); |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
sub AUTOLOAD { |
261
|
0
|
|
|
0
|
|
|
my $self = shift; |
262
|
0
|
|
|
|
|
|
my $value = shift; |
263
|
0
|
|
|
|
|
|
my ($name) = $AUTOLOAD; |
264
|
|
|
|
|
|
|
|
265
|
0
|
|
|
|
|
|
($name) = ( $name =~ /^.*::(.*)/); |
266
|
|
|
|
|
|
|
|
267
|
0
|
0
|
|
|
|
|
$self->{$name} = $value if ( defined $value ); |
268
|
|
|
|
|
|
|
|
269
|
0
|
|
|
|
|
|
return($self->{$name}); |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
|
273
|
0
|
|
|
0
|
|
|
sub DESTROY { |
274
|
|
|
|
|
|
|
### bye bye |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
1; |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
__END__ |