[freeside-commits] branch FREESIDE_3_BRANCH updated. 376a9227af02de5862eb9252d22aca3c845995db

Christopher Burger burgerc at freeside.biz
Fri Nov 30 06:27:35 PST 2018


The branch, FREESIDE_3_BRANCH has been updated
       via  376a9227af02de5862eb9252d22aca3c845995db (commit)
       via  44a2299c10d051d152d0a000641d7740299be3d4 (commit)
      from  fbaf3e9e3233bff32eded049ef9923b397e7c90c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 376a9227af02de5862eb9252d22aca3c845995db
Merge: 44a2299c1 fbaf3e9e3
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Fri Nov 30 09:24:49 2018 -0500

    Merge branch 'FREESIDE_3_BRANCH' of ssh://git.freeside.biz/home/git/freeside into FREESIDE_3_BRANCH


commit 44a2299c10d051d152d0a000641d7740299be3d4
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Thu Nov 29 14:49:24 2018 -0500

    RT# 81557 - Added checkbox to validate cc on import, and cc validation.
    
    Conflicts:
            FS/FS/cust_main/Import.pm

diff --git a/FS/FS/cust_main/Import.pm b/FS/FS/cust_main/Import.pm
index d7a66db1b..49d87f231 100644
--- a/FS/FS/cust_main/Import.pm
+++ b/FS/FS/cust_main/Import.pm
@@ -16,6 +16,7 @@ use FS::svc_external;
 use FS::svc_phone;
 use FS::svc_hardware;
 use FS::part_referral;
+use Business::CreditCard 0.35;
 
 $DEBUG = 0;
 
@@ -98,6 +99,7 @@ sub process_batch_import {
       agentnum  => $param->{'agentnum'},
       refnum    => $param->{'refnum'},
       pkgpart   => $param->{'pkgpart'},
+      validate_cc => $param->{'validate_cc'},
       #'fields'  => [qw( cust_pkg.setup dayphone first last address1 address2
       #                 city state zip comments                          )],
       'format'  => $param->{'format'},
@@ -128,6 +130,7 @@ sub batch_import {
   my $agentnum  = $param->{agentnum};
   my $refnum    = $param->{refnum};
   my $pkgpart   = $param->{pkgpart};
+  my $validate_cc = $param->{validate_cc};
 
   my $format    = $param->{'format'};
 
@@ -431,6 +434,15 @@ sub batch_import {
         $cust_main{'payby'} = 'CARD';
 
         if ($cust_main{'payinfo'} =~ /^\s*([AD]?)(.*)\s*$/) {
+
+          ## validate credit card if requested
+          if ($validate_cc) {
+            validate($2)
+              or return "Invalid card($2) for customer ".$cust_main{'first'}." ".$cust_main{'last'};
+            return "Unknown card type for customer ".$cust_main{'first'}." ".$cust_main{'last'}
+              if cardtype($2) eq "Unknown";
+          }
+
           $cust_main{'payby'} = 'DCRD' if $1 eq 'D';
           $cust_main{'payinfo'} = $2;
         }
diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi
index 46d15363d..20b5528d8 100644
--- a/httemplate/misc/cust_main-import.cgi
+++ b/httemplate/misc/cust_main-import.cgi
@@ -42,6 +42,13 @@ Import a file containing customer records.
     </TD>
   </TR>
 
+  <& /elements/tr-checkbox.html,
+       'label' => 'Validate credit card',
+       'field' => 'validate_cc',
+       'id'    => 'validate_cc',
+       'value' => 'Y',
+  &>
+
   <% include( '/elements/file-upload.html',
                 'field' => 'file',
                 'label' => 'Filename',

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_main/Import.pm            | 12 ++++++++++++
 httemplate/misc/cust_main-import.cgi |  7 +++++++
 2 files changed, 19 insertions(+)




More information about the freeside-commits mailing list