diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-02-12 14:27:41 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-02-12 14:27:41 -0800 |
commit | 28425f2f6ecee736d64cf6a45a74dc4f4992edbd (patch) | |
tree | 0087ff57298a6a175a95c0d3ec647fd28404e6a6 /extra/test.pl | |
parent | 59dc9c0128f8c9258c9ec80f11754dd1e7ecf26e (diff) |
- Update for production URL
- Use username/password for auth like other B:OP modules
- Fix tests
- Remove extraneous extra/ stuff in repo
Diffstat (limited to 'extra/test.pl')
-rwxr-xr-x | extra/test.pl | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/extra/test.pl b/extra/test.pl deleted file mode 100755 index 50aa857..0000000 --- a/extra/test.pl +++ /dev/null @@ -1,96 +0,0 @@ -#!/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 Data::Dumper; -use Business::OnlinePayment; - -my %opt = ( - server =>'dvrotsos2.kattare.com', - platform => 'Buypass', - gid => '1432479912596791', - tid => '01', - userid=> 'tom@yiptv.com', - port => 443, - env => 'test' -); - -my $action = shift || 'Normal Authorization'; -my $auth = shift || ''; - - -my %content = ( - appid => 'yiptv', - action => $action, - auth => $auth, - 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); - - print "MAKING PAYMENT\n"; - ProcessTransaction($transaction); - $content{'action'} = 'void'; - $content{'ref_num'} = $transaction->authorization(); - $content{'txn_date'} = $transaction->txn_date(); - $content{'amount'} = $transaction->txn_amount; - print "VOIDING PAYMENT\n"; - ProcessTransaction($transaction); - $content{'action'} = 'Normal Authorization'; - $content{'amount'} = '30.00'; - print "MAKING PAYMENT\n"; - ProcessTransaction($transaction); - $content{'action'} = 'credit'; - $content{'ref_num'} = $transaction->authorization; - $content{'txn_date'} = $transaction->txn_date; - $content{'amount'} = $transaction->txn_amount; - print "REFUNDING PAYMENT\n"; - ProcessTransaction($transaction); -} - -sub ProcessTransaction { - my $transaction = shift; - #print "Processing transaction with content:\n".Dumper(\%content)."\n"; - $transaction->content(%content); - - eval { $transaction->submit(); }; - - if ( $@ ) { - - die "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); -} |