merge in s5's changes
authorivan <ivan>
Sun, 10 May 2009 05:57:53 +0000 (05:57 +0000)
committerivan <ivan>
Sun, 10 May 2009 05:57:53 +0000 (05:57 +0000)
Changes
Jettis.pm

diff --git a/Changes b/Changes
index 03aadf9..4491b37 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,8 +1,19 @@
 Revision history for Perl extension Business::OnlinePayment::Jettis.
 
+0.05  unreleased
+        -merge in s5's changes; bump version to 0.05 to skip unreleased versions
+        -add some additional error numbers
+        -pass and return order_number (BILL_ITEM_ID)
+        -support "credit" action in addition to "normal authorization"
+        -support properly named "echeck" type (also support incorrect "check"
+         type still, so as not to break existing applications)
+        -pass PS_TXN_TYPE field type to jettis
+        -pass customer_ssn as SSN4
+        -pass bogus DL_NUM and DL_STATE info (XXX wtf?)
+
 0.02  Sun Jan 25 02:43:21 PST 2009
         -change SOR flag from Y to N to allow Jettis to scrub transactions
 
 0.01  Sat Nov  9 13:39:46 PST 2002
-       -original version; created by ivan 1.0
+        -original version; created by ivan 1.0
 
index 1eb295c..dae6bd2 100644 (file)
--- a/Jettis.pm
+++ b/Jettis.pm
@@ -13,7 +13,7 @@ require Exporter;
 @ISA = qw(Exporter AutoLoader Business::OnlinePayment);
 @EXPORT = qw();
 @EXPORT_OK = qw();
-$VERSION = '0.02';
+$VERSION = '0.05';
 
 $DEBUG = 0;
 
@@ -161,6 +161,10 @@ my %error = (
   407 => "Missing Check Number",
   408 => "Unsupported Transaction Type",
   409 => "Invalid Bank Name",
+  410 => "ACH Verification Declined",
+  435 => "Missing Drivers License",
+  436 => "Missing Drivers License State",
+  437 => "Invalid Drivers License",
   999 => "Unknown Error",
 );
 
@@ -169,12 +173,25 @@ sub set_defaults {
     $self->server('join.billingservices.com');
     $self->port('443');
     $self->path('/psys/txnUrl');
-    $self->build_subs(qw( product_id merchant_id ));
+    $self->build_subs(qw( product_id merchant_id order_number ));
 }
 
 sub revmap_fields {
     my($self, %map) = @_;
     my %content = $self->content();
+
+    # ACTION MAP
+    my %actions = ('normal authorization' => 'PURCHASE',
+                   'credit'               => 'CREDIT',
+                   );
+    $content{'action'} = $actions{lc($content{'action'})}
+      if exists( $actions{lc($content{'action'})} );
+
+    if ($content{'customer_ssn'} =~ /^(\d{3})-(\d{2})-(\d{4})$/)
+    {
+       $content{'ssn4'} = $3;
+    }
+
     foreach(keys %map) {
         $content{$_} = ref($map{$_})
                          ? ${ $map{$_} }
@@ -187,20 +204,19 @@ sub submit {
     my $self = shift;
     my %content = $self->content();
 
-    my $action = lc($content{'action'});
-    if ( $action eq 'normal authorization' ) {
-    } else {
-      croak "$action not (yet) supported";
-    }
-    
     my $type = lc($content{'type'});
-    if ( $type eq 'check' ) {
+    if ( $type =~ /^e?check$/ ) {
     } else {
       croak "$type not (yet) supported";
     }
 
+    my $action = $content{'action'};
+    croak "$action not currently supported"
+      unless $action =~ /^(PURCHASE|CREDIT)$/;
+
     $self->revmap_fields(
         SUCCESS_URL     => \'https://secure.suicidegirls.com/',
+        PS_TXN_TYPE     => 'action',
        PRODUCT_ID      => \($self->product_id()),
        MERCHANT_ID     => 'login',
        VERSION         => \'1.0',
@@ -218,19 +234,24 @@ sub submit {
        EMAIL           => 'email',
        FIRST_NAME      => 'first_name',
        LAST_NAME       => 'last_name',
+        SSN4            => 'ssn4',
        ADDR_STREET_1   => 'address',
        ADDR_CITY       => 'city',
        ADDR_STATE      => 'state',
        ADDR_ZIP        => 'zip',
        ADDR_COUNTRY    => \'840', # US
        MERCH_TEXT_AREA => 'description',
+        BILL_ITEM_ID    => 'order_number',
+        DL_NUM          => \'B01111111111', #XXX
+        DL_STATE        => 'state',         #XXX
     );
 
     my %post_data = $self->get_fields(qw(
-        SUCCESS_URL PRODUCT_ID MERCHANT_ID VERSION SOR REMOTE_ADDR
+        SUCCESS_URL PS_TXN_TYPE PRODUCT_ID MERCHANT_ID VERSION SOR REMOTE_ADDR
         TERMS_AGREE CHECK_AGE PAY_METHOD_ID PRICE QTY CHECK_NUM BANK_ACCT_NUM
-        BANK_ROUT_NUM BANK_NAME EMAIL FIRST_NAME LAST_NAME ADDR_STREET_1
-        ADDR_CITY ADDR_STATE ADDR_ZIP ADDR_COUNTRY MERCH_TEXT_AREA
+        BANK_ROUT_NUM BANK_NAME EMAIL FIRST_NAME LAST_NAME SSN4 ADDR_STREET_1
+        ADDR_CITY ADDR_STATE ADDR_ZIP ADDR_COUNTRY MERCH_TEXT_AREA BILL_ITEM_ID
+        DL_NUM DL_STATE
     ));
 
     my $pd = make_form(%post_data);
@@ -249,6 +270,7 @@ sub submit {
       $self->is_success(1);
       $self->result_code('0');
       $self->authorization($response{'AUTHORIZATION_CODE'});
+      $self->order_number($response{'BILL_ITEM_ID'});
     } else {
       $self->is_success(0);
       $self->result_code($response{'RESULT_MAIN'});
@@ -258,6 +280,7 @@ sub submit {
 }
 
 1;
+
 __END__
 
 =head1 NAME
@@ -270,7 +293,7 @@ Business::OnlinePayment::Jettis - Jettis backend for Business::OnlinePayment
 
   my $tx = new Business::OnlinePayment("Jettis");
   $tx->content(
-      type           => 'CHECK',
+      type           => 'ECHECK',
       login          => 'test', #ClientID
       action         => 'Normal Authorization',
       description    => 'Business::OnlinePayment test',
@@ -295,7 +318,7 @@ For detailed information see L<Business::OnlinePayment>.
 
 =head1 NOTE
 
-This module only implements 'CHECK' (ACH) functionality at this time.  Credit
+This module only implements 'ECHECK' (ACH) functionality at this time.  Credit
 card transactions are not (yet) supported.
 
 =head1 COMPATIBILITY