From 18cd553dba851f6b2bdc4a3bf4316ff563c900cc Mon Sep 17 00:00:00 2001 From: "C.J. Adams-Collier" Date: Tue, 23 Sep 2014 12:03:37 -0700 Subject: [PATCH] reduced price of test transaction to minimum, exercising new test_transaction method, printing error_message on failure --- t/Business-OnlinePayment-Exact.t | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/t/Business-OnlinePayment-Exact.t b/t/Business-OnlinePayment-Exact.t index 0754ac3..f51520a 100644 --- a/t/Business-OnlinePayment-Exact.t +++ b/t/Business-OnlinePayment-Exact.t @@ -5,7 +5,7 @@ # change 'tests => 1' to 'tests => last_test_to_print'; -use Test::More tests => 8; +use Test::More; use Term::ReadLine; BEGIN { use_ok('Business::OnlinePayment::Exact') }; @@ -34,7 +34,7 @@ my $name = $term->readline($prompt); my $tx; ok($tx = new Business::OnlinePayment('Exact'), 'New Exact'); ok($tx->content( - amount => '9.95', + amount => '0.01', card_number => $card, expiration => $expiry, name => $name, @@ -45,8 +45,17 @@ ok($tx->content( ), 'Add Some Content'); +my $return = eval { $tx->test_transaction(1) }; + +my $error = $@; + +ok($error, 'enable test mode dies'); + ok($tx->submit(), 'submit'); -ok($tx->is_success(), 'Success!!!'); + +ok($tx->is_success(), 'Success!!!') + or diag "Card was rejected: ", $tx->error_message(); + my $auth; ok($auth = $tx->authorization(), "authorization $auth"); my $err; @@ -55,3 +64,4 @@ my $on; ok($on = $tx->order_number(), "order number $on"); +done_testing(); -- 2.11.0