- my $payinfo = $self->payinfo;
- my $cardtype = cardtype($payinfo);
- $self->set('cardtype', $cardtype);
+
+ # see parallel checks in cust_payby::check & cust_payby::check_payinfo_cardtype
+ if ( $self->tokenized ) {
+ $self->set('is_tokenized', 'Y'); #so we don't try to do it again
+ if ( $self->paymask =~ /^\d+x/ ) {
+ $self->set('paycardtype', cardtype($self->paymask));
+ } else {
+ $self->set('paycardtype', '') unless $self->paycardtype;
+ #return "paycardtype required ".
+ # "(can't derive from a token and no paymask w/prefix provided)";
+ }
+ } else {
+ $self->set('paycardtype', cardtype($self->payinfo));
+ }
+