summaryrefslogtreecommitdiff
path: root/test.pl
diff options
context:
space:
mode:
authorAlex Brelsfoard <alex@Alexs-MacBook-Pro.local>2015-02-06 18:10:23 -0500
committerAlex Brelsfoard <alex@Alexs-MacBook-Pro.local>2015-02-06 18:10:23 -0500
commit7f323b74306dfa89de073a2ca5a34e76537815a7 (patch)
treebee638db259a06a39f6d50e9f3ac275e134fc646 /test.pl
parent222fd476087b15dd0bf4a76d6d19b914a0dff349 (diff)
Beginning of CPAN/debian package preparation.
Diffstat (limited to 'test.pl')
-rwxr-xr-xtest.pl42
1 files changed, 36 insertions, 6 deletions
diff --git a/test.pl b/test.pl
index 34e38b4..40f528b 100755
--- a/test.pl
+++ b/test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w -d
+#!/usr/bin/perl -w
#
# Make sure to copy Business::OnlinePayment::vSecureProcessing into its
@@ -18,10 +18,14 @@ my %opt = (
env => 'test'
);
+my $action = shift || 'Normal Authorization';
+my $auth = shift || '';
+
my %content = (
appid => 'yiptv',
- action => 'Normal Authorization',
+ action => $action,
+ auth => $auth,
description => 'Business::OnlinePayment visa test',
# card_number => '4007000000027',
card_number => '4111111111111111',
@@ -38,10 +42,29 @@ main();
sub main {
my $transaction = Business::OnlinePayment->new("vSecureProcessing", %opt);
- #$transaction->server('localhost');
- #$transaction->path('/cgi-bin/test.cgi');
+
+ print "MAKING PAYMENT\n";
+ MakPayment($transaction);
+ $content{'action'} = 'void';
+ $content{'reference_number'} = $transaction->authorization;
+ $content{'transaction_date'} = $transaction->txn_date;
+ $content{'amount'} = $transaction->txn_amount;
+ print "VOIDING PAYMENT\n";
+ VoidPayment($transaction);
+ $content{'action'} = 'Normal Authorization';
+ print "MAKING PAYMENT\n";
+ MakePayment($transaction);
+ print "REFUNDING PAYMENT\n";
+ $content{'action'} = 'credit';
+ $content{'reference_number'} = $transaction->authorization;
+ $content{'transaction_date'} = $transaction->txn_date;
+ $content{'amount'} = $transaction->txn_amount;
+ refundPayment($transaction);
+}
+
+sub MakePayment {
$transaction->content(%content);
- $DB::single = 1;
+
eval { $transaction->submit(); };
if ( $@ ) {
@@ -55,10 +78,17 @@ sub main {
} else {
print "Card was rejected: ". $transaction->error_message(). "\n";
}
-
}
}
+sub VoidPayment {
+
+}
+
+sub RefundPayment {
+
+}
+
sub expiration_date {
my($month, $year) = (localtime)[4,5];