[freeside-commits] freeside/fs_selfservice/FS-SelfService/cgi make_thirdparty_payment.html, 1.4, 1.4.4.1 post_thirdparty_payment.html, NONE, 1.1.2.2 selfservice.cgi, 1.46.2.6, 1.46.2.7
Mark Wells
mark at wavetail.420.am
Tue Dec 21 01:13:06 PST 2010
Update of /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi
In directory wavetail.420.am:/tmp/cvs-serv21004/fs_selfservice/FS-SelfService/cgi
Modified Files:
Tag: FREESIDE_2_1_BRANCH
make_thirdparty_payment.html selfservice.cgi
Added Files:
Tag: FREESIDE_2_1_BRANCH
post_thirdparty_payment.html
Log Message:
changes to support eWay third-party payment, #10208
--- NEW FILE: post_thirdparty_payment.html ---
<%= $url = "$selfurl?session=$session_id;action="; ''; %>
<%= include('header', 'Pay now') %>
<SCRIPT TYPE="text/javascript" SRC="overlibmws.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="overlibmws_iframe.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="overlibmws_draggable.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="overlibmws_crossframe.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="iframecontentmws.js"></SCRIPT>
<%= if ( $error ) {
$OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">$error</FONT><BR><BR>!;
}else{
$OUT .= <<EOF;
You are about to contact our payment processor to pay $amount.<BR><BR>
Your transaction reference number is $reference <BR><BR>
<FORM METHOD="POST" ACTION="$popup_url">
EOF
#<FORM NAME="collect_popper" method="post" action="javascript:void(0)" onSubmit="popcollect()">
my %itemhash = @collectitems;
# my $query = join(';',
# map { uri_escape($_) . '=' . uri_escape($itemhash{$_}) }
# keys(%itemhash)
# );
foreach my $input (keys(%itemhash)) {
$OUT .= qq!<INPUT NAME="$input" TYPE="hidden" VALUE="$itemhash{$input}">\n!;
}
$OUT .= qq!<INPUT NAME="submit" TYPE="submit" VALUE="Pay now"></FORM>!
}
%>
<%=
#<SCRIPT TYPE="text/javascript">
# function popcollect() {
# overlib( OLiframeContent('<%= $popup_url %>', 336, 550, 'Secure Payment Area', 0, 'auto' ), CAPTION, 'Pay now', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, BGCOLOR, '#333399', CGCOLOR, '#333399', CLOSETEXT, 'Close' );
# overlib( OLpostAJAX('<%= $popup_url %>',
# return false;
# }
#</SCRIPT>
%>
<%= include('footer') %>
Index: selfservice.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/selfservice.cgi,v
retrieving revision 1.46.2.6
retrieving revision 1.46.2.7
diff -u -w -d -r1.46.2.6 -r1.46.2.7
--- selfservice.cgi 21 Dec 2010 06:26:15 -0000 1.46.2.6
+++ selfservice.cgi 21 Dec 2010 09:13:04 -0000 1.46.2.7
@@ -16,13 +16,13 @@
part_svc_info provision_acct provision_external provision_phone
unprovision_svc change_pkg suspend_pkg domainselector
list_svcs list_svc_usage list_cdr_usage list_support_usage
- myaccount_passwd list_invoices create_ticket get_ticket did_report
+ myaccount_passwd list_invoices create_ticket get_ticket
mason_comp
);
$template_dir = '.';
-$DEBUG = 1;
+$DEBUG = 0;
$form_max = 255;
@@ -72,8 +72,51 @@
$session_id = $cgi->param('session');
#order|pw_list XXX ???
-$cgi->param('action') =~
- /^(myaccount|tktcreate|tktview|didreport|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_phone|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)$/
+my @actions = ( qw(
+ myaccount
+ tktcreate
+ tktview
+ didreport
+ invoices
+ view_invoice
+ make_payment
+ make_ach_payment
+ make_term_payment
+ make_thirdparty_payment
+ post_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_phone
+ 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
+));
+
+$cgi->param('action') =~ ( '^(' . join('|', @actions) . ')$' )
or die "unknown action ". $cgi->param('action');
my $action = $1;
@@ -83,9 +126,11 @@
my $result = eval "&$action();";
die $@ if $@;
-#fixed "Use of uninitialized value in string eq"; very annoying when developing
-if ( $result->{error} && ($result->{error} eq "Can't resume session"
- || $result->{error} eq "Expired session") ) {
+warn Dumper($result) if $DEBUG;
+
+if ( $result->{error} eq "Can't resume session"
+ || $result->{error} eq "Expired session" ) { #ick
+
my $login_info = login_info();
do_template('login', $login_info);
exit;
@@ -106,7 +151,9 @@
#--
use Data::Dumper;
-sub myaccount { my $result = customer_info( 'session_id' => $session_id ); warn Dumper($result); $result;}
+sub myaccount {
+ customer_info( 'session_id' => $session_id );
+}
sub change_bill { my $payment_info =
payment_info( 'session_id' => $session_id );
@@ -580,9 +627,22 @@
}
sub make_thirdparty_payment {
+ payment_info('session_id' => $session_id);
+}
+
+sub post_thirdparty_payment {
$cgi->param('payby_method') =~ /^(CC|ECHECK)$/
or die "illegal payby method";
- realtime_collect( 'session_id' => $session_id, 'method' => $1 );
+ my $method = $1;
+ $cgi->param('amount') =~ /^(\d+(\.\d*)?)$/
+ or die "illegal amount";
+ my $amount = $1;
+ my $result = realtime_collect(
+ 'session_id' => $session_id,
+ 'method' => $method,
+ 'amount' => $amount,
+ );
+ $result;
}
sub make_term_payment {
@@ -619,15 +679,6 @@
FS::SelfService::logout( 'session_id' => $session_id );
}
-sub didreport {
- my $result = did_report( 'session_id' => $session_id,
- 'format' => $cgi->param('type'),
- 'recentonly' => $cgi->param('recentonly'),
- );
- die $result->{'error'} if exists $result->{'error'} && $result->{'error'};
- $result;
-}
-
sub provision {
my $result = list_pkgs( 'session_id' => $session_id );
die $result->{'error'} if exists $result->{'error'} && $result->{'error'};
@@ -815,31 +866,12 @@
or die $Text::Template::ERROR;
#warn "filling in $template with $fill_in\n";
-
- if($result && ref($result) && $result->{'format'} && $result->{'content'}
- && $result->{'format'} eq 'csv') {
- print $cgi->header('-expires' => 'now',
- '-Content-Type' => 'text/csv',
- '-Content-Disposition' => "attachment;filename=output.csv",
- ),
- $result->{'content'};
- }
- elsif($result && ref($result) && $result->{'format'} && $result->{'content'}
- && $result->{'format'} eq 'xls') {
- print $cgi->header('-expires' => 'now',
- '-Content-Type' => 'application/vnd.ms-excel',
- '-Content-Disposition' => "attachment;filename=output.xls",
- '-Content-Length' => length($result->{'content'}),
- ),
- $result->{'content'};
- }
- else {
- print $cgi->header( '-expires' => 'now' ),
- $template->fill_in( PACKAGE => 'FS::SelfService::_selfservicecgi',
- HASH => $fill_in
- );
- }
-
+ my $data = $template->fill_in(
+ PACKAGE => 'FS::SelfService::_selfservicecgi',
+ HASH => $fill_in,
+ ) || "Error processing template $source"; # at least print _something_
+ print $cgi->header( '-expires' => 'now' );
+ print $data;
}
#*FS::SelfService::_selfservicecgi::include = \&Text::Template::fill_in_file;
Index: make_thirdparty_payment.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -u -w -d -r1.4 -r1.4.4.1
--- make_thirdparty_payment.html 21 Jan 2010 08:34:01 -0000 1.4
+++ make_thirdparty_payment.html 21 Dec 2010 09:13:03 -0000 1.4.4.1
@@ -1,35 +1,36 @@
-<%= $url = "$selfurl?session=$session_id;action="; ''; %>
-<%= include('header', 'Pay now') %>
+<%= $url = "$selfurl?session=$session_id;action=";
+ $cgi = new CGI;
+ ''; %>
+<%= include('header', 'Make a payment') %>
+
+<FORM NAME="OneTrueForm" METHOD="POST" ACTION="<%=$selfurl%>"
+onSubmit="document.OneTrueForm.process.disabled=true">
+<INPUT TYPE="hidden" NAME="session" VALUE="<%=$session_id%>">
+<INPUT TYPE="hidden" NAME="action" VALUE="post_thirdparty_payment">
+<INPUT TYPE="hidden" NAME="payby_method" VALUE="<%=
+$cgi->param('payby_method') =~ /(CC|ECHECK)/;
+$1 %>">
+<TABLE BGCOLOR="#cccccc">
+<TR>
+ <TH ALIGN="right">Balance due</TH>
+ <TD COLSPAN=7>
+ <SPAN STYLE="background-color: #ffffff;">$<%=sprintf("%.2f", $balance)%>
+ </TD>
+</TR>
+<TR>
+ <TH ALIGN="right">Payment amount</TH>
+ <TD COLSPAN=7>
+ $<INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<%=sprintf("%.2f", $balance)%>">
+ </TD>
+</TR>
+<TR><TH></TH>
+<TD><INPUT TYPE="submit" NAME="process" VALUE="Process payment">
+</FORM>
-<SCRIPT TYPE="text/javascript">
- function popcollect() {
- overlib( OLiframeContent('<%= $popup_url %>', 336, 550, 'Secure Payment Area', 0, 'auto' ), CAPTION, 'Pay now', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, BGCOLOR, '#333399', CGCOLOR, '#333399', CLOSETEXT, 'Close' );
- return false;
- }
-</SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="overlibmws.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="overlibmws_iframe.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="overlibmws_draggable.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="overlibmws_crossframe.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="iframecontentmws.js"></SCRIPT>
-<%= if ( $error ) {
- $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">$error</FONT><BR><BR>!;
-}else{
- $OUT .= <<EOF;
- You are about to contact our payment processor to pay $amount.<BR><BR>
- Your transaction reference number is $reference <BR><BR>
- <FORM NAME="collect_popper" method="post" action="javascript:void(0)" onSubmit="popcollect()">
-EOF
-
- my %itemhash = @collectitems;
- foreach my $input (keys %itemhash) {
- $OUT .= qq!<INPUT NAME="$input" TYPE="hidden" VALUE="$itemhash{$input}">!;
- }
-
- $OUT .= qq!<INPUT NAME="submit" type="submit" value="Pay now">!;
- $OUT .= qq!</FORM>!;
-}
-%>
-
<%= include('footer') %>
More information about the freeside-commits
mailing list