X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Fpayment.cgi;h=7911a5dd9073ec18e6ed13cd3b65cc60b74f0272;hp=de060b01045899653b8fe21ed3e8619626730252;hb=94b60bb13c044e436800239be3e3c5a029bdff8e;hpb=01c9143a54bf5e1513537547fd362822f58d1e2a diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index de060b010..7911a5dd9 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -13,8 +13,7 @@ <& /elements/tr-select-payment_options.html, - 'custnum' => $cust_main->custnum, - 'amount' => $balance, + 'cust_main' => $cust_main, 'process-pkgpart' => scalar($conf->config('manual_process-pkgpart', $cust_main->agentnum)), 'process-display' => scalar($conf->config('manual_process-display')), @@ -25,11 +24,12 @@ ? scalar($conf->config('credit-card-surcharge-percentage', $cust_main->agentnum)) : 0 ), - 'surcharge_flatfee:Q' => + 'surcharge_flatfee' => ( $payby eq 'CARD' ? scalar($conf->config('credit-card-surcharge-flatfee', $cust_main->agentnum)) : 0 ), + 'processing_fee' => scalar($conf->config('processing-fee', $cust_main->agentnum)), &> % if ( $conf->exists('part_pkg-term_discounts') ) { @@ -102,6 +102,11 @@ function change_batch_checkbox () { $('#cust_payby').slideUp(); } } + + function enableAmountField() { + document.getElementById('amount').disabled = false; + } + % #can't quite handle CARD/CHEK on the same page yet, but very close @@ -135,186 +140,58 @@ function change_batch_checkbox () { >
-% my $auto = 0; -% if ( $payby eq 'CARD' ) { -% -% my( $payinfo, $paycvv, $month, $year ) = ( '', '', '', '' ); -% my $payname = $cust_main->first. ' '. $cust_main->getfield('last'); -% my $location = $cust_main->bill_location; - - - - - - - - - - - - - - - <& /elements/location.html, - 'object' => $location, - 'no_asterisks' => 1, - 'address1_label' => emt('Card billing address'), - &> - -% } elsif ( $payby eq 'CHEK' ) { -% -% my( $account, $aba, $branch, $payname, $ss, $paytype, $paystate, -% $stateid, $stateid_state ) -% = ( '', '', '', '', '', '', '', '', '' ); -% -% #false laziness w/{edit,view}/cust_main/billing.html -% my $routing_label = $conf->config('echeck-country') eq 'US' -% ? 'ABA/Routing number' -% : 'Routing number'; -% my $routing_size = $conf->config('echeck-country') eq 'CA' ? 4 : 10; -% my $routing_maxlength = $conf->config('echeck-country') eq 'CA' ? 3 : 9; - - - - - - - - - - - - - -% if ( $conf->config('echeck-country') eq 'CA' ) { - - - - -% } - - - - - -% if ( $conf->exists('show_bankstate') ) { - - - - -% } else { - -% } - -% if ( $conf->exists('show_ss') ) { - - - - -% } else { - -% } - -% if ( $conf->exists('show_stateid') ) { - - - - - - -% } else { - - -% } - -% } #end CARD/CHEK-specific section - - - - - - - - - +<& /elements/cust_payby_new.html, + 'cust_payby' => \@cust_payby, + 'curr_value' => $custpaybynum, +&>
<% mt('Card number') |h %> - - - - - - - - -
- <% mt('Exp.') |h %> - - / - -
-
<% mt('CVV2') |h %> - (<% mt('help') |h %>) -
<% mt('Exact name on card') |h %>
<% mt('Account number') |h %><% mt('Type') |h %>
<% mt($routing_label) |h %> - - (<% mt('help') |h %>) -
<% mt('Branch number') |h %> - -
<% mt('Bank name') |h %>
<% mt('Bank state') |h %><& /elements/select-state.html, - 'disable_empty' => 0, - 'empty_label' => emt('(choose)'), - 'state' => $paystate, - 'country' => $cust_main->country, - 'prefix' => 'pay', - &> -
- <% mt('Account holder') |h %>
- <% mt('Social security or tax ID #') |h %> -
- <% mt('Account holder') |h %>
- <% mt("Driver's license or state ID #") |h %> -
<% mt('State') |h %><& /elements/select-state.html, - 'disable_empty' => 0, - 'empty_label' => emt('(choose)'), - 'state' => $stateid_state, - 'country' => $cust_main->country, - 'prefix' => 'stateid_', - &> -
- - <% mt('Remember this information') |h %> -
- NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }"> - <% mt("Charge future payments to this [_1] automatically",$type{$payby}) |h %> -% if ( @cust_payby ) { - <% mt('as') |h %> - -% } else { - -% } -

- + + + <& /elements/footer-cust_main.html &> <%once> @@ -342,6 +219,17 @@ $cgi->param('payby') =~ /^(CARD|CHEK)$/ or die "unknown payby ". $cgi->param('payby'); my $payby = $1; +my $validate_select_fields = "#payment_option, #invoice, #custpaybynum, "; +my $validate_input_fields = "#amount, input[name=payname], "; +if ($payby eq "CHEK") { + $validate_input_fields .= "input[name=payinfo1], input[name=payinfo2]"; + $validate_select_fields .= "select[name=paytype] "; +} +elsif ($payby eq "CARD") { + $validate_input_fields .= "input[name=payinfo], input[name=paycvv], input[name=address1], #city, #zip"; + $validate_select_fields .= "#state, #country "; +} + $cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum ". $cgi->param('custnum'); my $custnum = $1; @@ -355,13 +243,6 @@ my $payinfo = ''; my $conf = new FS::Conf; -#false laziness w/selfservice make_payment.html shortcut for one-country -my %states = map { $_->state => 1 } - qsearch('cust_main_county', { - 'country' => $conf->config('countrydefault') || 'US' - } ); -my @states = sort { $a cmp $b } keys %states; - my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32;