summaryrefslogtreecommitdiff
path: root/fs_selfservice
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-04-29 12:31:20 -0700
committerIvan Kohler <ivan@freeside.biz>2013-04-29 12:31:20 -0700
commit22336a0eeba10b4d1a4a78801f83f7cef56a1a20 (patch)
tree6d72adef0e02a6fbfbcba3969f2c24b6596d92e5 /fs_selfservice
parenta0b714142b349a36eee41a5de1e511758a382ffb (diff)
parent00755aee33cc3ecdf3634bcc0f50f54814bfc400 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'fs_selfservice')
-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/verify.cgi17
5 files changed, 40 insertions, 26 deletions
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/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