1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl Business-OnlinePayment-Exact.t'
4 #########################
6 # change 'tests => 1' to 'tests => last_test_to_print';
12 unless ( $ENV{RELEASE_TESTING} ) {
13 my $msg = 'Author test. Set $ENV{RELEASE_TESTING} to a true value to run.';
14 plan( skip_all => $msg );
18 use_ok('Business::OnlinePayment::Exact');
21 #########################
23 # Insert your test code below, the Test::More module is use()ed here so read
24 # its man page ( perldoc Test::More ) for help writing this test script.
26 my $term = new Term::ReadLine 'E-Xact Test';
27 diag("Please enter a test account for E-Xact");
28 my $prompt = "ExactID: ";
29 my $login = $term->readline($prompt);
30 diag("Please enter the password for the test account $login");
31 $prompt = "Password: ";
32 my $pass = $term->readline($prompt);
33 diag("Please enter a valid credit card to test (it will not be charged)");
34 $prompt = "Card Number: ";
35 my $card = $term->readline($prompt);
36 diag("Please enter an expiry date for the card in the form MMYY");
38 my $expiry = $term->readline($prompt);
39 diag("Please enter a name to match the card");
41 my $name = $term->readline($prompt);
44 ok($tx = new Business::OnlinePayment('Exact'), 'New Exact');
48 expiration => $expiry,
50 action => 'normal authorization',
53 referer => 'Business::OnlinePayment::Exact testing',
57 my $return = eval { $tx->test_transaction(1) };
61 ok($error, 'enable test mode dies');
63 ok($tx->submit(), 'submit');
65 ok($tx->is_success(), 'Success!!!')
66 or diag "Card was rejected: ", $tx->error_message();
69 ok($auth = $tx->authorization(), "authorization $auth");
71 ok($err = $tx->error_message(), "error $err");
73 ok($on = $tx->order_number(), "order number $on");