X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=fs_selfservice%2FFS-SelfService%2Fcgi%2Fselfservice.cgi;h=0ef4e9aad4101fae47af0e3ea919fd07c655e9c3;hb=aaace663fe7ff34479a707f3976c32010e4a1845;hp=2252852d964d07953956ac36a5bb55ad0d182d77;hpb=624b2d44625f69d71175c3348cae635d580c890b;p=freeside.git diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi index 2252852d9..0ef4e9aad 100644 --- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi +++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi @@ -14,9 +14,9 @@ use FS::SelfService qw( payment_info process_payment realtime_collect process_prepay list_pkgs order_pkg signup_info order_recharge part_svc_info provision_acct provision_external - unprovision_svc change_pkg domainselector + unprovision_svc change_pkg suspend_pkg domainselector list_svcs list_svc_usage list_cdr_usage list_support_usage - myaccount_passwd + myaccount_passwd list_invoices create_ticket mason_comp ); @@ -73,7 +73,7 @@ $session_id = $cgi->param('session'); #order|pw_list XXX ??? $cgi->param('action') =~ - /^(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_cdr_details|view_support_details|change_password|process_change_password)$/ + /^(myaccount|tktcreate|invoices|view_invoice|make_payment|make_ach_payment|make_term_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_cdr_details|view_support_details|change_password|process_change_password|customer_suspend_pkg|process_suspend_pkg)$/ or die "unknown action ". $cgi->param('action'); my $action = $1; @@ -105,7 +105,8 @@ do_template($action, { #-- -sub myaccount { customer_info( 'session_id' => $session_id ); } +use Data::Dumper; +sub myaccount { my $result = customer_info( 'session_id' => $session_id ); warn Dumper($result); $result;} sub change_bill { my $payment_info = payment_info( 'session_id' => $session_id ); @@ -198,6 +199,31 @@ sub view_invoice { } +sub invoices { + list_invoices( 'session_id' => $session_id, ); +} + +sub tktcreate { + my $customer_info = customer_info( 'session_id' => $session_id ); + return $customer_info if ( $customer_info->{'error'} ); + + my $requestor = ""; + if ( $customer_info->{'invoicing_list'} ) { + my @requestor = split( /\s*\,\s*/, $customer_info->{'invoicing_list'} ); + $requestor = $requestor[0] if scalar(@requestor); + } + + return { 'requestor' => $requestor } + unless ($cgi->param('subject') && $cgi->param('message') && + length($cgi->param('subject')) && length($cgi->param('message'))); + + create_ticket( 'session_id' => $session_id, + 'subject' => $cgi->param('subject'), + 'message' => $cgi->param('message'), + 'requestor' => $requestor, + ); +} + sub customer_order_pkg { my $init_data = signup_info( 'customer_session_id' => $session_id ); return $init_data if ( $init_data->{'error'} ); @@ -328,6 +354,24 @@ sub process_change_pkg { } +sub process_suspend_pkg { + my $results = ''; + $results = suspend_pkg ( + 'session_id' => $session_id, + map { $_ => $cgi->param($_) } + qw( pkgnum ) + ); + if ( $results->{'error'} ) { + $action = 'provision'; + return { + 'error' => ''. $results->{'error'}. '', + } + } + else { + return $results; + } +} + sub process_order_recharge { my $results = ''; @@ -427,6 +471,10 @@ sub payment_results { $cgi->param('paybatch') =~ /^([\w\-\.]+)$/ or die "illegal paybatch"; my $paybatch = $1; + $cgi->param('discount_term') =~ /^(\d*)$/ or die "illegal discount_term"; + my $discount_term = $1; + + process_payment( 'session_id' => $session_id, 'payby' => 'CARD', @@ -445,6 +493,7 @@ sub payment_results { 'save' => $save, 'auto' => $auto, 'paybatch' => $paybatch, + 'discount_term' => $discount_term, ); } @@ -529,6 +578,20 @@ sub make_thirdparty_payment { realtime_collect( 'session_id' => $session_id, 'method' => $1 ); } +sub make_term_payment { + $cgi->param('amount') =~ /^(\d+\.\d{2})$/ + or die "illegal payment amount"; + my $balance = $1; + $cgi->param('discount_term') =~ /^(\d+)$/ + or die "illegal discount term"; + my $discount_term = $1; + $action = 'make_payment'; + ({ %{payment_info( 'session_id' => $session_id )}, + 'balance' => $balance, + 'discount_term' => $discount_term, + }) +} + sub recharge_prepay { customer_info( 'session_id' => $session_id ); } @@ -552,6 +615,8 @@ sub logout { sub provision { my $result = list_pkgs( 'session_id' => $session_id ); die $result->{'error'} if exists $result->{'error'} && $result->{'error'}; + $result->{'pkgpart'} = $cgi->param('pkgpart') if $cgi->param('pkgpart'); + $result->{'filter'} = $cgi->param('filter') if $cgi->param('filter'); $result; }