make ACH work, more tests
[Business-OnlinePayment-TransFirsteLink.git] / t / echeck.t
index 2d3de74..386efee 100644 (file)
@@ -9,10 +9,18 @@ use Business::OnlinePayment;
 
 my $runinfo =
     "to test set environment variables:"
-  . " (required) ELINK_ACH_ACCOUNT and ELINK_ACH_PASSWORD";
+  . " (required) ELINK_ACH_ACCOUNT, ELINK_ACH_PASSWORD"
+  . " ELINK_ROUTING_CODE, ELINK_BANK_ACCOUNT, ELINK_ACH_NAME"
+  . " ELINK_ACH_ADDRESS, ELINK_ACH_CITY, ELINK_ACH_STATE"
+  . " ELINK_ACH_ZIP, ELINK_ACH_PHONE";
 
 plan(
-      ( $ENV{"ELINK_ACH_ACCOUNT"} && $ENV{"ELINK_ACH_PASSWORD"} )
+      ( $ENV{"ELINK_ACH_ACCOUNT"} && $ENV{"ELINK_ACH_PASSWORD"} &&
+        $ENV{"ELINK_ROUTING_CODE"} && $ENV{"ELINK_BANK_ACCOUNT"} &&
+        $ENV{"ELINK_ACH_NAME"} && $ENV{"ELINK_ACH_ADDRESS"} &&
+        $ENV{"ELINK_ACH_CITY"} && $ENV{"ELINK_ACH_STATE"} &&
+        $ENV{"ELINK_ACH_ZIP"} && $ENV{"ELINK_ACH_PHONE"} 
+      )
     ? ( tests => 12 )
     : ( skip_all => $runinfo )
 );
@@ -27,23 +35,19 @@ my %content = (
     password       => $ENV{"ELINK_ACH_PASSWORD"},
     action         => "Normal Authorization",
     type           => "CHECK",
-    description    => "Business::OnlinePayment::TransFirsteLink test",
-    routing_code   => "052000113",
-    account_number => "000000000001",
-    check_number   => "100",
-    cvv2           => "123",
-    expiration     => "12/" . strftime( "%y", localtime ),
-    amount         => "0.01",
-    invoice_number => "1999",
-    account_name   => "Tofu Beast",
-    customer_id    => "TB01",
-    email          => 'transfirst@weasellips.com',
-    address        => "123 Anystreet",
-    city           => "Anywhere",
-    state          => "GA",
-    zip            => "30004",
-    country        => "US",
-    phone          => "4045551212",
+    description    => "Business::OnlinePayment::TransFirsteLink live test",
+    routing_code   => $ENV{"ELINK_ROUTING_CODE"},
+    account_number => $ENV{"ELINK_BANK_ACCOUNT"},
+    check_number   => "99",
+    amount         => "1.01",
+    invoice_number => "LiveTest",
+    customer_id    => "LiveTestCust",
+    account_name   => $ENV{"ELINK_ACH_NAME"},
+    address        => $ENV{"ELINK_ACH_ADDRESS"},
+    city           => $ENV{"ELINK_ACH_CITY"},
+    state          => $ENV{"ELINK_ACH_STATE"},
+    zip            => $ENV{"ELINK_ACH_ZIP"},
+    phone          => $ENV{"ELINK_ACH_PHONE"},
 );
 
 {    # valid account test
@@ -57,9 +61,7 @@ my %content = (
     );
 }
 
-SKIP: {    # invalid account test
-
-    skip "invalid account tests broken", 4;
+{    # invalid account test
 
     my $tx = new Business::OnlinePayment( "TransFirsteLink", %opts );
     $tx->content( %content, routing_code   => "052000113",
@@ -70,13 +72,11 @@ SKIP: {    # invalid account test
         $tx,
         desc          => "invalid account",
         is_success    => 0,
-        result_code   => 214,
+        result_code   => 'D10',
     );
 }
 
-SKIP: {    # credit/refund test
-
-    skip "credit/refund tests broken", 4;
+{    # credit/refund test
 
     my $tx = new Business::OnlinePayment( "TransFirsteLink", %opts );
     $tx->content( %content, action => "Credit");
@@ -84,15 +84,15 @@ SKIP: {    # credit/refund test
     tx_check(
         $tx,
         desc          => "credit/refund",
-        is_success    => 0,
-        result_code   => "P00",
+        is_success    => 1,
+        result_code   => "ACCEPTED",
     );
 }
 
 sub tx_check {
     my $tx = shift;
     my %o  = @_;
-
     $tx->test_transaction(1);
     $tx->submit;