- Update for production URL
[Business-OnlinePayment-vSecureProcessing.git] / t / transaction_decline.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use POSIX qw(strftime);
6 use Test::More;
7 use Business::OnlinePayment;
8 require "t/lib/test_account.pl";
9
10 my %opts = test_account('card');
11
12 if (!$opts{'login'} || !$opts{'password'}) {
13   plan skip_all => "no test credentials provided; fill out t/lib/test_account.pl to test communication with the gateway.",
14   1;
15   exit(0);
16 }
17
18 plan tests => 1; #2;
19 my %content = (
20     login          => delete $opts{'login'},
21     password       => delete $opts{'password'},
22     action         => 'Normal Authorization',
23     description    => 'Business::OnlinePayment visa test',
24     card_number    => '4111111111111112', # trigger failure
25     cvv2           => '111',
26     expiration     => expiration_date(),
27     amount         => '24.42',
28     name           => 'Murphy Law',
29     email          => 'fake@acme.com',
30     address        => '123 Anystreet',
31     zip            => '84058',
32 );
33
34 my $tx = new Business::OnlinePayment( 'vSecureProcessing', %opts );
35
36 $tx->content( %content );
37
38 $tx->test_transaction(1);
39
40 $tx->submit;
41
42 is( $tx->is_success, 0, 'declined purchase')
43   or diag('Test transaction should have failed, but succeeded');
44 #is( $tx->failure_status, 'nsf', 'failure status' )
45 #  or diag('Failure status reported as '.$tx->failure_status);
46
47 1;