diff options
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 4 | ||||
-rw-r--r-- | FS/FS/cust_main.pm | 20 |
2 files changed, 17 insertions, 7 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 6e9bf23a9..e12e93b12 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -193,7 +193,7 @@ sub process_payment { my $new = new FS::cust_main { $cust_main->hash }; $new->set( $_ => $p->{$_} ) foreach qw( payname address1 address2 city state zip payinfo ); - $new->set( 'paydate' => $p->{'month'}. '-'. $p->{'year'} ); + $new->set( 'paydate' => $p->{'year'}. '-'. $p->{'month'}. '-01' ); $new->set( 'payby' => $p->{'auto'} ? 'CARD' : 'DCRD' ); my $error = $new->replace($cust_main); return { 'error' => $error } if $error; @@ -201,7 +201,7 @@ sub process_payment { } my $error = $cust_main->realtime_bop( 'CC', $p->{'amount'}, quiet=>1, - 'paydate' => $p->{'month'}. '-'. $p->{'year'}, + 'paydate' => $p->{'year'}. '-'. $p->{'month'}. '-01', map { $_ => $p->{$_} } qw( payname address1 address2 city state zip payinfo ) ); diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 09c56474c..7e2ff388e 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -33,7 +33,7 @@ use FS::Msgcat qw(gettext); @ISA = qw( FS::Record ); -$Debug = 0; +$Debug = 1; #$Debug = 1; $import = 0; @@ -761,10 +761,15 @@ sub check { unless $self->payby =~ /^(BILL|PREPAY|CHEK|LECB)$/; $self->paydate(''); } else { - $self->paydate =~ /^(\d{1,2})[\/\-](\d{2}(\d{2})?)$/ - or return "Illegal expiration date: ". $self->paydate; - my $y = length($2) == 4 ? $2 : "20$2"; - $self->paydate("$y-$1-01"); + my( $m, $y ); + if ( $self->paydate =~ /^(\d{1,2})[\/\-](\d{2}(\d{2})?)$/ ) { + ( $m, $y ) = ( $1, length($2) == 4 ? $2 : "20$2" ); + } elsif ( $self->paydate =~ /^(20)?(\d{2})[\/\-](\d{2})[\/\-]\d+$/ ) { + ( $m, $y ) = ( $3, "20$2" ); + } else { + return "Illegal expiration date: ". $self->paydate; + } + $self->paydate("$y-$m-01"); my($nowm,$nowy)=(localtime(time))[4,5]; $nowm++; $nowy+=1900; return gettext('expired_card') if !$import && ( $y<$nowy || ( $y==$nowy && $1<$nowm ) ); @@ -1438,6 +1443,11 @@ I<quiet> can be set true to surpress email decline notices. sub realtime_bop { my( $self, $method, $amount, %options ) = @_; + if ( $Debug ) { + warn "$self $method $amount\n"; + warn " $_ => $options{$_}\n" foreach keys %options; + } + $options{'description'} ||= 'Internet services'; #pre-requisites |