From Michael G. Schwern: Fix t/credit_card.t test to use a date 11 months in the...
[Business-OnlinePayment-AuthorizeNet.git] / t / credit_card.t
1 BEGIN { $| = 1; print "1..1\n"; }
2
3 #testing/testing is valid and seems to work...
4 #print "ok 1 # Skipped: need a valid Authorize.Net login/password to test\n"; exit;
5
6 use Business::OnlinePayment;
7
8 my($month, $year) = (localtime)[4,5];
9 $year++; # So we expire next year.
10 $year %= 100; # y2k? What's that?
11
12 my $tx = new Business::OnlinePayment("AuthorizeNet");
13 $tx->content(
14     type           => 'VISA',
15     login          => 'testing',
16     password       => 'testing',
17     action         => 'Normal Authorization',
18     description    => 'Business::OnlinePayment visa test',
19     amount         => '49.95',
20     invoice_number => '100100',
21     customer_id    => 'jsk',
22     first_name     => 'Tofu',
23     last_name      => 'Beast',
24     address        => '123 Anystreet',
25     city           => 'Anywhere',
26     state          => 'UT',
27     zip            => '84058',
28     card_number    => '4007000000027',
29     expiration     => sprintf("%02d/%02d", $month, $year),
30 );
31 $tx->test_transaction(1); # test, dont really charge
32 $tx->submit();
33
34 if($tx->is_success()) {
35     print "ok 1\n";
36 } else {
37     warn $tx->error_message;
38     print "not ok 1\n";
39 }