# This block will only run if the B::OP module supports card_token but not the Tokenize transaction;
# if that never happens, we should get rid of it (as it has the potential to store real card numbers on error)
- if ( $transaction->can('card_token') && $transaction->card_token ) {
- if ( $options{'payinfo'} eq $self->payinfo ) {
- $self->payinfo($transaction->card_token);
- my $error = $self->replace;
- if ( $error ) {
- $log->critical('Error storing token for cust '.$self->custnum.': '.$error);
- #not returning error, should at least attempt to handle results of an otherwise valid transaction
- #this leaves real card number in cust_main, but can't do much else if cust_main won't replace
- warn "WARNING: error storing token: $error, but proceeding anyway\n";
- }
+ if (my $card_token = $self->_tokenize_card($transaction,\%options)) {
+ # cpp will be replaced in _realtime_bop_result
+ $cust_pay_pending->payinfo($card_token);
+ my $error = $self->replace;
+ if ( $error ) {
+ $log->critical('Error storing token for cust '.$self->custnum.': '.$error);
+ #not returning error, should at least attempt to handle results of an otherwise valid transaction
+ #this leaves real card number in cust_main, but can't do much else if cust_main won't replace
+ warn "WARNING: error storing token: $error, but proceeding anyway\n";
}
}