Revision history for Perl extension Business::OnlinePayment::TransactionCentral.
+0.06 Wed Feb 27 16:49:17 PST 2008
+ - update tests with new regkey for TC test account
+
0.05 Wed Nov 14 13:26:38 PST 2007
- add email->Email mapping
use vars qw($VERSION @ISA $DEBUG);
@ISA = qw(Business::OnlinePayment::HTTPS);
-$VERSION = '0.05';
+$VERSION = '0.06';
$DEBUG = 0;
sub set_defaults {
use Business::OnlinePayment;
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
my $tx = new Business::OnlinePayment("TransactionCentral");
#$Business::OnlinePayment::HTTPS::DEBUG = 1;
$tx->content(
type => 'VISA',
- login => '10011',
- password => 'KK48NPYEJHMAH6DK', #regkey
+ login => $login,
+ password => $regkey,
action => 'Normal Authorization',
amount => '32.32',
#card_number => '4012000000001',
use Business::OnlinePayment;
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
my $ctx = new Business::OnlinePayment("TransactionCentral");
$ctx->content(
type => 'ECHECK',
- login => '10011',
- password => 'KK48NPYEJHMAH6DK', #regkey
+ login => $login,
+ password => $regkey,
action => 'Normal Authorization',
amount => '49.95',
invoice_number => '100100',
use Business::OnlinePayment;
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
my $ctx = Business::OnlinePayment->new("TransactionCentral");
#$Business::OnlinePayment::TransactionCentral::DEBUG = 1;
$ctx->content(
type => 'CHECK',
- login => '10011',
- password => 'KK48NPYEJHMAH6DK', #regkey
+ login => $login,
+ password => $regkey,
action => 'Normal Authorization',
amount => '49.95',
invoice_number => '100100',
use Business::OnlinePayment;
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
my $tx = new Business::OnlinePayment("TransactionCentral");
#$Business::OnlinePayment::HTTPS::DEBUG = 1;
$tx->content(
type => 'VISA',
- login => '10011',
- password => 'KK48NPYEJHMAH6DK', #regkey
+ login => $login,
+ password => $regkey,
action => 'Normal Authorization',
description => 'Business::OnlinePayment::TransactionCentral test',
amount => '32',
use Business::OnlinePayment;
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
my $tx = new Business::OnlinePayment("TransactionCentral");
#$Business::OnlinePayment::HTTPS::DEBUG = 1;
$tx->content(
type => 'VISA',
- login => '10011',
- password => 'KK48NPYEJHMAH6DK', #regkey
+ login => $login,
+ password => $regkey,
action => 'Normal Authorization',
description => 'Business::OnlinePayment::TransactionCentral test',
amount => '32',
use Business::OnlinePayment;
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
my $tx = new Business::OnlinePayment("TransactionCentral");
#$Business::OnlinePayment::HTTPS::DEBUG = 1;
$tx->content(
type => 'VISA',
- login => '10011',
- password => 'KK48NPYEJHMAH6DK', #regkey
+ login => $login,
+ password => $regkey,
action => 'Normal Authorization',
description => 'Business::OnlinePayment::TransactionCentral test',
amount => '32',
use Business::OnlinePayment;
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
my $tx = new Business::OnlinePayment("TransactionCentral");
$tx->content(
type => 'VISA',
- login => '10011',
- password => 'KK48NPYEJHMAH6DK', #regkey
+ login => $login,
+ password => $regkey,
action => 'Normal Authorization',
amount => '32.32',
#card_number => '4012000000001',
use Business::OnlinePayment;
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
my $tx = new Business::OnlinePayment("TransactionCentral");
#$Business::OnlinePayment::HTTPS::DEBUG = 1;
$tx->content(
type => 'VISA',
- login => '10011',
- password => 'KK48NPYEJHMAH6DK', #regkey
+ login => $login,
+ password => $regkey,
action => 'Normal Authorization',
description => 'Business::OnlinePayment::TransactionCentral test',
amount => '54.01',
--- /dev/null
+sub test_account_or_skip {
+ my $suffix = shift;
+ my($login, $password) = test_account($suffix);
+
+ unless( defined $login ) {
+ #plan skip_all => "No test account";
+ #not (yet?) using Test::More
+ print "ok 1 # Skipped: No test account\n";
+ exit;
+ }
+
+ return($login, $password);
+}
+
+sub test_account {
+ 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;
+
+ return($login, $password);
+}
+
+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;
use Business::OnlinePayment;
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
my $tx = new Business::OnlinePayment("TransactionCentral");
#$Business::OnlinePayment::HTTPS::DEBUG = 1;
$tx->content(
type => 'VISA',
- login => '10011',
- password => 'KK48NPYEJHMAH6DK', #regkey
+ login => $login,
+ password => $regkey,
action => 'Normal Authorization',
description => 'Business::OnlinePayment::TransactionCentral test',
amount => '32',
--- /dev/null
+10011
+6BK9JNNR6MQY578Y