0.03, cvv2 not required for all transactions (+add test, update MANIFEST), RT#32782
authorIvan Kohler <ivan@freeside.biz>
Sat, 14 Feb 2015 22:37:29 +0000 (14:37 -0800)
committerIvan Kohler <ivan@freeside.biz>
Sat, 14 Feb 2015 22:37:29 +0000 (14:37 -0800)
Changes
MANIFEST
lib/Business/OnlinePayment/vSecureProcessing.pm
t/transaction_nocvv.t [new file with mode: 0644]

diff --git a/Changes b/Changes
index adf9472..360e0a0 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,7 +1,9 @@
 Revision history for Perl module Business::OnlinePayment::vSecureProcessing
 
-0.03    unreleased
+0.03    Sat Feb 14 14:28:31 PST 2015
         - Update AUTHOR and PREREQ_PM (Net::HTTPS::Any) in Makefile.PL
+        - cvv2 is not required for all transactions
+        - Update MANIFEST for renamed tests
 
 0.02    Feb 12 2015
         - Update for production URL
index df6a903..87466a8 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -4,10 +4,11 @@ Makefile.PL
 README
 ignore.txt
 lib/Business/OnlinePayment/vSecureProcessing.pm
-t/t_00-load.t
-t/t_boilerplate.t
-t/t_manifest.t
-t/t_pod-coverage.t
-t/t_pod.t
-t/t_transaction.t
-t/t_transaction_decline.t
+t/00-load.t
+t/boilerplate.t
+t/manifest.t
+t/pod-coverage.t
+t/pod.t
+t/transaction.t
+t/transaction_nocvv.t
+t/transaction_decline.t
index 63a8080..75675f3 100644 (file)
@@ -11,7 +11,7 @@ use Business::OnlinePayment::HTTPS;
 
 @ISA = qw(Business::OnlinePayment::HTTPS);
 $DEBUG = 0;
-$VERSION = '0.03_01';
+$VERSION = '0.03';
 
 # mapping out all possible endpoints
 # but this version will only be building out "charge", "void", & "credit"
@@ -238,7 +238,7 @@ sub submit {
     my @required_fields = qw/ Amount /;
     if ($action eq 'charge') {
         push @required_fields, $_
-          foreach (qw/ AccountNumber Cvv ExpirationMonth ExpirationYear /);
+          foreach (qw/ AccountNumber ExpirationMonth ExpirationYear /);
     }elsif ($action eq 'void') {
         push @required_fields, $_
           foreach (qw/ ReferenceNumber /);
diff --git a/t/transaction_nocvv.t b/t/transaction_nocvv.t
new file mode 100644 (file)
index 0000000..625c01d
--- /dev/null
@@ -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;