[freeside-commits] branch master updated. 57ac39c47a28bcf9dc1f689e6bd6234f0218d0ad
Jonathan Prykop
jonathan at 420.am
Wed Feb 1 12:11:15 PST 2017
The branch, master has been updated
via 57ac39c47a28bcf9dc1f689e6bd6234f0218d0ad (commit)
from 87d108d379a5c077370afc04728d1c28e9edef30 (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 57ac39c47a28bcf9dc1f689e6bd6234f0218d0ad
Author: Jonathan Prykop <jonathan at freeside.biz>
Date: Wed Feb 1 14:00:53 2017 -0600
71513: Card tokenization [tweaks to paycardtype checks]
diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm
index 36f90df..e25d73e 100644
--- a/FS/FS/cust_payby.pm
+++ b/FS/FS/cust_payby.pm
@@ -356,7 +356,19 @@ sub check {
validate($payinfo)
or return gettext('invalid_card'); # . ": ". $self->payinfo;
- my $cardtype = $self->paycardtype || cardtype($payinfo);
+ # see parallel checks in check_payinfo_cardtype & payinfo_Mixin::payinfo_check
+ my $cardtype = '';
+ if ( $self->tokenized ) {
+ if ( $self->paymask =~ /^\d+x/ ) {
+ $cardtype = cardtype($self->paymask);
+ } else {
+ $cardtype = '';
+ #return "paycardtype required ".
+ # "(can't derive from a token and no paymask w/prefix provided)";
+ }
+ } else {
+ $cardtype = cardtype($self->payinfo);
+ }
return gettext('unknown_card_type') if $cardtype eq "Unknown";
@@ -545,7 +557,15 @@ sub check_payinfo_cardtype {
my $payinfo = $self->payinfo;
$payinfo =~ s/\D//g;
+ # see parallel checks in cust_payby::check & payinfo_Mixin::payinfo_check
if ( $self->tokenized($payinfo) ) {
+ if ( $self->paymask =~ /^\d+x/ ) {
+ $self->set('paycardtype', cardtype($self->paymask));
+ } else {
+ $self->set('paycardtype', '');
+ #return "paycardtype required ".
+ # "(can't derive from a token and no paymask w/prefix provided)";
+ }
return '';
}
diff --git a/FS/FS/payinfo_Mixin.pm b/FS/FS/payinfo_Mixin.pm
index 7401eb9..cb9b723 100644
--- a/FS/FS/payinfo_Mixin.pm
+++ b/FS/FS/payinfo_Mixin.pm
@@ -197,20 +197,17 @@ sub payinfo_check {
if ( $self->payby eq 'CARD' && ! $self->is_encrypted($self->payinfo) ) {
- unless ( $self->paycardtype ) {
-
- if ( $self->tokenized ) {
- if ( $self->paymask =~ /^\d+x/ ) {
- $self->set('paycardtype', cardtype($self->paymask));
- } else {
- $self->set('paycardtype', '');
- # return "paycardtype required ".
- # "(can't derive from a token and no paymask w/prefix provided)";
- }
+ # see parallel checks in cust_payby::check & cust_payby::check_payinfo_cardtype
+ if ( $self->tokenized ) {
+ if ( $self->paymask =~ /^\d+x/ ) {
+ $self->set('paycardtype', cardtype($self->paymask));
} else {
- $self->set('paycardtype', cardtype($self->payinfo));
+ $self->set('paycardtype', '');
+ #return "paycardtype required ".
+ # "(can't derive from a token and no paymask w/prefix provided)";
}
-
+ } else {
+ $self->set('paycardtype', cardtype($self->payinfo));
}
if ( $ignore_masked_payinfo and $self->mask_payinfo eq $self->payinfo ) {
@@ -232,17 +229,13 @@ sub payinfo_check {
} else {
- unless ( $self->paycardtype ) {
-
- if ( $self->payby eq 'CARD' && $self->paymask =~ /^\d+x/ ) {
- # if we can't decrypt the card, at least detect the cardtype
- $self->set('paycardtype', cardtype($self->paymask));
- } else {
- $self->set('paycardtype', '');
- # return "paycardtype required ".
- # "(can't derive from a token and no paymask w/prefix provided)";
- }
-
+ if ( $self->payby eq 'CARD' && $self->paymask =~ /^\d+x/ ) {
+ # if we can't decrypt the card, at least detect the cardtype
+ $self->set('paycardtype', cardtype($self->paymask));
+ } else {
+ $self->set('paycardtype', '');
+ # return "paycardtype required ".
+ # "(can't derive from a token and no paymask w/prefix provided)";
}
if ( $self->is_encrypted($self->payinfo) ) {
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_payby.pm | 22 +++++++++++++++++++++-
FS/FS/payinfo_Mixin.pm | 39 ++++++++++++++++-----------------------
2 files changed, 37 insertions(+), 24 deletions(-)
More information about the freeside-commits
mailing list