2 % my %type = ( 'CARD' => 'credit card',
3 % 'CHEK' => 'electronic check (ACH)',
6 % $cgi->param('payby') =~ /^(CARD|CHEK)$/
7 % or die "unknown payby ". $cgi->param('payby');
10 % $cgi->param('custnum') =~ /^(\d+)$/
11 % or die "illegal custnum ". $cgi->param('custnum');
14 % my $cust_main = qsearchs( 'cust_main', { 'custnum'=>$custnum } );
15 % die "unknown custnum $custnum" unless $cust_main;
17 % my $balance = $cust_main->balance;
21 % #false laziness w/selfservice make_payment.html shortcut for one-country
22 % my $conf = new FS::Conf;
23 % my %states = map { $_->state => 1 }
24 % qsearch('cust_main_county', {
25 % 'country' => $conf->config('countrydefault') || 'US'
27 % my @states = sort { $a cmp $b } keys %states;
29 % my $paybatch = "webui-payment-". time. "-$$-". rand() * 2**32;
33 <% include( '/elements/header.html', "Process $type{$payby} payment" ) %>
34 <% include( '/elements/small_custview.html', $cust_main, '', '', popurl(2) . "view/cust_main.cgi" ) %>
35 <FORM NAME="OneTrueForm" ACTION="process/payment.cgi" METHOD="POST" onSubmit="document.OneTrueForm.process.disabled=true">
36 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
37 <INPUT TYPE="hidden" NAME="payby" VALUE="<% $payby %>">
38 <INPUT TYPE="hidden" NAME="paybatch" VALUE="<% $paybatch %>">
40 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
41 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.js"></SCRIPT>
42 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_draggable.js"></SCRIPT>
43 <SCRIPT TYPE="text/javascript">
44 function OLiframeContent(src, width, height, name) {
45 return ('<iframe src="'+src+'" width="'+width+'" height="'+height+'"'
46 +(name?' name="'+name+'" id="'+name+'"':'')+' scrolling="auto">'
47 +'<div>[iframe not supported]</div></iframe>');
50 % #include( '/elements/table.html', '#cccccc' )
52 <% ntable('#cccccc') %>
54 <TD ALIGN="right">Payment amount</TD>
56 <TABLE><TR><TD BGCOLOR="#ffffff">
57 $<INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<% $balance > 0 ? sprintf("%.2f", $balance) : '' %>">
61 % if ( $payby eq 'CARD' ) {
62 % my( $payinfo, $paycvv, $month, $year ) = ( '', '', '', '' );
63 % my $payname = $cust_main->first. ' '. $cust_main->getfield('last');
64 % my $address1 = $cust_main->address1;
65 % my $address2 = $cust_main->address2;
66 % my $city = $cust_main->city;
67 % my $state = $cust_main->state;
68 % my $zip = $cust_main->zip;
69 % if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
70 % $payinfo = $cust_main->paymask;
71 % $paycvv = $cust_main->paycvv;
72 % ( $month, $year ) = $cust_main->paydate_monthyear;
73 % $payname = $cust_main->payname if $cust_main->payname;
78 <TD ALIGN="right">Card number</TD>
83 <INPUT TYPE="text" NAME="payinfo" SIZE=20 MAXLENGTH=19 VALUE="<%$payinfo%>"> </TD>
87 % for ( ( map "0$_", 1 .. 9 ), 10 .. 12 ) {
89 <OPTION<% $_ == $month ? ' SELECTED' : '' %>><% $_ %>
97 % my @a = localtime; for ( $a[5]+1900 .. $a[5]+1915 ) {
99 <OPTION<% $_ == $year ? ' SELECTED' : '' %>><% $_ %>
109 <TD ALIGN="right">CVV2</TD>
110 <TD><INPUT TYPE="text" NAME="paycvv" VALUE="<% $paycvv %>" SIZE=4 MAXLENGTH=4>
111 (<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>)
115 <TD ALIGN="right">Exact name on card</TD>
116 <TD><INPUT TYPE="text" SIZE=32 MAXLENGTH=80 NAME="payname" VALUE="<%$payname%>"></TD>
118 <TD ALIGN="right">Card billing address</TD>
120 <INPUT TYPE="text" SIZE=40 MAXLENGTH=80 NAME="address1" VALUE="<%$address1%>">
123 <TD ALIGN="right">Address line 2</TD>
125 <INPUT TYPE="text" SIZE=40 MAXLENGTH=80 NAME="address2" VALUE="<%$address2%>">
128 <TD ALIGN="right">City</TD>
133 <INPUT TYPE="text" NAME="city" SIZE="12" MAXLENGTH=80 VALUE="<%$city%>">
137 <SELECT NAME="state">
140 <OPTION<% $_ eq $state ? ' SELECTED' : '' %>><% $_ %>
147 <INPUT TYPE="text" NAME="zip" SIZE=11 MAXLENGTH=10 VALUE="<%$zip%>">
153 % } elsif ( $payby eq 'CHEK' ) {
154 % my( $payinfo1, $payinfo2, $payname, $ss, $paytype, $paystate,
155 % $stateid, $stateid_state )
156 % = ( '', '', '', '', '', '', '', '' );
157 % if ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
158 % $cust_main->paymask =~ /^([\dx]+)\@([\dx]+)$/i
159 % or die "unparsable payinfo ". $cust_main->payinfo;
160 % ($payinfo1, $payinfo2) = ($1, $2);
161 % $payname = $cust_main->payname;
162 % $ss = $cust_main->ss;
163 % $paytype = $cust_main->getfield('paytype');
164 % $paystate = $cust_main->getfield('paystate');
165 % $stateid = $cust_main->getfield('stateid');
166 % $stateid_state = $cust_main->getfield('stateid_state');
170 <INPUT TYPE="hidden" NAME="month" VALUE="12">
171 <INPUT TYPE="hidden" NAME="year" VALUE="2037">
173 <TD ALIGN="right">Account number</TD>
174 <TD><INPUT TYPE="text" SIZE=10 NAME="payinfo1" VALUE="<%$payinfo1%>"></TD>
175 <TD ALIGN="right">Type</TD>
176 <TD><SELECT NAME="paytype"><% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } @FS::cust_main::paytypes) %></SELECT></TD>
179 <TD ALIGN="right">ABA/Routing number</TD>
181 <INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="payinfo2" VALUE="<%$payinfo2%>">
182 (<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>)
186 <TD ALIGN="right">Bank name</TD>
187 <TD><INPUT TYPE="text" NAME="payname" VALUE="<%$payname%>"></TD>
190 <TD ALIGN="right">Bank state</TD>
191 <TD><% include('../edit/cust_main/select-state.html', #meh
192 'empty' => '(choose)',
193 'state' => $paystate,
194 'country' => $cust_main->country,
200 Account holder<BR>
201 Social security or tax ID #
203 <TD><INPUT TYPE="text" NAME="ss" VALUE="<%$ss%>"></TD>
207 Account holder<BR>
208 Driver’s license or state ID #
210 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<%$stateid%>"></TD>
211 <TD ALIGN="right">State</TD>
212 <TD><% include('../edit/cust_main/select-state.html', #meh
213 'empty' => '(choose)',
214 'state' => $stateid_state,
215 'country' => $cust_main->country,
216 'prefix' => 'stateid_',
224 <INPUT TYPE="checkbox" CHECKED NAME="save" VALUE="1">
225 Remember this information
228 % if ($conf->exists("batch-enable")) {
230 <INPUT TYPE="checkbox" <% ( $conf->exists("paymentforcedtobatch") && $payby eq 'CHEK' ) ? 'CHECKED DISABLED' : '' %> NAME="batch" VALUE="1">
232 % if ($conf->exists("paymentforcedtobatch") && $payby eq 'CHEK' ) {
233 <INPUT TYPE="hidden" NAME="batch" VALUE="1">
239 <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; }">
240 Charge future payments to this <% $type{$payby} %> automatically
245 <INPUT TYPE="submit" NAME="process" VALUE="Process payment">
248 <% include('/elements/footer.html') %>