RT#24684: Payments for Online Bill Pay
authorJonathan Prykop <jonathan@freeside.biz>
Fri, 26 Jun 2015 06:08:34 +0000 (01:08 -0500)
committerJonathan Prykop <jonathan@freeside.biz>
Tue, 7 Jul 2015 03:40:30 +0000 (22:40 -0500)
FS/FS/ClientAPI/MyAccount.pm
FS/FS/Conf.pm
fs_selfservice/FS-SelfService/cgi/make_ach_payment.html
fs_selfservice/FS-SelfService/cgi/make_payment.html
fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html
fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
fs_selfservice/FS-SelfService/cgi/selfservice.cgi

index 804c851..c5418bc 100644 (file)
@@ -129,7 +129,7 @@ sub skin_info {
       ),
       'menu_disable' => [ $conf->config('selfservice-menu_disable',$agentnum) ],
       ( map { $_ => $conf->exists("selfservice-$_", $agentnum ) }
-        qw( menu_skipblanks menu_skipheadings menu_nounderline no_logo )
+        qw( menu_skipblanks menu_skipheadings menu_nounderline no_logo enable_payment_without_balance )
       ),
       ( map { $_ => scalar($conf->config_binary("selfservice-$_", $agentnum)) }
         qw( title_left_image title_right_image
index c5c0e46..c9cae93 100644 (file)
@@ -5872,6 +5872,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'selfservice-enable_payment_without_balance',
+    'section'     => 'self-service',
+    'description' => 'Allow selfservice customers to make payments even if balance is zero or below (resulting in an unapplied payment and negative balance.)',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'logout-timeout',
     'section'     => 'UI',
     'description' => 'If set, automatically log users out of the backoffice after this many minutes.',
index e33ad57..8c2dfe3 100644 (file)
@@ -3,19 +3,25 @@
 <FORM NAME="OneTrueForm" METHOD="POST" ACTION="<%=$selfurl%>" onSubmit="document.OneTrueForm.process.disabled=true">
 <INPUT TYPE="hidden" NAME="action" VALUE="ach_payment_results">
 <TABLE BGCOLOR="#cccccc">
+<%= 
+if ($balance > 0) {
+  $OUT .= <<EOF;
 <TR>
   <TD ALIGN="right">Amount&nbsp;Due</TD>
   <TD>
     <TABLE><TR><TD BGCOLOR="#ffffff">
-      $<%=sprintf("%.2f",$balance)%>
+      $money_char$balance
     </TD></TR></TABLE>
   </TD>
 </TR>
+EOF
+}
+%>
 <TR>
   <TD ALIGN="right">Payment&nbsp;amount</TD>
   <TD>
     <TABLE><TR><TD BGCOLOR="#ffffff">
-      $<INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<%=sprintf("%.2f",$balance)%>">
+      <%= $money_char %><INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<%= ($balance > 0) ? $balance : '' %>">
     </TD></TR></TABLE>
   </TD>
 </TR>
index 5f5bc1c..503901e 100644 (file)
@@ -3,14 +3,21 @@
 <FORM NAME="OneTrueForm" METHOD="POST" ACTION="<%=$selfurl%>" onSubmit="document.OneTrueForm.process.disabled=true">
 <INPUT TYPE="hidden" NAME="action" VALUE="payment_results">
 <TABLE BGCOLOR="#cccccc">
+
+<%= 
+if ($balance > 0) {
+  $OUT .= <<EOF;
 <TR>
   <TH ALIGN="right">Amount&nbsp;Due</TH>
   <TD COLSPAN=7>
     <TABLE><TR><TD BGCOLOR="#ffffff">
-      <FONT COLOR="#000000">$<%=sprintf("%.2f",$balance)%></FONT>
+      $money_char$balance
     </TD></TR></TABLE>
   </TD>
 </TR>
+EOF
+}
+%>
 
 <%= $tr_amount_fee %>
 
index 9a5678e..8c5b1a8 100755 (executable)
@@ -8,16 +8,23 @@ onSubmit="document.OneTrueForm.process.disabled=true">
 <INPUT TYPE="hidden" NAME="action" VALUE="post_thirdparty_payment">
 <INPUT TYPE="hidden" NAME="payby_method" VALUE="<%= $payby_method %>">
 <TABLE BGCOLOR="#cccccc">
+<%= 
+if ($balance > 0) {
+  $OUT .= <<EOF;
 <TR>
   <TH ALIGN="right">Balance&nbsp;due</TH>
   <TD COLSPAN=7>
-    <SPAN STYLE="background-color: #ffffff;">$<%=sprintf("%.2f", $balance)%>
+    <SPAN STYLE="background-color: #ffffff;">$money_char$balance</SPAN>
   </TD>
 </TR>
+EOF
+} 
+%>
+
 <TR>
   <TH ALIGN="right">Payment&nbsp;amount</TH>
   <TD COLSPAN=7>
-    $<INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<%=sprintf("%.2f", $balance)%>">
+    <%= $money_char %><INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<%= ($balance > 0) ? $balance : '' %>">
   </TD>
 </TR>
 <TR><TH></TH>
index 61926bd..6af5e5e 100644 (file)
@@ -28,7 +28,7 @@ my %payby_mode;
 # $payby_mode{FOO} is true if FOO is thirdparty, false if it's B::OP,
 # nonexistent if it's not supported
 
-if ( ($balance || 0) > 0 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eventually per-pkg or something really fancy
+if ( $enable_payment_without_balance || (($balance || 0) > 0) ) { #eventually per-pkg or something really fancy
 
   if ( exists( $payby_mode{CARD} ) ) {
     push @menu, { title  => 'Recharge my account with a credit card',
index 2a8b2b6..4199f70 100755 (executable)
@@ -569,10 +569,15 @@ sub make_payment {
 
   my $payment_info = payment_info( 'session_id' => $session_id );
 
+  my $amount = 
+    ($payment_info->{'balance'} && ($payment_info->{'balance'} > 0))
+    ? $payment_info->{'balance'}
+    : '';
+
   my $tr_amount_fee = mason_comp(
     'session_id' => $session_id,
     'comp'       => '/elements/tr-amount_fee.html',
-    'args'       => [ 'amount' => $payment_info->{'balance'},
+    'args'       => [ 'amount' => $amount,
                     ],
   );