Fix voids even if an amount is passed (now ignored)
[Business-OnlinePayment-eSelectPlus.git] / t / void_us.t
1 BEGIN { $| = 1; print "1..2\n"; }
2
3 #print "ok 1 # Skipped: Voids not working with test account\n";
4 #print "ok 2 # Skipped: Voids not working with test account\n";
5 #exit;
6
7 eval "use Net::SSLeay;";
8 if ( $@ ) {
9   print "ok 1 # Skipped: Net::SSLeay is not installed\n";
10   print "ok 2 # Skipped: Net::SSLeay is not installed\n";
11   exit;
12 }
13
14 use Business::OnlinePayment;
15
16 my $tx = new Business::OnlinePayment("eSelectPlus");
17
18 #$Business::OnlinePayment::HTTPS::DEBUG = 1;
19 #$Business::OnlinePayment::HTTPS::DEBUG = 1;
20 $Business::OnlinePayment::eSelectPlus::DEBUG = 1;
21 $Business::OnlinePayment::eSelectPlus::DEBUG = 1;
22
23 $tx->content(
24     type           => 'VISA',
25     login          => 'moot',
26     password       => 'moot',
27     action         => 'Normal Authorization',
28     amount         => '0.80',
29     currency       => 'USD',
30     card_number    => '4242424242424242',
31     expiration     => '01/12',
32 );
33 $tx->test_transaction(1); # test, dont really charge
34 $tx->submit();
35
36 if($tx->is_success()) {
37     print "ok 1\n";
38 } else {
39     warn $tx->server_response."\n";
40     warn $tx->error_message. "\n";
41     print "not ok 1\n";
42 }
43
44 #--
45
46 my $void = new Business::OnlinePayment("eSelectPlus");
47
48 $void->content(
49     login          => 'moot',
50     password       => 'moot',
51     action         => 'Void',
52     currency       => 'USD',
53     authorization  => $tx->authorization,
54     order_number   => $tx->order_number,
55 );
56
57 $void->test_transaction(1); # test, dont really charge
58 $void->submit();
59
60 if($void->is_success()) {
61     print "ok 2\n";
62 } else {
63     warn $void->server_response."\n";
64     warn $void->error_message. "\n";
65     print "not ok 2\n";
66 }
67