3 BEGIN { push @INC, "t/lib" };
7 require "t/lib/test_account.pl";
10 my($arblogin, $arbpassword) = test_account_or_skip('arb');
11 my($aimlogin, $aimpassword) = test_account_or_skip();
14 use_ok 'Business::OnlinePayment';
15 my $tx = Business::OnlinePayment->new("AuthorizeNet",
16 fraud_detect => '_Fake',
17 fraud_detect_faked_result => '0',
18 fraud_detect_faked_score => '2',
19 maximum_fraud_score => '1',
24 password => $arbpassword,
25 action => 'Recurring Authorization',
26 description => 'Business::OnlinePayment::ARB mixed test',
30 card_number => '4007000000027',
31 expiration => expiration_date(),
32 interval => '1 month',
36 $tx->test_transaction(1); # test, dont really charge
39 ok(!$tx->is_success()) or diag "ARB Fraud detection unexpectedly did not fail.";
41 $tx->fraud_detect_faked_result(1);
44 ok(!$tx->is_success()) or diag "ARB Fraud detection unexpectedly did not deny.";
46 $tx->fraud_detect_faked_score(0);
49 ok($tx->is_success()) or diag $tx->error_message();
51 my $subscription = $tx->order_number();
52 like($subscription, qr/^[0-9]{1,13}$/, "Get order number");
56 skip "No order number", 1 unless $subscription;
60 password => $arbpassword,
61 action => 'Cancel Recurring Authorization',
62 subscription => $subscription,
64 $tx->test_transaction(1);
66 ok($tx->is_success()) or diag $tx->error_message;
69 $tx->server('test.authorize.net');
70 $tx->path('/gateway/transact.dll');
74 password => $aimpassword,
75 action => 'Normal Authorization',
76 description => 'Business::OnlinePayment::AIM mixed test',
80 card_number => '4007000000027',
81 expiration => expiration_date(),
83 $tx->test_transaction(1); #test, don't really charge
84 $tx->fraud_detect_faked_result(0);
85 $tx->fraud_detect_faked_score(2);
88 ok(!$tx->is_success()) or diag "AIM Fraud detection unexpectedly did not fail.";
91 $tx->fraud_detect_faked_result(1);
93 ok(!$tx->is_success()) or diag "AIM Fraud detection unexpectedly did not deny.";
95 $tx->fraud_detect_faked_score(0);
97 ok($tx->is_success()) or diag $tx->error_message;