summaryrefslogtreecommitdiff
path: root/t/capture.t
diff options
context:
space:
mode:
authorivan <ivan>2006-10-21 22:59:56 +0000
committerivan <ivan>2006-10-21 22:59:56 +0000
commit870018b93d8b59d23d1c564bcaf612405e9cd5a7 (patch)
tree9d373500eca79bcc350c099754d70dd178305bc7 /t/capture.t
parent39541291959ba143c5a9e8272b45d49aea654f35 (diff)
update tests with new test accounts
Diffstat (limited to 't/capture.t')
-rw-r--r--t/capture.t24
1 files changed, 19 insertions, 5 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;