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 %>">
8 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
9 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.js"></SCRIPT>
10 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_draggable.js"></SCRIPT>
11 <SCRIPT TYPE="text/javascript">
12 function OLiframeContent(src, width, height, name) {
13 return ('<iframe src="'+src+'" width="'+width+'" height="'+height+'"'
14 +(name?' name="'+name+'" id="'+name+'"':'')+' scrolling="auto">'
15 +'<div>[iframe not supported]</div></iframe>');
18 % #include( '/elements/table.html', '#cccccc' )
20 <% ntable('#cccccc') %>
22 <TD ALIGN="right">Payment amount</TD>
24 <TABLE><TR><TD BGCOLOR="#ffffff">
25 $<INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<% $balance > 0 ? sprintf("%.2f", $balance) : '' %>">
29 % if ( $payby eq 'CARD' ) {
30 % my( $payinfo, $paycvv, $month, $year ) = ( '', '', '', '' );
31 % my $payname = $cust_main->first. ' '. $cust_main->getfield('last');
32 % my $address1 = $cust_main->address1;
33 % my $address2 = $cust_main->address2;
34 % my $city = $cust_main->city;
35 % my $state = $cust_main->state;
36 % my $zip = $cust_main->zip;
37 % if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
38 % $payinfo = $cust_main->paymask;
39 % $paycvv = $cust_main->paycvv;
40 % ( $month, $year ) = $cust_main->paydate_monthyear;
41 % $payname = $cust_main->payname if $cust_main->payname;
46 <TD ALIGN="right">Card number</TD>
51 <INPUT TYPE="text" NAME="payinfo" SIZE=20 MAXLENGTH=19 VALUE="<%$payinfo%>"> </TD>
55 % for ( ( map "0$_", 1 .. 9 ), 10 .. 12 ) {
57 <OPTION<% $_ == $month ? ' SELECTED' : '' %>><% $_ %>
65 % my @a = localtime; for ( $a[5]+1900 .. $a[5]+1915 ) {
67 <OPTION<% $_ == $year ? ' SELECTED' : '' %>><% $_ %>
77 <TD ALIGN="right">CVV2</TD>
78 <TD><INPUT TYPE="text" NAME="paycvv" VALUE="<% $paycvv %>" SIZE=4 MAXLENGTH=4>
79 (<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>)
83 <TD ALIGN="right">Exact name on card</TD>
84 <TD><INPUT TYPE="text" SIZE=32 MAXLENGTH=80 NAME="payname" VALUE="<%$payname%>"></TD>
86 <TD ALIGN="right">Card billing address</TD>
88 <INPUT TYPE="text" SIZE=40 MAXLENGTH=80 NAME="address1" VALUE="<%$address1%>">
91 <TD ALIGN="right">Address line 2</TD>
93 <INPUT TYPE="text" SIZE=40 MAXLENGTH=80 NAME="address2" VALUE="<%$address2%>">
96 <TD ALIGN="right">City</TD>
101 <INPUT TYPE="text" NAME="city" SIZE="12" MAXLENGTH=80 VALUE="<%$city%>">
105 <SELECT NAME="state">
108 <OPTION<% $_ eq $state ? ' SELECTED' : '' %>><% $_ %>
115 <INPUT TYPE="text" NAME="zip" SIZE=11 MAXLENGTH=10 VALUE="<%$zip%>">
121 % } elsif ( $payby eq 'CHEK' ) {
122 % my( $payinfo1, $payinfo2, $payname, $ss, $paytype, $paystate,
123 % $stateid, $stateid_state )
124 % = ( '', '', '', '', '', '', '', '' );
125 % if ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
126 % $cust_main->paymask =~ /^([\dx]+)\@([\dx]+)$/i
127 % or die "unparsable payinfo ". $cust_main->payinfo;
128 % ($payinfo1, $payinfo2) = ($1, $2);
129 % $payname = $cust_main->payname;
130 % $ss = $cust_main->ss;
131 % $paytype = $cust_main->getfield('paytype');
132 % $paystate = $cust_main->getfield('paystate');
133 % $stateid = $cust_main->getfield('stateid');
134 % $stateid_state = $cust_main->getfield('stateid_state');
138 <INPUT TYPE="hidden" NAME="month" VALUE="12">
139 <INPUT TYPE="hidden" NAME="year" VALUE="2037">
141 <TD ALIGN="right">Account number</TD>
142 <TD><INPUT TYPE="text" SIZE=10 NAME="payinfo1" VALUE="<%$payinfo1%>"></TD>
143 <TD ALIGN="right">Type</TD>
144 <TD><SELECT NAME="paytype"><% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } @FS::cust_main::paytypes) %></SELECT></TD>
147 <TD ALIGN="right">ABA/Routing number</TD>
149 <INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="payinfo2" VALUE="<%$payinfo2%>">
150 (<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>)
154 <TD ALIGN="right">Bank name</TD>
155 <TD><INPUT TYPE="text" NAME="payname" VALUE="<%$payname%>"></TD>
158 <TD ALIGN="right">Bank state</TD>
159 <TD><% include('../edit/cust_main/select-state.html', #meh
160 'empty' => '(choose)',
161 'state' => $paystate,
162 'country' => $cust_main->country,
168 Account holder<BR>
169 Social security or tax ID #
171 <TD><INPUT TYPE="text" NAME="ss" VALUE="<%$ss%>"></TD>
175 Account holder<BR>
176 Driver’s license or state ID #
178 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<%$stateid%>"></TD>
179 <TD ALIGN="right">State</TD>
180 <TD><% include('../edit/cust_main/select-state.html', #meh
181 'empty' => '(choose)',
182 'state' => $stateid_state,
183 'country' => $cust_main->country,
184 'prefix' => 'stateid_',
192 <INPUT TYPE="checkbox" CHECKED NAME="save" VALUE="1">
193 Remember this information
196 % if ($conf->exists("batch-enable")) {
198 <INPUT TYPE="checkbox" <% ( $conf->exists("paymentforcedtobatch") && $payby eq 'CHEK' ) ? 'CHECKED DISABLED' : '' %> NAME="batch" VALUE="1">
200 % if ($conf->exists("paymentforcedtobatch") && $payby eq 'CHEK' ) {
201 <INPUT TYPE="hidden" NAME="batch" VALUE="1">
207 <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; }">
208 Charge future payments to this <% $type{$payby} %> automatically
213 <INPUT TYPE="submit" NAME="process" VALUE="Process payment">
216 <% include('/elements/footer.html') %>
219 my %type = ( 'CARD' => 'credit card',
220 'CHEK' => 'electronic check (ACH)',
223 $cgi->param('payby') =~ /^(CARD|CHEK)$/
224 or die "unknown payby ". $cgi->param('payby');
227 $cgi->param('custnum') =~ /^(\d+)$/
228 or die "illegal custnum ". $cgi->param('custnum');
231 my $cust_main = qsearchs( 'cust_main', { 'custnum'=>$custnum } );
232 die "unknown custnum $custnum" unless $cust_main;
234 my $balance = $cust_main->balance;
238 #false laziness w/selfservice make_payment.html shortcut for one-country
239 my $conf = new FS::Conf;
240 my %states = map { $_->state => 1 }
241 qsearch('cust_main_county', {
242 'country' => $conf->config('countrydefault') || 'US'
244 my @states = sort { $a cmp $b } keys %states;
246 my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32;