Saving simple test script to repo for now.
authorAlex Brelsfoard <alex@Alexs-MacBook-Pro.local>
Tue, 3 Feb 2015 11:21:08 +0000 (06:21 -0500)
committerAlex Brelsfoard <alex@Alexs-MacBook-Pro.local>
Tue, 3 Feb 2015 11:21:08 +0000 (06:21 -0500)
test.pl [new file with mode: 0644]

diff --git a/test.pl b/test.pl
new file mode 100644 (file)
index 0000000..22124bd
--- /dev/null
+++ b/test.pl
@@ -0,0 +1,66 @@
+#!/usr/bin/perl -w
+
+#
+# Make sure to copy Business::OnlinePayment::vSecureProcessing into its
+# proper system directory (aka /usr/share/perl5/Business/Onlinepayment)
+#
+
+use strict;
+use Business::OnlinePayment;
+
+my %opt = (
+    url =>'dvrotsos2.kattare.com',
+    platform => 'Buypass',
+    gid => '1432479912596791',
+    tid => '01',
+    userid=> 'tom@yiptv.com',
+    port => 443
+);
+
+
+my %content = (
+    appid          => 'yiptv',
+    action         => 'Normal Authorization',
+    description    => 'Business::OnlinePayment visa test',
+#    card_number    => '4007000000027',
+    card_number    => '4111111111111111',
+    cvv2           => '111',
+    expiration     => expiration_date(),
+    amount         => '42.24',
+    name           => 'Murphy Law',
+    email          => 'fake@acme.com',
+    address        => '123 Anystreet',
+    zip            => '84058',
+);
+
+main();
+
+sub main {
+    my $transaction = Business::OnlinePayment->new("vSecureProcessing", %opt);
+    $transaction->content(%content);
+    eval { $transaction->submit(); };
+
+    if ( $@ ) {
+    
+    print "Error: $@\n";
+    
+    } else {
+    
+        if ( $transaction->is_success() ) {
+            print "Card processed successfully: ". $transaction->authorization()."\n";
+        } else {
+            print "Card was rejected: ". $transaction->error_message(). "\n";
+        }
+    
+    }
+}
+
+
+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);
+}