From: ivan Date: Tue, 17 Mar 2009 21:38:39 +0000 (+0000) Subject: add payment_info_renew_info method to ClientAPI/MyAccount and SG-equivalent previous_... X-Git-Tag: root_of_svc_elec_features~1362 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=c72e127acc79a61703223e6c8b504abd234ca8b3 add payment_info_renew_info method to ClientAPI/MyAccount and SG-equivalent previous_payment_info_renew_info to ClientAPI/SGNG --- diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index c6a4e0058..564acb1a6 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -1162,11 +1162,14 @@ sub renew_info { $total += $_->part_pkg->base_recur; my $renew_date = $_->part_pkg->add_freq($_->bill); { - 'bill_date' => $_->bill, - 'bill_date_pretty' => time2str('%x', $_->bill), - 'renew_date' => $renew_date, - 'renew_date_pretty' => time2str('%x', $renew_date), - 'amount' => sprintf('%.2f', $total), + 'pkgnum' => $_->pkgnum, + 'amount' => sprintf('%.2f', $total), + 'bill_date' => $_->bill, + 'bill_date_pretty' => time2str('%x', $_->bill), + 'renew_date' => $renew_date, + 'renew_date_pretty' => time2str('%x', $renew_date), + 'expire_date' => $_->expire, + 'expire_date_pretty' => time2str('%x', $_->expire), }; } @cust_pkg; @@ -1175,6 +1178,15 @@ sub renew_info { } +sub payment_info_renew_info { + my $p = shift; + my $renew_info = renew_info($p); + my $payment_info = payment_info($p); + return { %$renew_info, + %$payment_info, + }; +} + sub order_renew { my $p = shift; diff --git a/FS/FS/ClientAPI/SGNG.pm b/FS/FS/ClientAPI/SGNG.pm index 6f74e23a0..872148abd 100644 --- a/FS/FS/ClientAPI/SGNG.pm +++ b/FS/FS/ClientAPI/SGNG.pm @@ -7,6 +7,7 @@ use vars qw( $cache $DEBUG ); use Time::Local qw(timelocal timelocal_nocheck); use Business::CreditCard; use FS::Record qw( qsearch qsearchs ); +use FS::Conf; use FS::cust_main; use FS::cust_pkg; use FS::ClientAPI::MyAccount; #qw( payment_info process_payment ) @@ -158,6 +159,10 @@ sub _cust_main_payment_info { #find old cust_main records (with payments) sub _previous_cust_main { + + #safety check! return nothing unless we're enabled explicitly + return () unless FS::Conf->new->exists('sg-multicustomer_hack'); + my %opt = @_; my $custnum = $opt{'custnum'}; my $username = $opt{'username'}; @@ -225,6 +230,15 @@ sub previous_process_payment { } +sub previous_payment_info_renew_info { + my $p = shift; + my $renew_info = renew_info($p); + my $payment_info = previous_payment_info($p); + return { %$renew_info, + %$payment_info, + }; +} + sub previous_process_payment_order_pkg { my $p = shift; diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index fda3e8596..b4b9ecf29 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -944,6 +944,20 @@ Specified as a integer UNIX timestamp. Renewal date as a human-readable string. (Convenience for display; subject to change, so best not to parse for the date.) +=item pkgnum + +Package that will be renewed. + +=item expire_date + +Expiration date of the package that will be renewed. + +=item expire_date_pretty + +Expiration date of the package that will be renewed, as a human-readable +string. (Convenience for display; subject to change, so best not to parse for +the date.) + =back =item order_renew