X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FBilling_Batch.pm;fp=FS%2FFS%2Fcust_main%2FBilling_Batch.pm;h=f91c5fbdc0bc04e9d4e5ddc462ea68389d85144e;hp=cdaf2938f1d0304ba704d8099de0a4a8bfd69842;hb=1259a17db297fa2352619b29f2c5bd34e313cd64;hpb=38444ef88b5e93aa9aa724369ae8fe17c97fa480 diff --git a/FS/FS/cust_main/Billing_Batch.pm b/FS/FS/cust_main/Billing_Batch.pm index cdaf2938f..f91c5fbdc 100644 --- a/FS/FS/cust_main/Billing_Batch.pm +++ b/FS/FS/cust_main/Billing_Batch.pm @@ -23,8 +23,6 @@ Options may include: B: the amount to be paid; defaults to the customer's balance minus any payments in transit. -B: the payment method; defaults to cust_main.payby - B: runs this as a realtime payment instead of adding it to a batch. Deprecated. @@ -34,8 +32,9 @@ B, B, B, B, B, B: sets the billing address for the payment; defaults to the customer's billing location. -B, B, B: sets the payment account, expiration -date, and name; defaults to those fields in cust_main. +B, B, B, B: sets the payment method, +payment account, expiration date, and name; defaults to those fields +in cust_main. =cut @@ -58,6 +57,13 @@ sub batch_card { my $invnum = delete $options{invnum}; + #pay fields should all come from either cust_payby or options, not both + # in theory, could just pass payby, and use it to select cust_payby, + # but nothing currently needs that, so not implementing it now + die "Incomplete payment details" + if ($options{payby} || $options{payinfo} || $options{paydate} || $options{payname}) + && !($options{payby} && $options{payinfo} && $options{paydate} && $options{payname}); + #false laziness with Billing_Realtime my @cust_payby = qsearch({ 'table' => 'cust_payby', @@ -67,7 +73,10 @@ sub batch_card { }); # batch can't try out every one like realtime, just use first one - my $cust_payby = $cust_payby[0] || $self; # somewhat dubious + my $cust_payby = $cust_payby[0]; + + die "No customer payment info found" + unless $options{payinfo} || $cust_payby; my $payby = $options{payby} || $cust_payby->payby;