diff options
author | ivan <ivan> | 2006-10-21 22:59:56 +0000 |
---|---|---|
committer | ivan <ivan> | 2006-10-21 22:59:56 +0000 |
commit | 870018b93d8b59d23d1c564bcaf612405e9cd5a7 (patch) | |
tree | 9d373500eca79bcc350c099754d70dd178305bc7 /t | |
parent | 39541291959ba143c5a9e8272b45d49aea654f35 (diff) |
update tests with new test accounts
Diffstat (limited to 't')
-rw-r--r-- | t/capture.t | 24 | ||||
-rw-r--r-- | t/check.t | 2 | ||||
-rw-r--r-- | t/lib/test_account.pl | 7 | ||||
-rw-r--r-- | t/test_account | 4 | ||||
-rw-r--r-- | t/test_account_ach | 2 |
5 files changed, 29 insertions, 10 deletions
diff --git a/t/capture.t b/t/capture.t index 8e1d913..de46ac1 100644 --- a/t/capture.t +++ b/t/capture.t @@ -8,6 +8,9 @@ plan tests => 4; use_ok 'Business::OnlinePayment'; +#avoid dup checking in case "make test" is run too close to the last +my $amount = sprintf('%.2f', rand(100)); + my $tx = Business::OnlinePayment->new("AuthorizeNet"); $tx->server('test.authorize.net'); $tx->content( @@ -16,7 +19,7 @@ $tx->content( password => $password, action => 'Authorization Only', description => 'Business::OnlinePayment visa test', - amount => '49.95', + amount => $amount, invoice_number => '100100', customer_id => 'jsk', first_name => 'Tofu', @@ -28,14 +31,24 @@ $tx->content( card_number => '4007000000027', expiration => expiration_date(), ); -$tx->test_transaction(1); # test, dont really charge + +# don't set test_transaction (using test server though, still a test) +# as per authorize.net: +# "You need to be in Live Mode to get back a transaction ID" +#$tx->test_transaction(1); # test, dont really charge + $tx->submit(); ok($tx->is_success()) or diag $tx->error_message; +my $auth = $tx->authorization; + my $order_number = $tx->order_number; like $order_number, qr/^\d+$/; +#warn "auth: $auth\n"; +#warn "order_number: $order_number\n"; + my $settle_tx = Business::OnlinePayment->new("AuthorizeNet"); $settle_tx->server('test.authorize.net'); $settle_tx->content( @@ -44,14 +57,15 @@ $settle_tx->content( password => $password, action => 'Post Authorization', description => 'Business::OnlinePayment visa test', - amount => '49.95', + amount => $amount, invoice_number => '100100', - order_number => '111', + authorization => $auth, + order_number => $order_number, card_number => '4007000000027', expiration => expiration_date(), ); -$settle_tx->test_transaction(1); # test, dont really charge +#$settle_tx->test_transaction(1); # test, dont really charge $settle_tx->submit(); ok($settle_tx->is_success()) || diag $settle_tx->error_message; @@ -3,7 +3,7 @@ use Test::More; require "t/lib/test_account.pl"; -my($login, $password) = test_account_or_skip(); +my($login, $password) = test_account_or_skip('ach'); plan tests => 2; use_ok 'Business::OnlinePayment'; diff --git a/t/lib/test_account.pl b/t/lib/test_account.pl index b86082b..38b282b 100644 --- a/t/lib/test_account.pl +++ b/t/lib/test_account.pl @@ -1,5 +1,6 @@ sub test_account_or_skip { - my($login, $password) = test_account(); + my $suffix = shift; + my($login, $password) = test_account($suffix); unless( defined $login ) { plan skip_all => "No test account"; @@ -9,7 +10,9 @@ sub test_account_or_skip { } sub test_account { - open TEST_ACCOUNT, "t/test_account" or return; + my $suffix = shift || ''; + $suffix = "_$suffix" if $suffix; + open TEST_ACCOUNT, "t/test_account$suffix" or return; my($login, $password) = <TEST_ACCOUNT>; chomp $login; chomp $password; diff --git a/t/test_account b/t/test_account index 304a31f..d2b4d25 100644 --- a/t/test_account +++ b/t/test_account @@ -1,2 +1,2 @@ -cnpdev6024 -authnet001 +f9zmKtPbQtD +Vzx2n2Uk2TPanu3M diff --git a/t/test_account_ach b/t/test_account_ach new file mode 100644 index 0000000..a5d012f --- /dev/null +++ b/t/test_account_ach @@ -0,0 +1,2 @@ +anettest05 +BnrmzG5h49ggN6pl |