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';
10 BEGIN { use_ok('Business::OnlinePayment::Exact') };
12 #########################
14 # Insert your test code below, the Test::More module is use()ed here so read
15 # its man page ( perldoc Test::More ) for help writing this test script.
17 my $term = new Term::ReadLine 'E-Xact Test';
18 diag("Please enter a test account for E-Xact");
19 my $prompt = "ExactID: ";
20 my $login = $term->readline($prompt);
21 diag("Please enter the password for the test account $login");
22 $prompt = "Password: ";
23 my $pass = $term->readline($prompt);
24 diag("Please enter a valid credit card to test (it will not be charged)");
25 $prompt = "Card Number: ";
26 my $card = $term->readline($prompt);
27 diag("Please enter an expiry date for the card in the form MMYY");
29 my $expiry = $term->readline($prompt);
30 diag("Please enter a name to match the card");
32 my $name = $term->readline($prompt);
35 ok($tx = new Business::OnlinePayment('Exact'), 'New Exact');
39 expiration => $expiry,
41 action => 'normal authorization',
44 referer => 'Business::OnlinePayment::Exact testing',
48 my $return = eval { $tx->test_transaction(1) };
52 ok($error, 'enable test mode dies');
54 ok($tx->submit(), 'submit');
56 ok($tx->is_success(), 'Success!!!')
57 or diag "Card was rejected: ", $tx->error_message();
60 ok($auth = $tx->authorization(), "authorization $auth");
62 ok($err = $tx->error_message(), "error $err");
64 ok($on = $tx->order_number(), "order number $on");