4 require "t/lib/test_account.pl";
6 my($login, $password) = test_account_or_skip();
9 use_ok 'Business::OnlinePayment';
11 #avoid dup checking in case "make test" is run too close to the last
12 my $amount = sprintf('%.2f', rand(100));
14 my $tx = Business::OnlinePayment->new("AuthorizeNet");
15 $tx->server('test.authorize.net');
19 password => $password,
20 action => 'Authorization Only',
21 description => 'Business::OnlinePayment visa test',
23 invoice_number => '100100',
27 address => '123 Anystreet',
31 card_number => '4007000000027',
32 expiration => expiration_date(),
35 # don't set test_transaction (using test server though, still a test)
36 # as per authorize.net:
37 # "You need to be in Live Mode to get back a transaction ID"
38 #$tx->test_transaction(1); # test, dont really charge
42 ok($tx->is_success()) or diag $tx->error_message;
44 my $auth = $tx->authorization;
46 my $order_number = $tx->order_number;
47 like $order_number, qr/^\d+$/;
49 #warn "auth: $auth\n";
50 #warn "order_number: $order_number\n";
52 my $settle_tx = Business::OnlinePayment->new("AuthorizeNet");
53 $settle_tx->server('test.authorize.net');
57 password => $password,
58 action => 'Post Authorization',
59 description => 'Business::OnlinePayment visa test',
61 invoice_number => '100100',
62 authorization => $auth,
63 order_number => $order_number,
64 card_number => '4007000000027',
65 expiration => expiration_date(),
68 #$settle_tx->test_transaction(1); # test, dont really charge
71 ok($settle_tx->is_success()) || diag $settle_tx->error_message;