diff options
author | Ivan Kohler <ivan@freeside.biz> | 2017-01-25 17:31:14 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2017-01-25 17:31:14 -0800 |
commit | 0b84aeb64263783a180012aa79a91626701ae391 (patch) | |
tree | 743c81e565e58bdf13fc05e0f9364619f8dc9e92 | |
parent | baca421d2fa815a6338e9525e3e404928b59235e (diff) |
fix upgrades, fix bogus "Tokenized" paycardtype, RT#71513
-rw-r--r-- | FS/FS/payinfo_Mixin.pm | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/FS/FS/payinfo_Mixin.pm b/FS/FS/payinfo_Mixin.pm index 520b2458b..bca0878a2 100644 --- a/FS/FS/payinfo_Mixin.pm +++ b/FS/FS/payinfo_Mixin.pm @@ -199,14 +199,16 @@ sub payinfo_check { if ( $self->payby eq 'CARD' && ! $self->is_encrypted($self->payinfo) ) { - my $payinfo = $self->payinfo; - my $cardtype = cardtype($payinfo); - $cardtype = 'Tokenized' if $payinfo =~ /^99\d{14}$/; - $self->set('paycardtype', $cardtype); + if ( $self->payinfo =~ /^99\d{14}$/ && ! $self->paycardtype ) { + return "paycardtype required (cannot be derived from a token)"; + } else { + $self->set('paycardtype', cardtype($self->payinfo)); + } if ( $ignore_masked_payinfo and $self->mask_payinfo eq $self->payinfo ) { # allow it } else { + my $payinfo = $self->payinfo; $payinfo =~ s/\D//g; $self->payinfo($payinfo); if ( $self->payinfo ) { @@ -214,7 +216,7 @@ sub payinfo_check { 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 $cardtype eq "Unknown"; + return "Unknown card type" if $self->paycardtype eq "Unknown"; } else { $self->payinfo('N/A'); #??? } |