don't run capture test without a live account
[Business-OnlinePayment-AuthorizeNet.git] / t / capture.t
1 BEGIN { $| = 1; print "1..2\n"; }
2
3 #testing/testing is valid and seems to work... (but not for auth + capture)
4 print "ok 1 # Skipped: need a valid Authorize.Net login/password to test\n";
5 print "ok 2 # Skipped: need a valid Authorize.Net login/password to test\n";
6 exit;
7
8 use Business::OnlinePayment;
9
10 my $tx = new Business::OnlinePayment("AuthorizeNet");
11 $tx->content(
12     type           => 'VISA',
13     login          => 'testing',# CHANGE THESE TO TEST
14     password       => 'testing',#
15     action         => 'Authorization Only',
16     description    => 'Business::OnlinePayment visa test',
17     amount         => '49.95',
18     invoice_number => '100100',
19     customer_id    => 'jsk',
20     first_name     => 'Tofu',
21     last_name      => 'Beast',
22     address        => '123 Anystreet',
23     city           => 'Anywhere',
24     state          => 'UT',
25     zip            => '84058',
26     card_number    => '4007000000027',
27     expiration     => '08/06',
28 );
29 $tx->test_transaction(1); # test, dont really charge
30 $tx->submit();
31
32 unless($tx->is_success()) {
33     print "not ok 1\n";
34     print "not ok 2\n";
35 } else {
36     my $order_number = $tx->order_number;
37     warn $order_number;
38     print "ok 1\n";
39
40     my $settle_tx = new Business::OnlinePayment("AuthorizeNet");
41     $settle_tx->content(
42       type           => 'VISA',
43       login          => 'testing', # CHANGE THESE TO TEST
44       password       => 'testing', #
45       action         => 'Post Authorization',
46       description    => 'Business::OnlinePayment visa test',
47       amount         => '49.95',
48       invoice_number => '100100',
49       order_number   => '111',
50       card_number    => '4007000000027',
51       expiration     => '08/06',
52     );
53
54     $settle_tx->test_transaction(1); # test, dont really charge
55     $settle_tx->submit();
56
57     if($settle_tx->is_success()) {
58         print "ok 2\n";
59     } else {
60         warn $settle_tx->error_message;
61         print "not ok 2\n";
62     }
63
64 }