From: Ivan Kohler Date: Wed, 6 Apr 2016 00:54:06 +0000 (-0700) Subject: add date to cancel_pkg self-service API, RT#41645 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=326a2afa1d56f7931cb577e892a1332ed7f3312d add date to cancel_pkg self-service API, RT#41645 --- diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 336482123..ddd4367b7 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -2606,19 +2606,18 @@ sub cancel_pkg { 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 $pkgnum = $p->{'pkgnum'}; - my $cust_pkg = qsearchs('cust_pkg', { 'custnum' => $custnum, 'pkgnum' => $pkgnum, } ) or return { 'error' => "unknown pkgnum $pkgnum" }; - my $error = $cust_pkg->cancel('quiet' => 1); + my $error = $cust_pkg->cancel( 'quiet' => 1, + 'date' => $p->{'date'}, + ); return { 'error' => $error }; - } sub provision_phone { diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index f7d72dc58..8d9982618 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -1128,7 +1128,7 @@ following keys: =item bill_date (Future) Bill date. Indicates a future date for which billing could be run. -Specified as a integer UNIX timestamp. Pass this value to the B +Specified as an integer UNIX timestamp. Pass this value to the B function. =item bill_date_pretty @@ -1144,7 +1144,7 @@ Base amount which will be charged if renewed early as of this date. Renewal date; i.e. even-futher future date at which the customer will be paid through if the early renewal is completed with the given B. -Specified as a integer UNIX timestamp. +Specified as an integer UNIX timestamp. =item renew_date_pretty @@ -1205,6 +1205,11 @@ Session identifier pkgpart of package to cancel +=item date + +Optional date, for future cancellation (expiration) instead of immediate +cancellation. Specified as an integer UNIX timestamp ("epoch time"). + =back Returns a hash reference with a single key, B, empty on success, or an