5 use POSIX qw(strftime);
7 use Business::OnlinePayment;
8 require "t/lib/test_account.pl";
10 my %opts = test_account('card');
12 if (!$opts{'login'} || !$opts{'password'}) {
13 plan skip_all => "no test credentials provided; fill out t/lib/test_account.pl to test communication with the gateway.",
24 login => delete($opts{'login'}),
25 password => delete($opts{'password'}),
26 action => 'Normal Authorization',
27 description => 'Business::OnlinePayment visa test',
28 card_number => '4111111111111111',
29 expiration => expiration_date(),
32 email => 'fake@acme.com',
33 address => '123 Anystreet',
37 my $tx = new Business::OnlinePayment( 'vSecureProcessing', %opts );
39 $tx->content( %content );
41 $tx->test_transaction(1);
45 is( $tx->is_success, 1, 'purchase' )
46 or diag('Gateway error: '. $tx->error_message);
51 my $auth = $tx->authorization;
52 $tx = new Business::OnlinePayment( 'vSecureProcessing', %opts );
53 $tx->content( %content,
55 authorization => $auth );
56 $tx->test_transaction(1);
60 is( $tx->is_success, 1, 'refund' )
61 or diag('Gateway error: '. $tx->error_message);