summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes1
-rw-r--r--t/capture.t24
-rw-r--r--t/check.t2
-rw-r--r--t/lib/test_account.pl7
-rw-r--r--t/test_account4
-rw-r--r--t/test_account_ach2
6 files changed, 30 insertions, 10 deletions
diff --git a/Changes b/Changes
index b9d57b7..e04b0ed 100644
--- a/Changes
+++ b/Changes
@@ -3,6 +3,7 @@ Revision history for Perl extension Business::OnlinePayment::AuthorizeNet.
3.16 unreleased
- Update link to API docs, now it is called "Advanced Integration
Method (AIM)"
+ - Update test account, separate ACH-capable one
- patch to map ship_company properly to x_Ship_To_Company from Mike
Barry <MBarry@cos.com>
From Michael G. Schwern <MSCHWERN@cpan.org>:
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;
diff --git a/t/check.t b/t/check.t
index 140dace..9597a2a 100644
--- a/t/check.t
+++ b/t/check.t
@@ -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