1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#!/usr/bin/perl -w
#
# Make sure to copy Business::OnlinePayment::vSecureProcessing into its
# proper system directory (aka /usr/share/perl5/Business/Onlinepayment)
#
use strict;
use Business::OnlinePayment;
my %opt = (
url =>'dvrotsos2.kattare.com',
platform => 'Buypass',
gid => '1432479912596791',
tid => '01',
userid=> 'tom@yiptv.com',
port => 443
);
my %content = (
appid => 'yiptv',
action => 'Normal Authorization',
description => 'Business::OnlinePayment visa test',
# card_number => '4007000000027',
card_number => '4111111111111111',
cvv2 => '111',
expiration => expiration_date(),
amount => '42.24',
name => 'Murphy Law',
email => 'fake@acme.com',
address => '123 Anystreet',
zip => '84058',
);
main();
sub main {
my $transaction = Business::OnlinePayment->new("vSecureProcessing", %opt);
$transaction->content(%content);
eval { $transaction->submit(); };
if ( $@ ) {
print "Error: $@\n";
} else {
if ( $transaction->is_success() ) {
print "Card processed successfully: ". $transaction->authorization()."\n";
} else {
print "Card was rejected: ". $transaction->error_message(). "\n";
}
}
}
sub expiration_date {
my($month, $year) = (localtime)[4,5];
$month += 1;
$year++; # So we expire next year.
$year %= 100; # y2k? What's that?
return sprintf("%02d/%02d", $month, $year);
}
|