diff options
author | ivan <ivan> | 2003-01-17 06:22:04 +0000 |
---|---|---|
committer | ivan <ivan> | 2003-01-17 06:22:04 +0000 |
commit | 4fff62915dd62ed3711bc40cf15421f6b4b56b28 (patch) | |
tree | 168c3804e0ddee620612e6d8893e13d362a3c3a5 | |
parent | f948765436a567af2ca2f5b8c7f675a49cf63ef5 (diff) |
selfservice cancel functionality
-rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 20 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/SelfService.pm | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 674785524..9983b5d26 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; diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index 9019ea4f8..4d68d614a 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -22,6 +22,7 @@ $socket = "/usr/local/freeside/selfservice_socket"; 'login' => 'MyAccount/login', 'customer_info' => 'MyAccount/customer_info', 'invoice' => 'MyAccount/invoice', + 'cancel' => 'MyAccount/cancel', ); @EXPORT_OK = keys %autoload; |