projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
improve echeck validation for canada, deprecate echeck-nonus and cust_main-require...
[freeside.git]
/
httemplate
/
misc
/
process
/
payment.cgi
diff --git
a/httemplate/misc/process/payment.cgi
b/httemplate/misc/process/payment.cgi
index
c1c9071
..
506e266
100644
(file)
--- a/
httemplate/misc/process/payment.cgi
+++ b/
httemplate/misc/process/payment.cgi
@@
-10,13
+10,18
@@
<% include('/elements/footer.html') %>
<% include('/elements/footer.html') %>
-% } else {
+% #2.5/2.7?# } elsif ( $curuser->access_right('View payments') ) {
+% } elsif ( $curuser->access_right(['View invoices', 'View payments']) ) {
<% $cgi->redirect(popurl(3). "view/cust_pay.html?paynum=$paynum" ) %>
<% $cgi->redirect(popurl(3). "view/cust_pay.html?paynum=$paynum" ) %>
+% } else {
+<% $cgi->redirect(popurl(3). "view/cust_main.html?custnum=$custnum" ) %>
% }
<%init>
% }
<%init>
-die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right('Process payment');
+my $curuser = $FS::CurrentUser::CurrentUser;
+die "access denied" unless $curuser->access_right('Process payment');
+
+my $conf = new FS::Conf;
#some false laziness w/MyAccount::process_payment
#some false laziness w/MyAccount::process_payment
@@
-76,11
+81,16
@@
if ( $payby eq 'CHEK' ) {
$payinfo = $cust_main->payinfo;
} else {
$cgi->param('payinfo1') =~ /^(\d+)$/
$payinfo = $cust_main->payinfo;
} else {
$cgi->param('payinfo1') =~ /^(\d+)$/
- or errorpage("
i
llegal account number ". $cgi->param('payinfo1'));
+ or errorpage("
I
llegal account number ". $cgi->param('payinfo1'));
my $payinfo1 = $1;
$cgi->param('payinfo2') =~ /^(\d+)$/
my $payinfo1 = $1;
$cgi->param('payinfo2') =~ /^(\d+)$/
- or errorpage("
i
llegal ABA/routing number ". $cgi->param('payinfo2'));
+ or errorpage("
I
llegal ABA/routing number ". $cgi->param('payinfo2'));
my $payinfo2 = $1;
my $payinfo2 = $1;
+ if ( $conf->config('echeck-country') eq 'CA' ) {
+ $cgi->param('payinfo3') =~ /^(\d{5})$/
+ or errorpage("Illegal branch number ". $cgi->param('payinfo2'));
+ $payinfo2 = "$1.$payinfo2";
+ }
$payinfo = $payinfo1. '@'. $payinfo2;
}
$payinfo = $payinfo1. '@'. $payinfo2;
}
@@
-91,7
+101,7
@@
if ( $payby eq 'CHEK' ) {
$payinfo = $cust_main->payinfo;
}
$payinfo =~ s/\D//g;
$payinfo = $cust_main->payinfo;
}
$payinfo =~ s/\D//g;
- $payinfo =~ /^(\d{13,16})$/
+ $payinfo =~ /^(\d{13,16}
|\d{8,9}
)$/
or errorpage(gettext('invalid_card')); # . ": ". $self->payinfo;
$payinfo = $1;
validate($payinfo)
or errorpage(gettext('invalid_card')); # . ": ". $self->payinfo;
$payinfo = $1;
validate($payinfo)
@@
-119,7
+129,7
@@
if ( $payby eq 'CHEK' ) {
die "unknown payby $payby";
}
die "unknown payby $payby";
}
-$cgi->param('discount_term') =~ /^
\d*
$/
+$cgi->param('discount_term') =~ /^
(\d*)
$/
or errorpage("illegal discount_term");
my $discount_term = $1;
or errorpage("illegal discount_term");
my $discount_term = $1;
@@
-193,7
+203,6
@@
if ( $cgi->param('save') ) {
#false laziness w/FS:;cust_main::realtime_bop - check both to make sure
# working correctly
#false laziness w/FS:;cust_main::realtime_bop - check both to make sure
# working correctly
- my $conf = new FS::Conf;
if ( $payby eq 'CARD' &&
grep { $_ eq cardtype($payinfo) } $conf->config('cvv-save') ) {
$new->set( 'paycvv' => $paycvv );
if ( $payby eq 'CARD' &&
grep { $_ eq cardtype($payinfo) } $conf->config('cvv-save') ) {
$new->set( 'paycvv' => $paycvv );