[freeside-commits] branch master updated. 4da3c98f2f021ac48b195dd205bdbb85dc5b58b9

Ivan ivan at 420.am
Tue Jan 26 20:29:44 PST 2016


The branch, master has been updated
       via  4da3c98f2f021ac48b195dd205bdbb85dc5b58b9 (commit)
      from  bbb261f0dc3efe26abb71c4b17fd3386b82e8d8c (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 4da3c98f2f021ac48b195dd205bdbb85dc5b58b9
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jan 26 20:29:43 2016 -0800

    respect card-types config in backend (one-off payments), RT#39861

diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm
index 65b2821..ff0baee 100644
--- a/FS/FS/Mason.pm
+++ b/FS/FS/Mason.pm
@@ -138,6 +138,7 @@ if ( -e $addl_handler_use_file ) {
   use FS::Msgcat qw(gettext geterror);
   use FS::Misc qw( send_email send_fax ocr_image
                    states_hash counties cities state_label
+                   card_types
                  );
   use FS::Misc::eps2png qw( eps2png );
   use FS::Report::FCC_477;
diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi
index 0b0dffd..01f7dee 100644
--- a/httemplate/misc/process/payment.cgi
+++ b/httemplate/misc/process/payment.cgi
@@ -135,14 +135,22 @@ if ( $payby eq 'CHEK' ) {
 
   $payinfo =~ s/\D//g;
   $payinfo =~ /^(\d{13,16}|\d{8,9})$/
-    or errorpage(gettext('invalid_card')); # . ": ". $self->payinfo;
+    or errorpage(gettext('invalid_card'));
   $payinfo = $1;
   validate($payinfo)
-    or errorpage(gettext('invalid_card')); # . ": ". $self->payinfo;
+    or errorpage(gettext('invalid_card'));
 
-  errorpage(gettext('unknown_card_type'))
-    if $payinfo !~ /^99\d{14}$/ #token
-    && cardtype($payinfo) eq "Unknown";
+  unless ( $self->payinfo =~ /^99\d{14}$/ ) { #token
+
+    my $cardtype = cardtype($payinfo);
+
+    errorpage(gettext('unknown_card_type'))
+      if $cardtype eq "Unknown";
+
+    my %bop_card_types = map { $_=>1 } values %{ card_types() };
+    errorpage("$cardtype not accepted") unless $bop_card_types{$cardtype};
+
+  }
 
   if ( defined $cust_main->dbdef_table->column('paycvv') ) { #is this test necessary anymore?
     if ( length($cgi->param('paycvv') ) ) {

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

Summary of changes:
 FS/FS/Mason.pm                      |    1 +
 httemplate/misc/process/payment.cgi |   18 +++++++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list