1 <% include( '/elements/header.html', "Process $type{$payby} payment" ) %>
2 <% include( '/elements/small_custview.html', $cust_main, '', '', popurl(2) . "view/cust_main.cgi" ) %>
3 <FORM NAME="OneTrueForm" ACTION="process/payment.cgi" METHOD="POST" onSubmit="document.OneTrueForm.process.disabled=true">
4 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
5 <INPUT TYPE="hidden" NAME="payby" VALUE="<% $payby %>">
6 <INPUT TYPE="hidden" NAME="payunique" VALUE="<% $payunique %>">
7 <INPUT TYPE="hidden" NAME="balance" VALUE="<% $balance %>">
9 <% include('/elements/init_overlib.html') %>
11 % #include( '/elements/table.html', '#cccccc' )
13 <% ntable('#cccccc') %>
15 <TH ALIGN="right">Payment amount</TH>
17 <TABLE><TR><TD BGCOLOR="#ffffff">
18 $<INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<% $balance > 0 ? sprintf("%.2f", $balance) : '' %>">
23 % if ( $payby eq 'CARD' ) {
25 % my( $payinfo, $paycvv, $month, $year ) = ( '', '', '', '' );
26 % my $payname = $cust_main->first. ' '. $cust_main->getfield('last');
27 % if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
28 % $payinfo = $cust_main->paymask;
29 % $paycvv = $cust_main->paycvv;
30 % ( $month, $year ) = $cust_main->paydate_monthyear;
31 % $payname = $cust_main->payname if $cust_main->payname;
35 <TH ALIGN="right">Card number</TH>
40 <INPUT TYPE="text" NAME="payinfo" SIZE=20 MAXLENGTH=19 VALUE="<%$payinfo%>"> </TD>
44 % for ( ( map "0$_", 1 .. 9 ), 10 .. 12 ) {
46 <OPTION<% $_ == $month ? ' SELECTED' : '' %>><% $_ %>
54 % my @a = localtime; for ( $a[5]+1900 .. $a[5]+1915 ) {
56 <OPTION<% $_ == $year ? ' SELECTED' : '' %>><% $_ %>
66 <TH ALIGN="right">CVV2</TH>
67 <TD><INPUT TYPE="text" NAME="paycvv" VALUE="<% $paycvv %>" SIZE=4 MAXLENGTH=4>
68 (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/cvv2.html', 480, 352, 'cvv2_popup' ), CAPTION, 'CVV2 Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">help</A>)
72 <TH ALIGN="right">Exact name on card</TH>
73 <TD><INPUT TYPE="text" SIZE=32 MAXLENGTH=80 NAME="payname" VALUE="<%$payname%>"></TD>
76 <% include( '/elements/location.html',
77 'object' => $cust_main, #XXX errors???
79 'address1_label' => 'Card billing address',
83 % } elsif ( $payby eq 'CHEK' ) {
85 % my( $payinfo1, $payinfo2, $payname, $ss, $paytype, $paystate,
86 % $stateid, $stateid_state )
87 % = ( '', '', '', '', '', '', '', '' );
88 % if ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
89 % $cust_main->paymask =~ /^([\dx]+)\@([\dx]+)$/i
90 % or die "unparsable payinfo ". $cust_main->payinfo;
91 % ($payinfo1, $payinfo2) = ($1, $2);
92 % $payname = $cust_main->payname;
93 % $ss = $cust_main->ss;
94 % $paytype = $cust_main->getfield('paytype');
95 % $paystate = $cust_main->getfield('paystate');
96 % $stateid = $cust_main->getfield('stateid');
97 % $stateid_state = $cust_main->getfield('stateid_state');
100 <INPUT TYPE="hidden" NAME="month" VALUE="12">
101 <INPUT TYPE="hidden" NAME="year" VALUE="2037">
103 <TD ALIGN="right">Account number</TD>
104 <TD><INPUT TYPE="text" SIZE=10 NAME="payinfo1" VALUE="<%$payinfo1%>"></TD>
105 <TD ALIGN="right">Type</TD>
106 <TD><SELECT NAME="paytype"><% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } @FS::cust_main::paytypes) %></SELECT></TD>
109 <TD ALIGN="right">ABA/Routing number</TD>
111 <INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="payinfo2" VALUE="<%$payinfo2%>">
112 (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">help</A>)
116 <TD ALIGN="right">Bank name</TD>
117 <TD><INPUT TYPE="text" NAME="payname" VALUE="<%$payname%>"></TD>
120 % if ( $conf->exists('show_bankstate') ) {
122 <TD ALIGN="right">Bank state</TD>
123 <TD><% include('/elements/select-state.html',
124 'disable_empty' => 0,
125 'empty_label' => '(choose)',
126 'state' => $paystate,
127 'country' => $cust_main->country,
134 <INPUT TYPE="hidden" NAME="paystate" VALUE="<% $paystate %>">
137 % if ( $conf->exists('show_ss') ) {
140 Account holder<BR>
141 Social security or tax ID #
143 <TD><INPUT TYPE="text" NAME="ss" VALUE="<% $ss %>"></TD>
146 <INPUT TYPE="hidden" NAME="ss" VALUE="<% $ss %>"></TD>
149 % if ( $conf->exists('show_stateid') ) {
152 Account holder<BR>
153 Driver’s license or state ID #
155 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $stateid %>"></TD>
156 <TD ALIGN="right">State</TD>
157 <TD><% include('/elements/select-state.html',
158 'disable_empty' => 0,
159 'empty_label' => '(choose)',
160 'state' => $stateid_state,
161 'country' => $cust_main->country,
162 'prefix' => 'stateid_',
168 <INPUT TYPE="hidden" NAME="stateid" VALUE="<% $stateid %>">
169 <INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $stateid_state %>">
172 % } #end CARD/CHEK-specific section
177 <INPUT TYPE="checkbox" CHECKED NAME="save" VALUE="1">
178 Remember this information
182 % if ( $conf->exists("batch-enable")
183 % || grep $payby eq $_, $conf->config('batch-enable_payby')
186 % if ( grep $payby eq $_, $conf->config('realtime-disable_payby') ) {
188 <INPUT TYPE="hidden" NAME="batch" VALUE="1">
194 <INPUT TYPE="checkbox" NAME="batch" VALUE="1">
204 <INPUT TYPE="checkbox"<% ( ( $payby eq 'CARD' && $cust_main->payby ne 'DCRD' ) || ( $payby eq 'CHEK' && $cust_main->payby eq 'CHEK' ) ) ? ' CHECKED' : '' %> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }">
205 Charge future payments to this <% $type{$payby} %> automatically
212 <INPUT TYPE="submit" NAME="process" VALUE="Process payment">
215 <% include('/elements/footer.html') %>
219 unless $FS::CurrentUser::CurrentUser->access_right('Process payment');
221 my %type = ( 'CARD' => 'credit card',
222 'CHEK' => 'electronic check (ACH)',
225 $cgi->param('payby') =~ /^(CARD|CHEK)$/
226 or die "unknown payby ". $cgi->param('payby');
229 $cgi->param('custnum') =~ /^(\d+)$/
230 or die "illegal custnum ". $cgi->param('custnum');
233 my $cust_main = qsearchs( 'cust_main', { 'custnum'=>$custnum } );
234 die "unknown custnum $custnum" unless $cust_main;
236 my $balance = $cust_main->balance;
240 #false laziness w/selfservice make_payment.html shortcut for one-country
241 my $conf = new FS::Conf;
242 my %states = map { $_->state => 1 }
243 qsearch('cust_main_county', {
244 'country' => $conf->config('countrydefault') || 'US'
246 my @states = sort { $a cmp $b } keys %states;
248 my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32;