summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/bad_auth.t59
-rw-r--r--t/bop.t5
-rw-r--r--t/credit_card.t89
-rw-r--r--t/load.t5
-rw-r--r--t/testhost.t14
5 files changed, 172 insertions, 0 deletions
diff --git a/t/bad_auth.t b/t/bad_auth.t
new file mode 100644
index 0000000..aa10d3c
--- /dev/null
+++ b/t/bad_auth.t
@@ -0,0 +1,59 @@
+BEGIN { $| = 1; print "1..1\n"; }
+
+use Business::OnlinePayment;
+
+$DEBUG = 0;
+$Business::OnlinePayment::VirtualNet::DEBUG = $DEBUG;
+
+# Use this merchant information for testing only.
+#
+# Bin= 999995 Agent = 000000 Chain = 111111 Merchant = 888000002200
+# Store = 5999 Terminal = 1515
+# Mcc = 5999 .
+# If you are doing AVS (address Ver ) use this address 8320 zip 85284.
+
+my $tx = new Business::OnlinePayment("VirtualNet",,
+ 'merchant_id' => '888000002200',
+ 'store' => '5999',
+ 'terminal' => '1515',
+ 'mcc' => '5999', #merchant category code
+ 'bin' => '999995', #acquirer BIN
+ 'zip' => '543211420', #merchant zip (US) or assigned city code
+
+ 'agent' => '000000',
+ 'v' => '00000001',
+
+ 'merchant_name' => 'Internet Service Provider', #25 char max
+ 'merchant_city' => 'Gloucester', #13 char max
+ 'merchant_state' => 'VA', #2 char
+
+ 'seq_file' => '/tmp/bop-virtualnet-sequence',
+ 'batchnum_file' => '/tmp/bop-virtualnet-batchnum', # :/ 0-999 in 5 days
+);
+$tx->content(
+ type => 'CC',
+ action => 'Authorization only',
+ description => 'Business::OnlinePayment visa test',
+ amount => '999910.00',
+ invoice_number => '100100',
+ customer_id => 'jsk',
+ first_name => 'Tofu',
+ last_name => 'Beast',
+ address => '123 Anystreet',
+ city => 'Anywhere',
+ state => 'UT',
+ zip => '84058',
+ card_number => '4111111111111111',
+ expiration => '09/03',
+);
+$tx->test_transaction(1); # test, dont really charge (doesn't do anything with VirtualNet)
+$tx->submit();
+
+if($tx->is_success()) {
+ print "not ok 1\n";
+ warn '** ('. $tx->result_code. ') '. $tx->error_message. " **\n" if $DEBUG;
+ warn $tx->error_message if $DEBUG;
+} else {
+ warn '** ('. $tx->result_code. ') '. $tx->error_message. " **\n" if $DEBUG;
+ print "ok 1\n";
+}
diff --git a/t/bop.t b/t/bop.t
new file mode 100644
index 0000000..64332c5
--- /dev/null
+++ b/t/bop.t
@@ -0,0 +1,5 @@
+BEGIN { $| = 1; print "1..1\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use Business::OnlinePayment;
+$loaded = 1;
+print "ok 1\n";
diff --git a/t/credit_card.t b/t/credit_card.t
new file mode 100644
index 0000000..8e2777a
--- /dev/null
+++ b/t/credit_card.t
@@ -0,0 +1,89 @@
+BEGIN { $| = 1; print "1..2\n"; }
+
+use Business::OnlinePayment;
+
+$DEBUG = 0;
+$Business::OnlinePayment::VirtualNet::DEBUG = $DEBUG;
+
+# Use this merchant information for testing only.
+#
+# Bin= 999995 Agent = 000000 Chain = 111111 Merchant = 888000002200
+# Store = 5999 Terminal = 1515
+# Mcc = 5999 .
+# If you are doing AVS (address Ver ) use this address 8320 zip 85284.
+
+my $tx = new Business::OnlinePayment("VirtualNet",
+ 'merchant_id' => '888000002200',
+ 'store' => '5999',
+ 'terminal' => '1515',
+ 'mcc' => '5999', #merchant category code
+ 'bin' => '999995', #acquirer BIN
+ 'zip' => '543211420', #merchant zip (US) or assigned city code
+
+ 'agent' => '000000', #agent bank
+ 'v' => '00000001',
+
+ 'merchant_name' => 'Internet Service Provider', #25 char max
+ 'merchant_city' => 'Gloucester', #13 char max
+ 'merchant_state' => 'VA', #2 char
+
+ 'seq_file' => '/tmp/bop-virtualnet-sequence',
+ 'batchnum_file' => '/tmp/bop-virtualnet-batchnum', # :/ 0-999 in 5 days
+);
+
+$tx->content(
+ type => 'CC',
+ action => 'Authorization only',
+ description => 'Business::OnlinePayment visa test',
+ amount => '10.00',
+ invoice_number => '100100',
+ customer_id => 'jsk',
+ name => 'Tofu Beast',
+ first_name => 'Tofu',
+ last_name => 'Beast',
+ address => '123 Anystreet',
+ city => 'Anywhere',
+ state => 'UT',
+ zip => '84058',
+ card_number => '4111111111111111',
+ expiration => '09/03',
+);
+$tx->test_transaction(1); # test, dont really charge (doesn't do anything with VirtualNet)
+$tx->submit();
+
+if($tx->is_success()) {
+ print "ok 1 (". $tx->authorization. ")\n";
+ warn "(auth ok ". $tx->authorization. ")\n" if $DEBUG;
+} else {
+ warn "(auth) ** (". $tx->result_code. ') '. $tx->error_message. "**\n"
+ if $DEBUG;
+ print "not ok 1\n";
+ exit;
+}
+
+$tx->content(
+ type => 'CC',
+ action => 'Post Authorization',
+ #order_number => $ordernum,
+ amount => '10.00',
+ card_number => '4111111111111111',
+ expiration => '09/03',
+ authorization => $tx->authorization,
+ authorization_source_code => $tx->authorization_source_code,
+ returned_ACI => $tx->returned_ACI,
+ transaction_identifier => $tx->transaction_identifier,
+ validation_code => $tx->validation_code,
+ transaction_sequence_num => $tx->transaction_sequence_num,
+ #description => 'Business::OnlinePayment::BankOfAmerica visa test',
+);
+
+$tx->submit();
+
+if($tx->is_success()) {
+ print "ok 2\n";
+} else {
+ warn '(capture) ** ('.$tx->result_code.') '. $tx->error_message. " **\n"
+ if $DEBUG;
+ print "not ok 2\n";
+}
+
diff --git a/t/load.t b/t/load.t
new file mode 100644
index 0000000..c90bb23
--- /dev/null
+++ b/t/load.t
@@ -0,0 +1,5 @@
+BEGIN { $| = 1; print "1..1\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use Business::OnlinePayment::VirtualNet;
+$loaded = 1;
+print "ok 1\n";
diff --git a/t/testhost.t b/t/testhost.t
new file mode 100644
index 0000000..72c3a3c
--- /dev/null
+++ b/t/testhost.t
@@ -0,0 +1,14 @@
+BEGIN { $| = 1; print "1..1\n"; }
+
+use Business::OnlinePayment;
+
+my $tx = new Business::OnlinePayment("VirtualNet");
+
+$tx->testhost;
+
+if($tx->is_success()) {
+ print "ok 1\n";
+} else {
+ warn "*******". $tx->error_message. "*******";
+ print "not ok 1\n";
+}