X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FBilling_Batch.pm;h=eb66436ff28bcb16ba22adbbee2b35806cb053d7;hp=f91c5fbdc0bc04e9d4e5ddc462ea68389d85144e;hb=2a9d2460814b37e07d7cb83392723146a60d34c7;hpb=dd003d59f56742f9374cec309ad81d527e88c846 diff --git a/FS/FS/cust_main/Billing_Batch.pm b/FS/FS/cust_main/Billing_Batch.pm index f91c5fbdc..eb66436ff 100644 --- a/FS/FS/cust_main/Billing_Batch.pm +++ b/FS/FS/cust_main/Billing_Batch.pm @@ -65,12 +65,7 @@ sub batch_card { && !($options{payby} && $options{payinfo} && $options{paydate} && $options{payname}); #false laziness with Billing_Realtime - my @cust_payby = qsearch({ - 'table' => 'cust_payby', - 'hashref' => { 'custnum' => $self->custnum, }, - 'extra_sql' => " AND payby IN ( 'CARD', 'CHEK' ) ", - 'order_by' => 'ORDER BY weight ASC', - }); + my @cust_payby = $self->cust_payby('CARD','CHEK'); # batch can't try out every one like realtime, just use first one my $cust_payby = $cust_payby[0]; @@ -94,7 +89,7 @@ sub batch_card { #this needs to handle mysql as well as Pg, like svc_acct.pm #(make it into a common function if folks need to do batching with mysql) $dbh->do("LOCK TABLE pay_batch IN SHARE ROW EXCLUSIVE MODE") - or return "Cannot lock pay_batch: " . $dbh->errstr; + or die "Cannot lock pay_batch: " . $dbh->errstr; my %pay_batch = ( 'status' => 'O', @@ -119,7 +114,7 @@ sub batch_card { } ); foreach (qw( address1 address2 city state zip country latitude longitude - payby payinfo paydate payname )) + payby payinfo paydate payname paycode paytype )) { $options{$_} = '' unless exists($options{$_}); } @@ -143,9 +138,16 @@ sub batch_card { 'country' => $options{country} || $loc->country, 'payby' => $options{payby} || $cust_payby->payby, 'payinfo' => $options{payinfo} || $cust_payby->payinfo, + 'paymask' => ( $options{payinfo} + ? FS::payinfo_Mixin->mask_payinfo( $options{payby}, + $options{payinfo} ) + : $cust_payby->paymask + ), 'exp' => $options{paydate} || $cust_payby->paydate, 'payname' => $options{payname} || $cust_payby->payname, + 'paytype' => $options{paytype} || $cust_payby->paytype, 'amount' => $amount, # consolidating + 'paycode' => $options{paycode} || '', } ); $cust_pay_batch->paybatchnum($old_cust_pay_batch->paybatchnum) @@ -160,7 +162,8 @@ sub batch_card { if ( $error ) { $dbh->rollback if $oldAutoCommit; - die $error; + #die $error; + return $error; # e.g. "Illegal zip" ala RT#75998 } my $unapplied = $self->total_unapplied_credits