use HTML::Entities;
use Date::Format;
use Number::Format 1.50;
-use FS::SelfService qw( login customer_info edit_info invoice
- payment_info process_payment
+use FS::SelfService qw( login_info login customer_info edit_info invoice
+ payment_info process_payment realtime_collect
process_prepay
list_pkgs order_pkg signup_info order_recharge
part_svc_info provision_acct provision_external
$cgi = new CGI;
unless ( defined $cgi->param('session') ) {
- do_template('login',{});
+ my $login_info = login_info();
+
+ do_template('login', $login_info );
exit;
}
'password' => $password,
);
if ( $rv->{error} ) {
+ my $login_info = login_info();
do_template('login', {
'error' => $rv->{error},
'username' => $username,
'domain' => $domain,
+ %$login_info,
} );
exit;
} else {
#order|pw_list XXX ???
$cgi->param('action') =~
- /^(myaccount|view_invoice|make_payment|make_ach_payment|payment_results|ach_payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|change_pay|process_change_bill|process_change_ship|process_change_pay|customer_order_pkg|process_order_pkg|customer_change_pkg|process_change_pkg|process_order_recharge|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|view_usage|view_usage_details|view_support_details|change_password|process_change_password)$/
+ /^(myaccount|view_invoice|make_payment|make_ach_payment|make_thirdparty_payment|payment_results|ach_payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|change_pay|process_change_bill|process_change_ship|process_change_pay|customer_order_pkg|process_order_pkg|customer_change_pkg|process_change_pkg|process_order_recharge|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|view_usage|view_usage_details|view_support_details|change_password|process_change_password)$/
or die "unknown action ". $cgi->param('action');
my $action = $1;
if ( $result->{error} eq "Can't resume session"
|| $result->{error} eq "Expired session" ) { #ick
- do_template('login',{});
+ my $login_info = login_info();
+ do_template('login', $login_info);
exit;
}
do_template($action, {
'session_id' => $session_id,
'action' => $action, #so the menu knows what tab we're on...
+ %{ payment_info( 'session_id' => $session_id ) }, # cust_paybys for the menu
%{$result}
});
}
+sub make_thirdparty_payment {
+ $cgi->param('payby_method') =~ /^(CC|ECHECK)$/
+ or die "illegal payby method";
+ realtime_collect( 'session_id' => $session_id, 'method' => $1 );
+}
+
sub recharge_prepay {
customer_info( 'session_id' => $session_id );
}
$fill_in->{'selfurl'} = $cgi->self_url;
$fill_in->{'cgi'} = \$cgi;
- my $template = new Text::Template( TYPE => 'FILE',
- SOURCE => "$template_dir/$name.html",
+ my $source = "$template_dir/$name.html";
+ #warn "creating template for $source\n";
+ my $template = new Text::Template( TYPE => 'FILE',
+ SOURCE => $source,
DELIMITERS => [ '<%=', '%>' ],
- UNTAINT => 1, )
+ UNTAINT => 1,
+ )
or die $Text::Template::ERROR;
+ #warn "filling in $template with $fill_in\n";
print $cgi->header( '-expires' => 'now' ),
$template->fill_in( PACKAGE => 'FS::SelfService::_selfservicecgi',
HASH => $fill_in