summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-02-14 14:37:29 -0800
committerIvan Kohler <ivan@freeside.biz>2015-02-14 14:37:29 -0800
commit51c7503002afd10e1070a60494bb1daca9daba16 (patch)
tree65600fdd13a0ef62c55724ad70921c69c0c39862 /t
parent31f44561c99a6e0cc8f627ec81bacd7b8abdccaf (diff)
0.03, cvv2 not required for all transactions (+add test, update MANIFEST), RT#32782
Diffstat (limited to 't')
-rw-r--r--t/transaction_nocvv.t63
1 files changed, 63 insertions, 0 deletions
diff --git a/t/transaction_nocvv.t b/t/transaction_nocvv.t
new file mode 100644
index 0000000..625c01d
--- /dev/null
+++ b/t/transaction_nocvv.t
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use POSIX qw(strftime);
+use Test::More;
+use Business::OnlinePayment;
+require "t/lib/test_account.pl";
+
+my %opts = test_account('card');
+
+if (!$opts{'login'} || !$opts{'password'}) {
+ plan skip_all => "no test credentials provided; fill out t/lib/test_account.pl to test communication with the gateway.",
+ 1;
+ exit(0);
+}
+
+plan tests => 2;
+
+###
+# Purchase
+###
+my %content = (
+ login => delete($opts{'login'}),
+ password => delete($opts{'password'}),
+ action => 'Normal Authorization',
+ description => 'Business::OnlinePayment visa test',
+ card_number => '4111111111111111',
+ expiration => expiration_date(),
+ amount => '24.42',
+ name => 'Murphy Law',
+ email => 'fake@acme.com',
+ address => '123 Anystreet',
+ zip => '84058',
+);
+
+my $tx = new Business::OnlinePayment( 'vSecureProcessing', %opts );
+
+$tx->content( %content );
+
+$tx->test_transaction(1);
+
+$tx->submit;
+
+is( $tx->is_success, 1, 'purchase' )
+ or diag('Gateway error: '. $tx->error_message);
+
+###
+# Refund
+###
+my $auth = $tx->authorization;
+$tx = new Business::OnlinePayment( 'vSecureProcessing', %opts );
+$tx->content( %content,
+ action => 'Credit',
+ authorization => $auth );
+$tx->test_transaction(1);
+
+$tx->submit;
+
+is( $tx->is_success, 1, 'refund' )
+ or diag('Gateway error: '. $tx->error_message);
+
+1;