BOP Cardcom, RT13058
authorlevinse <levinse>
Tue, 7 Jun 2011 01:00:34 +0000 (01:00 +0000)
committerlevinse <levinse>
Tue, 7 Jun 2011 01:00:34 +0000 (01:00 +0000)
Cardcom.pm

index 68ba354..57e9d14 100644 (file)
@@ -24,7 +24,6 @@ sub set_defaults {
 # -Identity number
 # -Configurable currency
 # -Configurable deal code
-# -Refunds or whatever this thing calls them
 sub submit {
     my($self) = @_;
 
@@ -38,8 +37,13 @@ sub submit {
         cvv2        => 'cvv',
     );
 
-    die "invalid action" unless 
-            $self->{_content}{'action'} =~ /^\s*normal\s*authorization\s*$/i;
+    my $action = $self->{_content}{'action'};
+    if ( $action =~ /^\s*credit\s*$/i ) {
+        $self->{_content}{dealtype} = 51;
+        $self->{_content}{credittype} = 1;
+    } elsif ( $action !~ /^\s*normal\s*authorization\s*$/i ) {
+        die "invalid action";
+    }
 
     $self->{_content}{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/
         or croak "unparsable expiration ". $self->{_content}{expiration};
@@ -111,6 +115,8 @@ sub fields {
           Username
           userpassword
           languages
+          dealtype
+          credittype
           cvv
         );
 }
@@ -124,9 +130,10 @@ sub _info {
     'support_types'     => [ 'CC' ],
     'token_support'     => 0, # well technically the gateway supports it, but we haven't implemented it
     'test_transaction'  => 1, 
-    'supported_actions' => [  # XXX refunds
+    'supported_actions' => [ 
                             'Normal Authorization',
-                           ],
+                            'Credit', 
+                           ], 
    };
 }