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 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
10 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.js"></SCRIPT>
11 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_draggable.js"></SCRIPT>
12 <SCRIPT TYPE="text/javascript">
13 function OLiframeContent(src, width, height, name) {
14 return ('<iframe src="'+src+'" width="'+width+'" height="'+height+'"'
15 +(name?' name="'+name+'" id="'+name+'"':'')+' scrolling="auto">'
16 +'<div>[iframe not supported]</div></iframe>');
19 % #include( '/elements/table.html', '#cccccc' )
21 <% ntable('#cccccc') %>
23 <TD ALIGN="right">Payment amount</TD>
25 <TABLE><TR><TD BGCOLOR="#ffffff">
26 $<INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<% $balance > 0 ? sprintf("%.2f", $balance) : '' %>">
30 % if ( $payby eq 'CARD' ) {
31 % my( $payinfo, $paycvv, $month, $year ) = ( '', '', '', '' );
32 % my $payname = $cust_main->first. ' '. $cust_main->getfield('last');
33 % my $address1 = $cust_main->address1;
34 % my $address2 = $cust_main->address2;
35 % my $city = $cust_main->city;
36 % my $state = $cust_main->state;
37 % my $zip = $cust_main->zip;
38 % if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
39 % $payinfo = $cust_main->paymask;
40 % $paycvv = $cust_main->paycvv;
41 % ( $month, $year ) = $cust_main->paydate_monthyear;
42 % $payname = $cust_main->payname if $cust_main->payname;
47 <TD ALIGN="right">Card number</TD>
52 <INPUT TYPE="text" NAME="payinfo" SIZE=20 MAXLENGTH=19 VALUE="<%$payinfo%>"> </TD>
56 % for ( ( map "0$_", 1 .. 9 ), 10 .. 12 ) {
58 <OPTION<% $_ == $month ? ' SELECTED' : '' %>><% $_ %>
66 % my @a = localtime; for ( $a[5]+1900 .. $a[5]+1915 ) {
68 <OPTION<% $_ == $year ? ' SELECTED' : '' %>><% $_ %>
78 <TD ALIGN="right">CVV2</TD>
79 <TD><INPUT TYPE="text" NAME="paycvv" VALUE="<% $paycvv %>" SIZE=4 MAXLENGTH=4>
80 (<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>)
84 <TD ALIGN="right">Exact name on card</TD>
85 <TD><INPUT TYPE="text" SIZE=32 MAXLENGTH=80 NAME="payname" VALUE="<%$payname%>"></TD>
87 <TD ALIGN="right">Card billing address</TD>
89 <INPUT TYPE="text" SIZE=40 MAXLENGTH=80 NAME="address1" VALUE="<%$address1%>">
92 <TD ALIGN="right">Address line 2</TD>
94 <INPUT TYPE="text" SIZE=40 MAXLENGTH=80 NAME="address2" VALUE="<%$address2%>">
97 <TD ALIGN="right">City</TD>
102 <INPUT TYPE="text" NAME="city" SIZE="12" MAXLENGTH=80 VALUE="<%$city%>">
106 <SELECT NAME="state">
109 <OPTION<% $_ eq $state ? ' SELECTED' : '' %>><% $_ %>
116 <INPUT TYPE="text" NAME="zip" SIZE=11 MAXLENGTH=10 VALUE="<%$zip%>">
122 % } elsif ( $payby eq 'CHEK' ) {
123 % my( $payinfo1, $payinfo2, $payname, $ss, $paytype, $paystate,
124 % $stateid, $stateid_state )
125 % = ( '', '', '', '', '', '', '', '' );
126 % if ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
127 % $cust_main->paymask =~ /^([\dx]+)\@([\dx]+)$/i
128 % or die "unparsable payinfo ". $cust_main->payinfo;
129 % ($payinfo1, $payinfo2) = ($1, $2);
130 % $payname = $cust_main->payname;
131 % $ss = $cust_main->ss;
132 % $paytype = $cust_main->getfield('paytype');
133 % $paystate = $cust_main->getfield('paystate');
134 % $stateid = $cust_main->getfield('stateid');
135 % $stateid_state = $cust_main->getfield('stateid_state');
139 <INPUT TYPE="hidden" NAME="month" VALUE="12">
140 <INPUT TYPE="hidden" NAME="year" VALUE="2037">
142 <TD ALIGN="right">Account number</TD>
143 <TD><INPUT TYPE="text" SIZE=10 NAME="payinfo1" VALUE="<%$payinfo1%>"></TD>
144 <TD ALIGN="right">Type</TD>
145 <TD><SELECT NAME="paytype"><% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } @FS::cust_main::paytypes) %></SELECT></TD>
148 <TD ALIGN="right">ABA/Routing number</TD>
150 <INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="payinfo2" VALUE="<%$payinfo2%>">
151 (<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>)
155 <TD ALIGN="right">Bank name</TD>
156 <TD><INPUT TYPE="text" NAME="payname" VALUE="<%$payname%>"></TD>
159 <TD ALIGN="right">Bank state</TD>
160 <TD><% include('../edit/cust_main/select-state.html', #meh
161 'empty' => '(choose)',
162 'state' => $paystate,
163 'country' => $cust_main->country,
169 Account holder<BR>
170 Social security or tax ID #
172 <TD><INPUT TYPE="text" NAME="ss" VALUE="<%$ss%>"></TD>
176 Account holder<BR>
177 Driver’s license or state ID #
179 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<%$stateid%>"></TD>
180 <TD ALIGN="right">State</TD>
181 <TD><% include('../edit/cust_main/select-state.html', #meh
182 'empty' => '(choose)',
183 'state' => $stateid_state,
184 'country' => $cust_main->country,
185 'prefix' => 'stateid_',
193 <INPUT TYPE="checkbox" CHECKED NAME="save" VALUE="1">
194 Remember this information
197 % if ($conf->exists("batch-enable")) {
199 <INPUT TYPE="checkbox" <% ( $conf->exists("paymentforcedtobatch") && $payby eq 'CHEK' ) ? 'CHECKED DISABLED' : '' %> NAME="batch" VALUE="1">
201 % if ($conf->exists("paymentforcedtobatch") && $payby eq 'CHEK' ) {
202 <INPUT TYPE="hidden" NAME="batch" VALUE="1">
208 <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; }">
209 Charge future payments to this <% $type{$payby} %> automatically
214 <INPUT TYPE="submit" NAME="process" VALUE="Process payment">
217 <% include('/elements/footer.html') %>
221 unless $FS::CurrentUser::CurrentUser->access_right('Process payment');
223 my %type = ( 'CARD' => 'credit card',
224 'CHEK' => 'electronic check (ACH)',
227 $cgi->param('payby') =~ /^(CARD|CHEK)$/
228 or die "unknown payby ". $cgi->param('payby');
231 $cgi->param('custnum') =~ /^(\d+)$/
232 or die "illegal custnum ". $cgi->param('custnum');
235 my $cust_main = qsearchs( 'cust_main', { 'custnum'=>$custnum } );
236 die "unknown custnum $custnum" unless $cust_main;
238 my $balance = $cust_main->balance;
242 #false laziness w/selfservice make_payment.html shortcut for one-country
243 my $conf = new FS::Conf;
244 my %states = map { $_->state => 1 }
245 qsearch('cust_main_county', {
246 'country' => $conf->config('countrydefault') || 'US'
248 my @states = sort { $a cmp $b } keys %states;
250 my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32;