summaryrefslogtreecommitdiff
path: root/fs_selfservice
diff options
context:
space:
mode:
Diffstat (limited to 'fs_selfservice')
-rw-r--r--fs_selfservice/FS-SelfService/SelfService.pm190
-rw-r--r--fs_selfservice/FS-SelfService/cgi/history.html14
-rw-r--r--fs_selfservice/FS-SelfService/cgi/make_ach_payment.html10
-rw-r--r--fs_selfservice/FS-SelfService/cgi/make_payment.html9
-rwxr-xr-xfs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html11
-rw-r--r--fs_selfservice/FS-SelfService/cgi/myaccount_menu.html6
-rwxr-xr-xfs_selfservice/FS-SelfService/cgi/selfservice.cgi13
-rw-r--r--fs_selfservice/FS-SelfService/cgi/small_custview.html15
8 files changed, 246 insertions, 22 deletions
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm
index 21bc9205a..9764ad474 100644
--- a/fs_selfservice/FS-SelfService/SelfService.pm
+++ b/fs_selfservice/FS-SelfService/SelfService.pm
@@ -32,6 +32,13 @@ $socket .= '.'.$tag if defined $tag && length($tag);
'switch_acct' => 'MyAccount/switch_acct',
'customer_info' => 'MyAccount/customer_info',
'customer_info_short' => 'MyAccount/customer_info_short',
+
+ 'contact_passwd' => 'MyAccount/contact/contact_passwd',
+ 'list_contacts' => 'MyAccount/contact/list_contacts',
+ 'edit_contact' => 'MyAccount/contact/edit_contact',
+ 'delete_contact' => 'MyAccount/contact/delete_contact',
+ 'new_contact' => 'MyAccount/contact/new_contact',
+
'billing_history' => 'MyAccount/billing_history',
'edit_info' => 'MyAccount/edit_info', #add to ss cgi!
'invoice' => 'MyAccount/invoice',
@@ -507,7 +514,7 @@ Invoice text
=item list_invoices HASHREF
-Returns a list of all customer invoices. Takes a hash references with a single
+Returns a list of all customer invoices. Takes a hash reference with a single
key, session_id.
Returns a hash reference with the following keys:
@@ -1195,7 +1202,7 @@ error message on errors.
Provisions an account (svc_acct).
-Takes a hash references as parameter with the following keys:
+Takes a hash reference as parameter with the following keys:
=over 4
@@ -1223,7 +1230,7 @@ svcpart or service definition to provision
Provisions a phone number (svc_phone).
-Takes a hash references as parameter with the following keys:
+Takes a hash reference as parameter with the following keys:
=over 4
@@ -1265,7 +1272,7 @@ E911 Address (optional)
Provisions a customer PBX (svc_pbx).
-Takes a hash references as parameter with the following keys:
+Takes a hash reference as parameter with the following keys:
=over 4
@@ -1297,7 +1304,7 @@ svcpart or service definition to provision
Provisions an external service (svc_external).
-Takes a hash references as parameter with the following keys:
+Takes a hash reference as parameter with the following keys:
=over 4
@@ -1321,6 +1328,146 @@ svcpart or service definition to provision
=back
+=head2 "MY ACCOUNT" CONTACT FUNCTIONS
+
+=over 4
+
+=item contact_passwd
+
+Changes the password for the currently-logged in contact.
+
+Takes a hash reference as parameter with the following keys:
+
+=over 4
+
+=item session_id
+
+=item new_password
+
+=back
+
+Returns a hash reference with a single parameter, B<error>, which contains an
+error message, or empty on success.
+
+=item list_contacts
+
+Takes a hash reference as parameter with a single key, B<session_id>.
+
+Returns a hash reference with two parameters: B<error>, which contains an error
+message, or empty on success, and B<contacts>, a list of contacts.
+
+B<contacts> is an array reference of hash references (i.e. an array of structs,
+ in XML-RPC). Each hash reference (struct) has the following keys:
+
+=over4
+
+=item contactnum
+
+=item class
+
+Contact class name (contact type).
+
+=item first
+
+First name
+
+=item last
+
+Last name
+
+=item title
+
+Position ("Director of Silly Walks"), NOT honorific ("Mr." or "Mrs.")
+
+=item emailaddress
+
+Comma-separated list of email addresses
+
+=item comment
+
+=item selfservice_access
+
+Y when enabled
+
+=back
+
+=item edit_contact
+
+Updates information for the currently-logged in contact, or (optionally) the
+specified contact.
+
+Takes a hash reference as parameter with the following keys:
+
+=over 4
+
+=item session_id
+
+=item contactnum
+
+If already logged in as a contact, this is optional.
+
+=item first
+
+=item last
+
+=item emailaddress
+
+=back
+
+Returns a hash reference with a single parameter, B<error>, which contains an
+error message, or empty on success.
+
+=item new_contact
+
+Creates a new contact.
+
+Takes a hash reference as parameter with the following keys:
+
+=over 4
+
+=item session_id
+
+=item first
+
+=item last
+
+=item emailaddress
+
+=item classnum
+
+Optional contact classnum (TODO: or name)
+
+=item comment
+
+=item selfservice_access
+
+Y to enable self-service access
+
+=item _password
+
+=back
+
+Returns a hash reference with a single parameter, B<error>, which contains an
+error message, or empty on success.
+
+=item delete_contact
+
+Deletes a contact. (Note: Cannot at this time delete the currently-logged in
+contact.)
+
+Takes a hash reference as parameter with the following keys:
+
+=over 4
+
+=item session_id
+
+=item contactnum
+
+=back
+
+Returns a hash reference with a single parameter, B<error>, which contains an
+error message, or empty on success.
+
=head2 "MY ACCOUNT" QUOTATION FUNCTIONS
All of these functions require the user to be logged in, and the 'session_id'
@@ -1333,12 +1480,33 @@ key to be included in the argument hashref.`
Returns a hashref listing this customer's active self-service quotations.
Contents are:
-- 'quotations', an arrayref containing an element for each quotation.
- - quotationnum, the primary key
- - _date, the date it was started
- - num_pkgs, the number of packages
- - total_setup, the sum of setup fees
- - total_recur, the sum of recurring charges
+=over 4
+
+=item quotations
+
+an arrayref containing an element for each quotation.
+
+=item quotationnum
+
+the primary key
+
+=item _date
+
+the date it was started
+
+=item num_pkgs
+
+the number of packages
+
+=item total_setup
+
+the sum of setup fees
+
+=item total_recur
+
+the sum of recurring charges
+
+=back
=item quotation_new HASHREF
diff --git a/fs_selfservice/FS-SelfService/cgi/history.html b/fs_selfservice/FS-SelfService/cgi/history.html
new file mode 100644
index 000000000..0b6f9ceda
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/history.html
@@ -0,0 +1,14 @@
+<%= include('header', 'Payment History') %>
+
+<%=
+my $out = mason_comp(
+ 'session_id' => $session_id,
+ 'comp' => '/elements/customer-statement.html',
+ 'args' => [
+ 'history' => \@history,
+ ]
+);
+$out->{'output'} || $out->{'error'};
+%>
+
+<%= include('footer') %>
diff --git a/fs_selfservice/FS-SelfService/cgi/make_ach_payment.html b/fs_selfservice/FS-SelfService/cgi/make_ach_payment.html
index e33ad574c..8c2dfe305 100644
--- a/fs_selfservice/FS-SelfService/cgi/make_ach_payment.html
+++ b/fs_selfservice/FS-SelfService/cgi/make_ach_payment.html
@@ -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>
diff --git a/fs_selfservice/FS-SelfService/cgi/make_payment.html b/fs_selfservice/FS-SelfService/cgi/make_payment.html
index 5f5bc1c8e..503901edd 100644
--- a/fs_selfservice/FS-SelfService/cgi/make_payment.html
+++ b/fs_selfservice/FS-SelfService/cgi/make_payment.html
@@ -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 %>
diff --git a/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html b/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html
index 9a5678e8f..8c5b1a85a 100755
--- a/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html
+++ b/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html
@@ -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>
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
index 999c62da0..6af5e5ec0 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
@@ -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',
@@ -66,6 +66,10 @@ if ( ($balance || 0) > 0 ) { #XXXFIXME "enable selfservice prepay features" flag
push @menu,
{ title=>' ' };
+push @menu,
+ { title=>'View payment history', url=>'history', size=>'+1' },
+;
+
unless( $hide_usage ){
push @menu,
{ title=>'View my usage', url=>'view_usage', size=>'+1', }
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
index 1b728e2f9..4199f7005 100755
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -23,6 +23,7 @@ use FS::SelfService qw(
mason_comp port_graph
start_thirdparty finish_thirdparty
reset_passwd check_reset_passwd process_reset_passwd
+ billing_history
);
$template_dir = '.';
@@ -82,6 +83,7 @@ my @actions = ( qw(
process_change_password
customer_suspend_pkg
process_suspend_pkg
+ history
));
my @nologin_actions = (qw(
@@ -339,6 +341,10 @@ sub invoices {
list_invoices( 'session_id' => $session_id, );
}
+sub history {
+ billing_history( 'session_id' => $session_id, );
+}
+
sub tktcreate {
my $customer_info = customer_info( 'session_id' => $session_id );
return $customer_info if ( $customer_info->{'error'} );
@@ -563,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,
],
);
diff --git a/fs_selfservice/FS-SelfService/cgi/small_custview.html b/fs_selfservice/FS-SelfService/cgi/small_custview.html
index 308eae928..329f82e90 100644
--- a/fs_selfservice/FS-SelfService/cgi/small_custview.html
+++ b/fs_selfservice/FS-SelfService/cgi/small_custview.html
@@ -59,10 +59,17 @@ Customer #<B><%= $display_custnum %></B>
</TR></TABLE>
-<%= unless ( $access_pkgnum ) {
- $OUT .= '<BR>Balance: <B>$'. $balance. '</B><BR>';
- }
- '';
+<%=
+unless ( $access_pkgnum ) {
+ if ($balance >= 0) {
+ $OUT .= '<BR>Balance: <B>'. $balance_pretty . '</B><BR>';
+ } else {
+ my $credit_balance_pretty = $balance_pretty;
+ $credit_balance_pretty =~ s/-//;
+ $OUT .= '<BR>Credit Balance: <B>'. $credit_balance_pretty . '</B><BR>';
+ }
+}
+'';
%>
</DIV>