summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/Business-OnlinePayment-Capstone.t17
-rw-r--r--t/bad_card.t35
-rw-r--r--t/bop.t5
-rw-r--r--t/credit_card.t45
-rw-r--r--t/crypt_bad_card.t35
-rw-r--r--t/crypt_credit_card.t49
-rw-r--r--t/crypt_load.t13
-rw-r--r--t/load.t12
8 files changed, 211 insertions, 0 deletions
diff --git a/t/Business-OnlinePayment-Capstone.t b/t/Business-OnlinePayment-Capstone.t
new file mode 100644
index 0000000..0ca339a
--- /dev/null
+++ b/t/Business-OnlinePayment-Capstone.t
@@ -0,0 +1,17 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl Business-OnlinePayment-Capstone.t'
+
+#########################
+
+# change 'tests => 1' to 'tests => last_test_to_print';
+
+use Test;
+BEGIN { plan tests => 1 };
+use Business::OnlinePayment::Capstone;
+ok(1); # If we made it this far, we're ok.
+
+#########################
+
+# Insert your test code below, the Test::More module is use()ed here so read
+# its man page ( perldoc Test::More ) for help writing this test script.
+
diff --git a/t/bad_card.t b/t/bad_card.t
new file mode 100644
index 0000000..f744c61
--- /dev/null
+++ b/t/bad_card.t
@@ -0,0 +1,35 @@
+BEGIN {$| = 1; print "1..1\n"; }
+
+eval "use Net::SSLeay;";
+if ( $@ ) {
+ print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit;
+}
+
+use Business::OnlinePayment;
+
+my $tx = new Business::OnlinePayment("Capstone");
+
+#$Business::OnlinePayment::HTTPS::DEBUG = 1;
+#$Business::OnlinePayment::HTTPS::DEBUG = 1;
+#$Business::OnlinePayment::Capstone::DEBUG = 1;
+#$Business::OnlinePayment::Capstone::DEBUG = 1;
+
+$tx->content(
+ type => 'VISA',
+ login => '10217',
+ password => 'testing',
+ action => 'Normal Authorization',
+ amount => '32.32',
+ card_number => '4242424242424242',
+ expiration => '08/06',
+);
+$tx->test_transaction(1); # test, dont really charge
+$tx->submit();
+
+if($tx->is_success()) {
+ print "not ok 1\n";
+} else {
+ #warn $tx->server_response."\n";
+ #warn $tx->error_message. "\n";
+ 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..c70cb4e
--- /dev/null
+++ b/t/credit_card.t
@@ -0,0 +1,45 @@
+BEGIN { $| = 1; print "1..1\n"; }
+
+eval "use Net::SSLeay;";
+if ( $@ ) {
+ print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit;
+}
+
+use Business::OnlinePayment;
+
+my $tx = new Business::OnlinePayment("Capstone");
+
+#$Business::OnlinePayment::HTTPS::DEBUG = 1;
+#$Business::OnlinePayment::HTTPS::DEBUG = 1;
+#$Business::OnlinePayment::Capstone::DEBUG = 1;
+#$Business::OnlinePayment::Capstone::DEBUG = 1;
+
+$tx->content(
+ type => 'VISA',
+ login => '10217',
+ password => 'testing',
+ action => 'Normal Authorization',
+ description => 'Business::OnlinePayment::Capstone test',
+ amount => '32',
+ card_number => '4242424242424242',
+ expiration => '01/06',
+ cvv2 => '420',
+ name => 'Tofu Beast',
+ address => '123 Anystreet',
+ city => 'Anywhere',
+ state => 'UT',
+ zip => '84058',
+ country => 'US',
+ email => 'ivan-capstone-test@420.am',
+);
+$tx->test_transaction(1); # test, dont really charge
+$tx->submit();
+
+if($tx->is_success()) {
+ print "ok 1\n";
+} else {
+ #warn $tx->server_response."\n";
+ warn $tx->error_message. "\n";
+ print "not ok 1\n";
+}
+
diff --git a/t/crypt_bad_card.t b/t/crypt_bad_card.t
new file mode 100644
index 0000000..cc36356
--- /dev/null
+++ b/t/crypt_bad_card.t
@@ -0,0 +1,35 @@
+BEGIN {
+ $| = 1; print "1..1\n";
+ $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1;
+ $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1;
+}
+
+eval "use Crypt::SSLeay;";
+if ( $@ ) {
+ print "ok 1 # Skipped: Crypt::SSLeay is not installed\n"; exit;
+}
+
+use Business::OnlinePayment;
+
+my $tx = new Business::OnlinePayment("Capstone");
+
+$tx->content(
+ type => 'VISA',
+ login => '10217',
+ password => 'testing',
+ action => 'Normal Authorization',
+ amount => '32.32',
+ card_number => '4242424242424242',
+ expiration => '08/06',
+);
+$tx->test_transaction(1); # test, dont really charge
+$tx->submit();
+
+if($tx->is_success()) {
+ print "not ok 1\n";
+} else {
+ #warn $tx->server_response."\n";
+ #warn $tx->error_message. "\n";
+ print "ok 1\n";
+}
+
diff --git a/t/crypt_credit_card.t b/t/crypt_credit_card.t
new file mode 100644
index 0000000..153a0be
--- /dev/null
+++ b/t/crypt_credit_card.t
@@ -0,0 +1,49 @@
+BEGIN {
+ $| = 1; print "1..1\n";
+ $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1;
+ $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1;
+}
+
+eval "use Crypt::SSLeay;";
+if ( $@ ) {
+ print "ok 1 # Skipped: Crypt::SSLeay is not installed\n"; exit;
+}
+
+use Business::OnlinePayment;
+
+my $tx = new Business::OnlinePayment("Capstone");
+
+#$Business::OnlinePayment::HTTPS::DEBUG = 1;
+#$Business::OnlinePayment::HTTPS::DEBUG = 1;
+#$Business::OnlinePayment::Capstone::DEBUG = 1;
+#$Business::OnlinePayment::Capstone::DEBUG = 1;
+
+$tx->content(
+ type => 'VISA',
+ login => '10217',
+ password => 'testing',
+ action => 'Normal Authorization',
+ description => 'Business::OnlinePayment::Capstone test',
+ amount => '54.01',
+ card_number => '4111111111111111',
+ expiration => '08/06',
+ cvv2 => '420',
+ name => 'Tofu Beast',
+ address => '123 Anystreet',
+ city => 'Anywhere',
+ state => 'UT',
+ zip => '84058',
+ country => 'US',
+ email => 'ivan-capstone-test@420.am',
+);
+$tx->test_transaction(1); # test, dont really charge
+$tx->submit();
+
+if($tx->is_success()) {
+ print "ok 1\n";
+} else {
+ #warn $tx->server_response."\n";
+ warn $tx->error_message. "\n";
+ print "not ok 1\n";
+}
+
diff --git a/t/crypt_load.t b/t/crypt_load.t
new file mode 100644
index 0000000..c82905a
--- /dev/null
+++ b/t/crypt_load.t
@@ -0,0 +1,13 @@
+BEGIN {
+ $| = 1; print "1..1\n";
+ eval "use Crypt::SSLeay;";
+ if ( $@ ) {
+ print "ok 1 # Skipped: Crypt::SSLeay is not installed\n"; exit;
+ }
+ $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1;
+ $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1;
+}
+END {print "not ok 1\n" unless $loaded;}
+use Business::OnlinePayment::Capstone;
+$loaded = 1;
+print "ok 1\n";
diff --git a/t/load.t b/t/load.t
new file mode 100644
index 0000000..7ccee3d
--- /dev/null
+++ b/t/load.t
@@ -0,0 +1,12 @@
+BEGIN {
+ $| = 1; print "1..1\n";
+ eval "use Net::SSLeay;";
+ if ( $@ ) {
+ print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit;
+ }
+
+}
+END {print "not ok 1\n" unless $loaded;}
+use Business::OnlinePayment::Capstone;
+$loaded = 1;
+print "ok 1\n";