From: Jonathan Prykop Date: Thu, 25 Feb 2016 15:14:26 +0000 (-0600) Subject: RT#30600: Auto Apply for CC payments [v3 merge] X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=fbba36b298b90d72884e8a46b74e9fd7b67b4d34;p=freeside.git RT#30600: Auto Apply for CC payments [v3 merge] --- diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm index e9a3db2fd..345568a15 100644 --- a/FS/FS/cust_main/Billing_Realtime.pm +++ b/FS/FS/cust_main/Billing_Realtime.pm @@ -129,7 +129,9 @@ specified invoice. If the customer has exactly one open invoice, that invoice number will be assumed. If you don't specify an I you might want to call the B method or set the I option. -I can be set to true to apply a resulting payment. +I can be set to true to run B on success. + +I can be set to true to prevent resulting payment from being automatically applied. I can be set true to surpress email decline notices. @@ -870,7 +872,7 @@ sub _realtime_bop_result { 'processor' => $payment_gateway->gateway_module, 'auth' => $transaction->authorization, 'order_number' => $order_number || '', - + 'no_auto_apply' => $options{'no_auto_apply'} ? 'Y' : '', } ); #doesn't hurt to know, even though the dup check is in cust_pay_pending now $cust_pay->payunique( $options{payunique} ) diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index a48aa0120..2f76b85f1 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -204,11 +204,13 @@ +% my $disallow_no_auto_apply = 0; % if ( $conf->exists("batch-enable") % || grep $payby eq $_, $conf->config('batch-enable_payby') % ) { % % if ( grep $payby eq $_, $conf->config('realtime-disable_payby') ) { +% $disallow_no_auto_apply = 1; @@ -216,7 +218,7 @@ - + <% mt('Add to current batch') |h %> @@ -231,6 +233,35 @@ +% unless ($disallow_no_auto_apply) { +% # false laziness with edit/cust_pay.cgi + + + + <% mt('Auto-apply to invoices') |h %> + + + + +% # this can go away if no_auto_apply handling gets added to batch payment processing + + +% } +
diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 78038f86b..7da7beff0 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -218,6 +218,7 @@ if ( $cgi->param('batch') ) { 'paycvv' => $paycvv, 'paynum_ref' => \$paynum, 'discount_term' => $discount_term, + 'no_auto_apply' => ($cgi->param('apply') eq 'never') ? 'Y' : '', map { $_ => scalar($cgi->param($_)) } @{$payby2fields{$payby}} ); errorpage($error) if $error; @@ -238,7 +239,7 @@ if ( $cgi->param('batch') ) { } - $cust_main->apply_payments; + $cust_main->apply_payments if ($cgi->param('apply') eq 'yes'); }