summaryrefslogtreecommitdiff
path: root/FS/FS/payinfo_Mixin.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-01-02 19:01:16 -0800
committerMark Wells <mark@freeside.biz>2013-01-02 19:01:16 -0800
commite5d6af11f52aabe8c9e6e12ce43c3401ccf025a8 (patch)
treee67a2737e58566ad7d4e4b759b3bf4a542dae25d /FS/FS/payinfo_Mixin.pm
parentc7286ce9036d71665c2bfed9de93f87309b72d35 (diff)
move credit card transaction results out of paybatch and into real fields, #18548
Diffstat (limited to 'FS/FS/payinfo_Mixin.pm')
-rw-r--r--FS/FS/payinfo_Mixin.pm28
1 files changed, 16 insertions, 12 deletions
diff --git a/FS/FS/payinfo_Mixin.pm b/FS/FS/payinfo_Mixin.pm
index 7b713ef..9879a3a 100644
--- a/FS/FS/payinfo_Mixin.pm
+++ b/FS/FS/payinfo_Mixin.pm
@@ -5,6 +5,8 @@ use Business::CreditCard;
use FS::payby;
use FS::Record qw(qsearch);
+use vars qw($ignore_masked_payinfo);
+
=head1 NAME
FS::payinfo_Mixin - Mixin class for records in tables that contain payinfo.
@@ -207,17 +209,21 @@ sub payinfo_check {
if ( $self->payby eq 'CARD' && ! $self->is_encrypted($self->payinfo) ) {
my $payinfo = $self->payinfo;
- $payinfo =~ s/\D//g;
- $self->payinfo($payinfo);
- if ( $self->payinfo ) {
- $self->payinfo =~ /^(\d{13,16}|\d{8,9})$/
- or return "Illegal (mistyped?) credit card number (payinfo)";
- $self->payinfo($1);
- validate($self->payinfo) or return "Illegal credit card number";
- return "Unknown card type" if $self->payinfo !~ /^99\d{14}$/ #token
- && cardtype($self->payinfo) eq "Unknown";
+ if ( $ignore_masked_payinfo and $self->mask_payinfo eq $self->payinfo ) {
+ # allow it
} else {
- $self->payinfo('N/A'); #???
+ $payinfo =~ s/\D//g;
+ $self->payinfo($payinfo);
+ if ( $self->payinfo ) {
+ $self->payinfo =~ /^(\d{13,16}|\d{8,9})$/
+ or return "Illegal (mistyped?) credit card number (payinfo)";
+ $self->payinfo($1);
+ validate($self->payinfo) or return "Illegal credit card number";
+ return "Unknown card type" if $self->payinfo !~ /^99\d{14}$/ #token
+ && cardtype($self->payinfo) eq "Unknown";
+ } else {
+ $self->payinfo('N/A'); #???
+ }
}
} else {
if ( $self->is_encrypted($self->payinfo) ) {
@@ -230,8 +236,6 @@ sub payinfo_check {
}
}
- '';
-
}
=item payby_payinfo_pretty