- push @order, (
- avsZip => $item->zip,
- avsAddress1 => substr($item->address, 0, 30),
- avsAddress2 => substr($item->address2, 0, 30),
- avsCity => substr($item->city, 0, 20),
- avsState => substr($item->state, 0, 2),
- avsName => substr($item->first_name. ' '. $item->last_name, 0, 30),
- avsCountryCode => ( $paymentech_countries{ $item->country }
- ? $_->country
- : ''
- ),
+ if ( $self->with_recurringInd ) {
+ if ( $item->recurring_billing eq 'F' ) {
+ push @order, ( recurringInd => 'RF' );
+ } elsif ( $item->recurring_billing eq 'S' ) {
+ push @order, ( recurringInd => 'RS' );
+ }
+ } # else don't send recurringInd at all
+
+ push @order, ( # truncate_egc will die() on empty string
+ avsZip => $item->zip,
+ avsAddress1 => $item->address ? truncate_egc($item->address, 30, '') : undef,
+ avsAddress2 => $item->address2 ? truncate_egc($item->address2, 30, '') : undef,
+ avsCity => $item->city ? truncate_egc($item->city, 20, '') : undef,
+ avsState => $item->state ? truncate_egc($item->state, 2, '') : undef,
+ avsName => ($item->first_name || $item->last_name)
+ ? truncate_egc($item->first_name.' '.$item->last_name, 30, '')
+ : undef,
+ ( $paymentech_countries{ $item->country }
+ ? ( avsCountryCode => $item->country )
+ : ()
+ ),