summaryrefslogtreecommitdiff
path: root/FS/FS/ClientAPI/MyAccount.pm
diff options
context:
space:
mode:
authorivan <ivan>2003-01-17 06:22:04 +0000
committerivan <ivan>2003-01-17 06:22:04 +0000
commit4fff62915dd62ed3711bc40cf15421f6b4b56b28 (patch)
tree168c3804e0ddee620612e6d8893e13d362a3c3a5 /FS/FS/ClientAPI/MyAccount.pm
parentf948765436a567af2ca2f5b8c7f675a49cf63ef5 (diff)
selfservice cancel functionality
Diffstat (limited to 'FS/FS/ClientAPI/MyAccount.pm')
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 6747855..9983b5d 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -18,6 +18,7 @@ FS::ClientAPI->register_handlers(
'MyAccount/login' => \&login,
'MyAccount/customer_info' => \&customer_info,
'MyAccount/invoice' => \&invoice,
+ 'MyAccount/cancel' => \&cancel,
);
#store in db?
@@ -133,4 +134,23 @@ sub invoice {
}
+sub cancel {
+ my $p = shift;
+ my $session = $cache->get($p->{'session_id'})
+ or return { 'error' => "Can't resume session" }; #better error message
+
+ my $custnum = $session->{'custnum'};
+
+ my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
+ or return { 'error' => "unknown custnum $custnum" };
+
+ my @errors = $cust_main->cancel;
+
+ my $error = scalar(@errors) ? join(' / ', @errors) : '';
+
+ return { 'error' => $error };
+
+}
+
+1;