[freeside-commits] branch master updated. 901c65cbf43e17a59a80d52ca01d1ac1628a856a

Christopher Burger burgerc at freeside.biz
Thu Nov 29 11:53:41 PST 2018


The branch, master has been updated
       via  901c65cbf43e17a59a80d52ca01d1ac1628a856a (commit)
       via  289c2643882c611a068fffd06e42e258264844e8 (commit)
      from  aad287228dfbe5ef01be73ebaaa9a06dfbe11226 (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 901c65cbf43e17a59a80d52ca01d1ac1628a856a
Merge: 289c26438 aad287228
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Thu Nov 29 14:50:50 2018 -0500

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


commit 289c2643882c611a068fffd06e42e258264844e8
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.

diff --git a/FS/FS/cust_main/Import.pm b/FS/FS/cust_main/Import.pm
index 9624529fa..dcedc16b1 100644
--- a/FS/FS/cust_main/Import.pm
+++ b/FS/FS/cust_main/Import.pm
@@ -14,6 +14,7 @@ use FS::svc_external;
 use FS::svc_phone;
 use FS::svc_hardware;
 use FS::part_referral;
+use Business::CreditCard 0.35;
 
 $DEBUG = 0;
 
@@ -95,6 +96,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'},
@@ -125,6 +127,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'};
 
@@ -421,6 +424,14 @@ sub batch_import {
 
         delete $cust_main{'payinfo'};
 
+        ## 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_payby = new FS::cust_payby {
           'payby'   => ($1 eq 'D') ? 'DCRD' : 'CARD',
           '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            | 11 +++++++++++
 httemplate/misc/cust_main-import.cgi |  7 +++++++
 2 files changed, 18 insertions(+)




More information about the freeside-commits mailing list