summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-01-26 21:16:04 +0000
committerivan <ivan>2011-01-26 21:16:04 +0000
commit3d14e9d827c8fb53193d7534e3d13ef5aa288660 (patch)
tree2b1a507d42e2ef0ad5307c5a131ee36fbee64868
parent3522afcdab42daa2351f16e9f17f79d55f0eeb75 (diff)
0.06: fix january bug in tests
-rw-r--r--Changes3
-rw-r--r--IPPay.pm2
-rw-r--r--MANIFEST1
-rw-r--r--t/card.t23
-rw-r--r--t/check.t3
-rw-r--r--t/lib/test_account.pl42
6 files changed, 57 insertions, 17 deletions
diff --git a/Changes b/Changes
index 41619de..c027dc0 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
Revision history for Perl extension Business::OnlinePayment::IPPay.
+0.06 Wed Jan 26 13:15:21 PST 2011
+ - fix january bug in tests
+
0.05 Mon Jul 19 10:19:34 EDT 2010
- add introspection info used in Business::OnlinePayment 3.01+
- (0.05_02) add ECHECK_void_requires_account to introspection info
diff --git a/IPPay.pm b/IPPay.pm
index 3c01f99..59c3e78 100644
--- a/IPPay.pm
+++ b/IPPay.pm
@@ -11,7 +11,7 @@ use Business::OnlinePayment::HTTPS;
use vars qw($VERSION $DEBUG @ISA $me);
@ISA = qw(Business::OnlinePayment::HTTPS);
-$VERSION = '0.05';
+$VERSION = '0.06';
$VERSION = eval $VERSION; # modperlstyle: convert the string into a number
$DEBUG = 0;
diff --git a/MANIFEST b/MANIFEST
index 1ce0cab..a9c0e0c 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -8,4 +8,5 @@ t/card.t
t/check.t
t/bop.t
t/introspection.t
+t/lib/test_account.pl
META.yml Module meta-data (added by MakeMaker)
diff --git a/t/card.t b/t/card.t
index a47d623..e68be0d 100644
--- a/t/card.t
+++ b/t/card.t
@@ -1,9 +1,9 @@
#!/usr/bin/perl -w
use Test::More;
+require "t/lib/test_account.pl";
-my($login, $password, @opts) = ('TESTMERCHANT', '',
- 'default_Origin' => 'RECURRING' );
+my($login, $password, %opt) = test_account_or_skip('card');
plan tests => 43;
use_ok 'Business::OnlinePayment';
@@ -35,7 +35,7 @@ my $voidable_amount = 0;
# valid card number test
{
- my $tx = Business::OnlinePayment->new("IPPay", @opts);
+ my $tx = Business::OnlinePayment->new("IPPay", %opt);
$tx->content(%content);
tx_check(
$tx,
@@ -55,7 +55,7 @@ my $voidable_amount = 0;
# invalid card number test
{
- my $tx = Business::OnlinePayment->new("IPPay", @opts);
+ my $tx = Business::OnlinePayment->new("IPPay", %opt);
$tx->content(%content, card_number => "4111111111111112" );
tx_check(
$tx,
@@ -71,7 +71,7 @@ my $voidable_amount = 0;
# authorization only test
{
- my $tx = Business::OnlinePayment->new("IPPay", @opts);
+ my $tx = Business::OnlinePayment->new("IPPay", %opt);
$tx->content(%content, action => 'authorization only', amount => '3.00' );
tx_check(
$tx,
@@ -91,7 +91,7 @@ my $voidable_amount = 0;
# post authorization test
SKIP: {
- my $tx = new Business::OnlinePayment( "IPPay", %opts );
+ my $tx = new Business::OnlinePayment( "IPPay", %opt );
$tx->content( %content, 'action' => "post authorization",
'amount' => $postable_amount, # not required
'order_number' => $postable,
@@ -110,7 +110,7 @@ SKIP: {
# void test
SKIP: {
- my $tx = new Business::OnlinePayment( "IPPay", %opts );
+ my $tx = new Business::OnlinePayment( "IPPay", %opt );
$tx->content( %content, 'action' => "Void",
'order_number' => $voidable,
'authorization' => $voidable_auth,
@@ -129,7 +129,7 @@ SKIP: {
# credit test
SKIP: {
- my $tx = new Business::OnlinePayment( "IPPay", %opts );
+ my $tx = new Business::OnlinePayment( "IPPay", %opt );
$tx->content( %content, 'action' => "credit");
tx_check(
$tx,
@@ -178,10 +178,3 @@ sub tx_info {
);
}
-sub expiration_date {
- my($month, $year) = (localtime)[4,5];
- $year++; # So we expire next year.
- $year %= 100; # y2k? What's that?
-
- return sprintf("%02d/%02d", $month, $year);
-}
diff --git a/t/check.t b/t/check.t
index 7e05a52..721e23a 100644
--- a/t/check.t
+++ b/t/check.t
@@ -1,8 +1,9 @@
#!/usr/bin/perl -w
use Test::More;
+require "t/lib/test_account.pl";
-my($login, $password, %opt) = ('TESTMERCHANT', '', 'Origin' => 'RECURRING' );
+my($login, $password, %opt) = test_account_or_skip('check');
plan tests => 16;
use_ok 'Business::OnlinePayment';
diff --git a/t/lib/test_account.pl b/t/lib/test_account.pl
new file mode 100644
index 0000000..06a2428
--- /dev/null
+++ b/t/lib/test_account.pl
@@ -0,0 +1,42 @@
+sub test_account_or_skip {
+ my $suffix = shift;
+ my($login, $password, %opt) = test_account($suffix);
+
+ unless( defined $login ) {
+ plan skip_all => "No test account";
+ }
+
+ return($login, $password, %opt);
+}
+
+sub test_account {
+ my $suffix = shift || 'card';
+
+ my($login, $password) = ('TESTMERCHANT', '');
+
+ my %opt;
+ if ( $suffix eq 'check ' ) {
+ %opt = ('Origin' => 'RECURRING');
+ } else {
+ %opt = ('default_Origin' => 'RECURRING');
+ }
+
+ return($login, $password, %opt);
+}
+
+sub expiration_date {
+ my($month, $year) = (localtime)[4,5];
+ $month += 1;
+ $year++; # So we expire next year.
+ $year %= 100; # y2k? What's that?
+
+ return sprintf("%02d/%02d", $month, $year);
+}
+
+#sub tomorrow {
+# my($day, $month, $year) = (localtime(time+86400))[3..5];
+# return sprintf("%04d-%02d-%02d", $year+1900, ++$month, $day);
+#}
+
+1;
+