summaryrefslogtreecommitdiff
path: root/fs_selfservice
diff options
context:
space:
mode:
Diffstat (limited to 'fs_selfservice')
-rw-r--r--fs_selfservice/FS-SelfService/SelfService.pm3
-rwxr-xr-xfs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html2
-rw-r--r--fs_selfservice/FS-SelfService/cgi/myaccount.html7
-rw-r--r--fs_selfservice/FS-SelfService/cgi/myaccount_menu.html35
-rwxr-xr-xfs_selfservice/FS-SelfService/cgi/selfservice.cgi5
-rwxr-xr-xfs_selfservice/FS-SelfService/cgi/signup.cgi6
-rwxr-xr-xfs_selfservice/FS-SelfService/cgi/signup.html18
-rw-r--r--fs_selfservice/FS-SelfService/cgi/small_custview.html8
-rwxr-xr-xfs_selfservice/FS-SelfService/cgi/verify.cgi17
9 files changed, 62 insertions, 39 deletions
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm
index 651a8f5cf..d44f978a5 100644
--- a/fs_selfservice/FS-SelfService/SelfService.pm
+++ b/fs_selfservice/FS-SelfService/SelfService.pm
@@ -1799,8 +1799,9 @@ sub domainselector {
'<INPUT TYPE="hidden" NAME="domsvc" VALUE="'. $key. '"></TD></TR>'
}
- my $text .= qq!<TR><TD ALIGN="right">Domain</TD><TD><SELECT NAME="domsvc" SIZE=1 STYLE="width: 20em"><OPTION>(Choose Domain)!;
+ my $text .= qq!<TR><TD ALIGN="right">Domain</TD><TD><SELECT NAME="domsvc" SIZE=1 STYLE="width: 20em">!;
+ $text .= '<OPTION>(Choose Domain)' unless $domsvc;
foreach my $domain ( sort { $domains->{$a} cmp $domains->{$b} } keys %$domains ) {
$text .= qq!<OPTION VALUE="!. $domain. '"'.
diff --git a/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html b/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html
index b5b9eea1f..59ee93b00 100755
--- a/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html
+++ b/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html
@@ -8,7 +8,7 @@ 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)/;
+$cgi->param('payby_method') =~ /(CC|ECHECK|PAYPAL)/;
$1 %>">
<TABLE BGCOLOR="#cccccc">
<TR>
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount.html b/fs_selfservice/FS-SelfService/cgi/myaccount.html
index 9ab262261..a6352e07a 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount.html
@@ -6,18 +6,13 @@ Hello <%= $name %>!<BR><BR>
<%= include('small_custview') %>
<BR>
-<%= unless ( $access_pkgnum ) {
- $OUT .= qq!Balance: <B>\$$balance</B><BR><BR>!;
- }
- '';
-%>
<%=
$OUT .= qq! <B><A HREF="${url}invoices">View All Invoices</A></B> &nbsp; &nbsp; !;
%>
<%= if ( $balance > 0 ) {
- if (scalar(grep $_, @hide_payment_fields)) {
+ if (scalar(grep $_, @hide_payment_fields)) { # this sucks
$OUT .= qq! <B><A HREF="${url}make_thirdparty_payment&payby_method=CC">Make a payment</A></B><BR><BR>!;
} else {
$OUT .= qq! <B><A HREF="${url}make_payment">Make a payment</A></B><BR>!;
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
index 4a31b1258..cf719e849 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
@@ -23,37 +23,44 @@ unless ( $access_pkgnum ) {
url=>'customer_order_pkg', 'indent'=>2 };
}
+my %payby_mode;
+@payby_mode{@cust_paybys} = @hide_payment_fields;
+# $payby_mode{FOO} is true if FOO is thirdparty, false if it's B::OP,
+# nonexistent if it's not supported
+
if ( $balance > 0 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eventually per-pkg or something really fancy
- #XXXFIXME still a bit sloppy for multi-gateway of differing namespace
- my $i = 0;
- while($i < scalar(@cust_paybys)) { last if $cust_paybys[$i] =~ /^CARD/; $i++ }
- if ( $cust_paybys[$i] && $cust_paybys[$i] =~ /^CARD/ ) {
+ if ( exists( $payby_mode{CARD} ) ) {
push @menu, { title => 'Recharge my account with a credit card',
- url => $hide_payment_fields[$i]
+ url => $payby_mode{CARD}
? 'make_thirdparty_payment&payby_method=CC'
: 'make_payment',
indent => 2,
}
}
- $i = 0;
- while($i < scalar(@cust_paybys)) { last if $cust_paybys[$i] =~ /^CHEK/; $i++ }
- if ( $cust_paybys[$i] && $cust_paybys[$i] =~ /^CHEK/ ) {
+ if ( exists( $payby_mode{CHEK} ) ) {
push @menu, { title => 'Recharge my account with a check',
- url => $hide_payment_fields[$i]
+ url => $payby_mode{CHEK}
? 'make_thirdparty_payment&payby_method=ECHECK'
: 'make_ach_payment',
indent => 2,
}
}
- push @menu, { title => 'Recharge my account with a prepaid card',
- url => 'recharge_prepay',
- indent => 2,
- }
- if grep(/^PREP/, @cust_paybys);
+ if ( exists( $payby_mode{PREP} ) ) {
+ push @menu, { title => 'Recharge my account with a prepaid card',
+ url => 'recharge_prepay',
+ indent => 2,
+ }
+ }
+ if ( exists( $payby_mode{PPAL} ) ) {
+ push @menu, { title => 'Recharge my account with PayPal',
+ url => 'make_thirdparty_payment&payby_method=PAYPAL',
+ indent => 2,
+ }
+ }
}
push @menu,
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
index f7fe308cf..40fe98af2 100755
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -667,12 +667,15 @@ sub make_thirdparty_payment {
}
sub post_thirdparty_payment {
- $cgi->param('payby_method') =~ /^(CC|ECHECK)$/
+ $cgi->param('payby_method') =~ /^(CC|ECHECK|PAYPAL)$/
or die "illegal payby method";
my $method = $1;
$cgi->param('amount') =~ /^(\d+(\.\d*)?)$/
or die "illegal amount";
my $amount = $1;
+ # realtime_collect() returns the result from FS::cust_main->realtime_collect
+ # which returns realtime_bop()
+ # which returns a hashref of popup_url, collectitems, and reference
my $result = realtime_collect(
'session_id' => $session_id,
'method' => $method,
diff --git a/fs_selfservice/FS-SelfService/cgi/signup.cgi b/fs_selfservice/FS-SelfService/cgi/signup.cgi
index 23d814e16..88eab5cce 100755
--- a/fs_selfservice/FS-SelfService/cgi/signup.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/signup.cgi
@@ -231,7 +231,7 @@ if ( $magic eq 'process' || $action eq 'process_signup' ) {
invoicing_list referral_custnum promo_code reg_code
override_ban_warn
pkgpart refnum agentnum
- username sec_phrase _password popnum
+ username sec_phrase _password popnum domsvc
mac_addr
countrycode phonenum sip_password pin prepaid_shortform
),
@@ -500,5 +500,7 @@ END
package FS::SelfService::_signupcgi;
use HTML::Entities;
-use FS::SelfService qw(regionselector expselect popselector didselector);
+use FS::SelfService qw( regionselector expselect popselector domainselector
+ didselector
+ );
diff --git a/fs_selfservice/FS-SelfService/cgi/signup.html b/fs_selfservice/FS-SelfService/cgi/signup.html
index 6427e6fa0..a9b67592b 100755
--- a/fs_selfservice/FS-SelfService/cgi/signup.html
+++ b/fs_selfservice/FS-SelfService/cgi/signup.html
@@ -33,7 +33,7 @@
<FONT SIZE="+1" COLOR="#ff0000"><%= encode_entities($error) %></FONT>
<FORM NAME="OneTrueForm" ACTION="<%= $self_url %>" METHOD=POST onSubmit="document.OneTrueForm.signup.disabled=true">
-<INPUT TYPE="hidden" NAME="prepaid_shortform" VALUE="<%= $prepaid_shortform %>">
+<INPUT TYPE="hidden" NAME="prepaid_shortform" VALUE="<%= encode_entities($prepaid_shortform) %>">
<INPUT TYPE="hidden" NAME="session" VALUE="<%= $session_id %>">
<INPUT TYPE="hidden" NAME="action" VALUE="process_signup">
<INPUT TYPE="hidden" NAME="agentnum" VALUE="<%= $agentnum %>">
@@ -45,7 +45,7 @@
%>
<%=
- $OUT = join("\n", map { qq|<input type="hidden" name="$_" />| } qw / promo_code reg_code pkgpart username _password _password2 sec_phrase popnum mac_addr countrycode phonenum sip_password pin / );
+ $OUT = join("\n", map { qq|<input type="hidden" name="$_" />| } qw / promo_code reg_code pkgpart username _password _password2 sec_phrase popnum domsvc mac_addr countrycode phonenum sip_password pin / );
%>
<%=
@@ -214,10 +214,10 @@ else {
my( $account, $aba ) = split('@', $payinfo);
my %paybychecked = (
- 'CARD' => '<TABLE BGCOLOR="'. ( $box_bgcolor || '#c0c0c0' ). qq!" BORDER=0 CELLSPACING=0 WIDTH="100%"><TR><TD ALIGN="right"><font color="#ff0000">*</font> Card type</TD><TD>$cardselect</TD></TR><TR><TD ALIGN="right"><font color="#ff0000">*</font> Card number</TD><TD><INPUT TYPE="text" NAME="CARD_payinfo" VALUE="$payinfo" MAXLENGTH=19></TD></TR><TR><TD ALIGN="right"><font color="#ff0000">*</font> Expration</TD><TD>!. expselect("CARD", $paydate). qq!</TD></TR><TR><TD ALIGN="right"><font color="#ff0000">*</font> Name on card</TD><TD><INPUT TYPE="text" NAME="CARD_payname" VALUE="$payname"></TD></TR>!,
+ 'CARD' => '<TABLE BGCOLOR="'. ( $box_bgcolor || '#c0c0c0' ). qq!" BORDER=0 CELLSPACING=0 WIDTH="100%"><TR><TD ALIGN="right"><font color="#ff0000">*</font> Card type</TD><TD>$cardselect</TD></TR><TR><TD ALIGN="right"><font color="#ff0000">*</font> Card number</TD><TD><INPUT TYPE="text" NAME="CARD_payinfo" VALUE="$payinfo" MAXLENGTH=19></TD></TR><TR><TD ALIGN="right"><font color="#ff0000">*</font> Expiration</TD><TD>!. expselect("CARD", $paydate). qq!</TD></TR><TR><TD ALIGN="right"><font color="#ff0000">*</font> Name on card</TD><TD><INPUT TYPE="text" NAME="CARD_payname" VALUE="$payname"></TD></TR>!,
'DCRD' => qq!Credit card<BR><font color="#ff0000">*</font>$cardselect<INPUT TYPE="text" NAME="DCRD_payinfo" VALUE="$payinfo" MAXLENGTH=19><BR><font color="#ff0000">*</font>Exp !. expselect("DCRD", $paydate). qq!<BR><font color="#ff0000">*</font>Name on card<BR><INPUT TYPE="text" NAME="DCRD_payname" VALUE="$payname">!,
- 'CHEK' => qq!Electronic check<BR>${r}Account number <INPUT TYPE="text" NAME="CHEK_payinfo1" VALUE="$account" MAXLENGTH=10> Type <SELECT NAME="CHEK_paytype">!. join('', map {qq!<OPTION VALUE="$_"!.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>"} @paytypes). qq!</SELECT><BR>${r}ABA/Routing code <INPUT TYPE="text" NAME="CHEK_payinfo2" VALUE="$aba" SIZE=10 MAXLENGTH=9><INPUT TYPE="hidden" NAME="CHEK_month" VALUE="12"><INPUT TYPE="hidden" NAME="CHEK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="CHEK_payname" VALUE="$payname">!,
- 'DCHK' => qq!Electronic check<BR>${r}Account number <INPUT TYPE="text" NAME="DCHK_payinfo1" VALUE="$account" MAXLENGTH=10> Type <SELECT NAME="DCHK_paytype">!. join('', map {qq!<OPTION VALUE="$_"!.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>"} @paytypes). qq!</SELECT><BR>${r}ABA/Routing code <INPUT TYPE="text" NAME="DCHK_payinfo2" VALUE="$aba" SIZE=10 MAXLENGTH=9><INPUT TYPE="hidden" NAME="DCHK_month" VALUE="12"><INPUT TYPE="hidden" NAME="DCHK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="DCHK_payname" VALUE="">!,
+ 'CHEK' => qq!Electronic check<BR>${r}Account number <INPUT TYPE="text" NAME="CHEK_payinfo1" VALUE="$account" MAXLENGTH=10> Type <SELECT NAME="CHEK_paytype">!. join('', map {qq!<OPTION VALUE="$_"!.($paytype eq $_ ? ' SELECTED' : '').">$_</OPTION>"} @paytypes). qq!</SELECT><BR>${r}ABA/Routing code <INPUT TYPE="text" NAME="CHEK_payinfo2" VALUE="$aba" SIZE=10 MAXLENGTH=9><INPUT TYPE="hidden" NAME="CHEK_month" VALUE="12"><INPUT TYPE="hidden" NAME="CHEK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="CHEK_payname" VALUE="$payname">!,
+ 'DCHK' => qq!Electronic check<BR>${r}Account number <INPUT TYPE="text" NAME="DCHK_payinfo1" VALUE="$account" MAXLENGTH=10> Type <SELECT NAME="DCHK_paytype">!. join('', map {qq!<OPTION VALUE="$_"!.($paytype eq $_ ? ' SELECTED' : '').">$_</OPTION>"} @paytypes). qq!</SELECT><BR>${r}ABA/Routing code <INPUT TYPE="text" NAME="DCHK_payinfo2" VALUE="$aba" SIZE=10 MAXLENGTH=9><INPUT TYPE="hidden" NAME="DCHK_month" VALUE="12"><INPUT TYPE="hidden" NAME="DCHK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="DCHK_payname" VALUE="">!,
'LECB' => qq!Phone bill billing<BR>${r}Phone number <INPUT TYPE="text" BANE="LECB_payinfo" VALUE="$payinfo" MAXLENGTH=15 SIZE=16><INPUT TYPE="hidden" NAME="LECB_month" VALUE="12"><INPUT TYPE="hidden" NAME="LECB_year" VALUE="2037"><INPUT TYPE="hidden" NAME="LECB_payname" VALUE="">!,
'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE="$payinfo"><BR><INPUT TYPE="hidden" NAME="BILL_month" VALUE="12"><INPUT TYPE="hidden" NAME="BILL_year" VALUE="2037">Attention<INPUT TYPE="text" NAME="BILL_payname" VALUE="$payname">!,
'COMP' => qq!Complimentary<BR><font color="#ff0000">*</font>Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE="$payinfo"><BR><font color="#ff0000">*</font>Exp !. expselect("COMP", $paydate),
@@ -319,6 +319,12 @@ ENDOUT
<TD ALIGN="right">Username</TD>
<TD><INPUT TYPE="text" NAME="username" VALUE="$username"></TD>
</TR>
+ENDOUT
+
+ $OUT .= domainselector( svcpart=>$default_svcpart, domsvc=>$default_domsvc )
+ if $default_svcpart;
+
+ $OUT .= <<ENDOUT;
<TR>
<TD ALIGN="right">Password</TD>
<TD><INPUT TYPE="password" NAME="_password" VALUE="$_password"></TD>
@@ -439,7 +445,7 @@ function fixup_form() {
var signup_elements = new Array (
'promo_code', 'reg_code', 'pkgpart',
- 'username', '_password', '_password2', 'sec_phrase', 'popnum',
+ 'username', '_password', '_password2', 'sec_phrase', 'popnum', 'domsvc',
'mac_addr',
'countrycode', 'phonenum', 'sip_password', 'pin'
);
diff --git a/fs_selfservice/FS-SelfService/cgi/small_custview.html b/fs_selfservice/FS-SelfService/cgi/small_custview.html
index 8d6e07368..470fe7151 100644
--- a/fs_selfservice/FS-SelfService/cgi/small_custview.html
+++ b/fs_selfservice/FS-SelfService/cgi/small_custview.html
@@ -10,10 +10,10 @@ Customer #<B><%= $custnum %></B>
? '<I><FONT SIZE="-1">Billing Address</FONT></I><BR>'
: ''
%>
- <%= $first %> <%= $last %><BR>
- <%= $company ? $company.'<BR>' : '' %>
- <%= $address1 %><BR>
- <%= $address2 ? $address2.'<BR>' : '' %>
+ <%= encode_entities($first) %> <%= encode_entities($last) %><BR>
+ <%= $company ? encode_entities($company).'<BR>' : '' %>
+ <%= encode_entities($address1) %><BR>
+ <%= $address2 ? encode_entities($address2).'<BR>' : '' %>
<%= $city %>, <%= $state %> <%= $zip %><BR>
<%= $country && $country ne ($countrydefault||'US')
? $country.'<BR>'
diff --git a/fs_selfservice/FS-SelfService/cgi/verify.cgi b/fs_selfservice/FS-SelfService/cgi/verify.cgi
index d9346b897..ff209d2f9 100755
--- a/fs_selfservice/FS-SelfService/cgi/verify.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/verify.cgi
@@ -87,11 +87,14 @@ my $rv = capture_payment(
map { $_ => scalar($cgi->param($_)) } $cgi->param
},
url => $cgi->self_url,
+ cancel => ($cgi->param('cancel') ? 1 : 0),
);
$error = $rv->{error};
-
-if ( $error eq '_decline' ) {
+
+if ( $error eq '_cancel' ) {
+ print_okay(%$rv);
+} elsif ( $error eq '_decline' ) {
print_decline();
} elsif ( $error ) {
print_verify();
@@ -133,8 +136,14 @@ sub print_okay {
$success_url .= '/signup.cgi?action=success';
}
- print $cgi->header( '-expires' => 'now' ),
- $success_template->fill_in( HASH => { success_url => $success_url } );
+ if ( $param{error} eq '_cancel' ) {
+ # then the payment was canceled, so don't show a message, just redirect
+ # (during signup, you really need a separate landing page for this case)
+ print $cgi->redirect($success_url);
+ } else {
+ print $cgi->header( '-expires' => 'now' ),
+ $success_template->fill_in( HASH => { success_url => $success_url } );
+ }
}
sub success_default { #html to use if you don't specify a success file