From 1e90419f5b23ab4b4fe17b5861958d75ac285c4d Mon Sep 17 00:00:00 2001 From: Alex Brelsfoard Date: Mon, 9 Feb 2015 11:58:10 -0500 Subject: Getting code ready for CPAN and debian relase. --- t/t_transaction_decline.t | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 t/t_transaction_decline.t (limited to 't/t_transaction_decline.t') diff --git a/t/t_transaction_decline.t b/t/t_transaction_decline.t new file mode 100644 index 0000000..1309c78 --- /dev/null +++ b/t/t_transaction_decline.t @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use POSIX qw(strftime); +use Test::More; +use Business::OnlinePayment; +require "t/lib/test_account.pl"; + +my %opts = test_account_or_skip('card'); + +if (!$opt{'gid'} || !$opt{'appid'}) { + plan skip_all => "no test credentials provided; fill out t/lib/test_account.pl to test communication with the gateway.", + 1; + exit(0); +} + +plan tests => 2; +my %content = ( + appid => $opts{'appid'}, + action => 'Normal Authorization', + description => 'Business::OnlinePayment visa test', + card_number => '4111111111111112', # trigger failure + cvv2 => '111', + expiration => expiration_date(), + amount => '24.42', + name => 'Murphy Law', + email => 'fake@acme.com', + address => '123 Anystreet', + zip => '84058', +); + +my $tx = new Business::OnlinePayment( 'vSecureProcessing', \%opts ); + +$tx->content( %content ); + +$tx->test_transaction(1); + +$tx->submit; + +is( $tx->is_success, 0, 'declined purchase') + or diag('Test transaction should have failed, but succeeded'); +is( $tx->failure_status, 'nsf', 'failure status' ) + or diag('Failure status reported as '.$tx->failure_status); + +1; -- cgit v1.2.1