X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=59e357055535a505a166bb5d2657e9f80082b778;hp=fc744dc5f75377922e7059eac22cb709b17e6e1f;hb=73f34cbe08a9be968a2557cd6906dde5bb9a97a3;hpb=cec266740d89b82ce9075954928c5b336d0ec18e diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index fc744dc5f..59e357055 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1701,7 +1701,7 @@ sub realtime_bop { #overrides $self->set( $_ => $options{$_} ) foreach grep { exists($options{$_}) } - qw( payname address1 address2 city state zip payinfo paydate ); + qw( payname address1 address2 city state zip payinfo paydate paycvv); #load up config my $bop_config = 'business-onlinepayment'; @@ -1711,6 +1711,9 @@ sub realtime_bop { $conf->config($bop_config); $action ||= 'normal authorization'; pop @bop_options if scalar(@bop_options) % 2 && $bop_options[-1] =~ /^\s*$/; + die "No real-time processor is enabled - ". + "did you set the business-onlinepayment configuration value?\n" + unless $processor; #massage data @@ -1837,11 +1840,12 @@ sub realtime_bop { } #remove paycvv after initial transaction - #make this disable-able via a config option if anyone insists? - # (though that probably violates cardholder agreements) + #false laziness w/misc/process/payment.cgi - check both to make sure working + # correctly if ( defined $self->dbdef_table->column('paycvv') && length($self->paycvv) && ! grep { $_ eq cardtype($self->payinfo) } $conf->config('cvv-save') + && ! length($options{'paycvv'}) ) { my $new = new FS::cust_main { $self->hash }; $new->paycvv(''); @@ -2121,6 +2125,24 @@ sub balance_date { ); } +=item paydate_monthyear + +Returns a two-element list consisting of the month and year of this customer's +paydate (credit card expiration date for CARD customers) + +=cut + +sub paydate_monthyear { + my $self = shift; + if ( $self->paydate =~ /^(\d{4})-(\d{2})-\d{2}$/ ) { #Pg date format + ( $2, $1 ); + } elsif ( $self->paydate =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { + ( $1, $3 ); + } else { + ('', ''); + } +} + =item invoicing_list [ ARRAYREF ] If an arguement is given, sets these email addresses as invoice recipients