diff options
author | ivan <ivan> | 2009-03-17 21:38:44 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-03-17 21:38:44 +0000 |
commit | 9a2b408b4f827d387d185ab028def0d864f34ba0 (patch) | |
tree | 07c0bdd09256adca208b6731d9e7b38da9a98e89 | |
parent | 9789cacc27bad4395fb0c567d96e034e7aace996 (diff) |
add payment_info_renew_info method to ClientAPI/MyAccount and SG-equivalent previous_payment_info_renew_info to ClientAPI/SGNG
-rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 22 | ||||
-rw-r--r-- | FS/FS/ClientAPI/SGNG.pm | 14 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/SelfService.pm | 14 |
3 files changed, 45 insertions, 5 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 7d9dec15d..0c11c8f7e 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -1036,11 +1036,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; @@ -1049,6 +1052,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 cf5f745a3..f10cfd3d2 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -872,6 +872,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 |