5 use POSIX qw(strftime);
7 use Business::OnlinePayment;
8 require "t/lib/test_account.pl";
10 my %opts = test_account_or_skip('card');
12 if (!$opt{'gid'} || !$opt{'appid'}) {
13 plan skip_all => "no test credentials provided; fill out t/lib/test_account.pl to test communication with the gateway.",
20 appid => $opts{'appid'},
21 action => 'Normal Authorization',
22 description => 'Business::OnlinePayment visa test',
23 card_number => '4111111111111112', # trigger failure
25 expiration => expiration_date(),
28 email => 'fake@acme.com',
29 address => '123 Anystreet',
33 my $tx = new Business::OnlinePayment( 'vSecureProcessing', \%opts );
35 $tx->content( %content );
37 $tx->test_transaction(1);
41 is( $tx->is_success, 0, 'declined purchase')
42 or diag('Test transaction should have failed, but succeeded');
43 is( $tx->failure_status, 'nsf', 'failure status' )
44 or diag('Failure status reported as '.$tx->failure_status);