reduced price of test transaction to minimum, exercising new test_transaction method...
authorC.J. Adams-Collier <cjac@colliertech.org>
Tue, 23 Sep 2014 19:03:37 +0000 (12:03 -0700)
committerC.J. Adams-Collier <cjac@colliertech.org>
Tue, 23 Sep 2014 19:03:37 +0000 (12:03 -0700)
t/Business-OnlinePayment-Exact.t

index 0754ac3..f51520a 100644 (file)
@@ -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();