2 % if ( $payby eq 'CARD' ) {
4 % my( $payinfo, $paycvv, $month, $year ) = ( '', '', '', '' );
5 % my $payname = $cust_main->first. ' '. $cust_main->getfield('last');
6 % my $location = $cust_main->bill_location;
8 <TH ALIGN="right"><% mt('Card number') |h %></TH>
13 <INPUT TYPE="text" NAME="payinfo" SIZE=20 MAXLENGTH=19 VALUE="<%$payinfo%>"> </TD>
14 <TH><% mt('Exp.') |h %></TH>
17 % for my $mm ( map{ sprintf( '%02d', $_ ) } (1..12) ) {
18 <OPTION value="<% $mm %>"<% $mm == $month ? ' SELECTED' : '' %>><% $mm %></OPTION>
25 % my @a = localtime; for my $yyyy ( $a[5]+1900 .. $a[5]+1915 ) {
26 <OPTION value="<% $yyyy %>"<% $yyyy == $year ? ' SELECTED' : '' %>><% $yyyy %></OPTION>
35 <TH ALIGN="right"><% mt('CVV2') |h %></TH>
36 <TD><INPUT TYPE="text" NAME="paycvv" VALUE="<% $paycvv %>" SIZE=4 MAXLENGTH=4>
37 (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/cvv2.html', 480, 352, 'cvv2_popup' ), CAPTION, 'CVV2 Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;"><% mt('help') |h %></A>)
41 <TH ALIGN="right"><% mt('Exact name on card') |h %></TH>
42 <TD><INPUT TYPE="text" SIZE=32 MAXLENGTH=80 NAME="payname" VALUE="<%$payname%>"></TD>
45 <& /elements/location.html,
46 'object' => $location,
48 'address1_label' => emt('Card billing address'),
51 % } elsif ( $payby eq 'CHEK' ) {
53 % my( $account, $aba, $branch, $payname, $ss, $paytype, $paystate,
54 % $stateid, $stateid_state )
55 % = ( '', '', '', '', '', '', '', '', '' );
57 % #false laziness w/{edit,view}/cust_main/billing.html
58 % my $routing_label = $conf->config('echeck-country') eq 'US'
59 % ? 'ABA/Routing number'
61 % my $routing_size = $conf->config('echeck-country') eq 'CA' ? 4 : 10;
62 % my $routing_maxlength = $conf->config('echeck-country') eq 'CA' ? 3 : 9;
64 <INPUT TYPE="hidden" NAME="month" VALUE="12">
65 <INPUT TYPE="hidden" NAME="year" VALUE="2037">
67 <TD ALIGN="right"><% mt('Account number') |h %></TD>
68 <TD><INPUT TYPE="text" SIZE=10 NAME="payinfo1" VALUE="<%$account%>"></TD>
69 <TD ALIGN="right"><% mt('Type') |h %></TD>
70 <TD><SELECT NAME="paytype"><% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } FS::cust_payby->paytypes) %></SELECT></TD>
73 <TD ALIGN="right"><% mt($routing_label) |h %></TD>
75 <INPUT TYPE="text" SIZE="<% $routing_size %>" MAXLENGTH="<% $routing_maxlength %>" NAME="payinfo2" VALUE="<%$aba%>">
76 (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;"><% mt('help') |h %></A>)
79 % if ( $conf->config('echeck-country') eq 'CA' ) {
81 <TD ALIGN="right"><% mt('Branch number') |h %></TD>
83 <INPUT TYPE="text" NAME="payinfo3" VALUE="<%$branch%>" SIZE=6 MAXLENGTH=5>
88 <TD ALIGN="right"><% mt('Bank name') |h %></TD>
89 <TD><INPUT TYPE="text" NAME="payname" VALUE="<%$payname%>"></TD>
92 % if ( $conf->exists('show_bankstate') ) {
94 <TD ALIGN="right"><% mt('Bank state') |h %></TD>
95 <TD><& /elements/select-state.html,
97 'empty_label' => emt('(choose)'),
99 'country' => $cust_main->country,
105 <INPUT TYPE="hidden" NAME="paystate" VALUE="<% $paystate %>">
108 % if ( $conf->exists('show_ss') ) {
111 <% mt('Account holder') |h %><BR>
112 <% mt('Social security or tax ID #') |h %>
114 <TD><INPUT TYPE="text" NAME="ss" VALUE="<% $ss %>"></TD>
117 <INPUT TYPE="hidden" NAME="ss" VALUE="<% $ss %>"></TD>
120 % if ( $conf->exists('show_stateid') ) {
123 <% mt('Account holder') |h %><BR>
124 <% mt("Driver's license or state ID #") |h %>
126 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $stateid %>"></TD>
127 <TD ALIGN="right"><% mt('State') |h %></TD>
128 <TD><& /elements/select-state.html,
129 'disable_empty' => 0,
130 'empty_label' => emt('(choose)'),
131 'state' => $stateid_state,
132 'country' => $cust_main->country,
133 'prefix' => 'stateid_',
138 <INPUT TYPE="hidden" NAME="stateid" VALUE="<% $stateid %>">
139 <INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $stateid_state %>">
142 % } #end CARD/CHEK-specific section
147 <INPUT TYPE="checkbox" CHECKED NAME="save" VALUE="1">
148 <% mt('Remember this information') |h %>
154 <INPUT TYPE="checkbox"<% $auto ? ' CHECKED' : '' %> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }">
155 <% mt("Charge future payments to this [_1] automatically",$type{$payby}) |h %>
156 % if ( @cust_payby ) {
158 <SELECT NAME="weight">
159 % for ( 1 .. 1+scalar(grep { $_->payby =~ /^(CARD|CHEK)$/ } @cust_payby) ) {
160 <OPTION VALUE="<%$_%>"><% mt( $weight{$_} ) |h %></OPTION>
164 <INPUT TYPE="hidden" NAME="weight" VALUE="1">
187 my @cust_payby = @{$opt{cust_payby}};
189 my %type = ( 'CARD' => 'credit card',
190 'CHEK' => 'electronic check (ACH)',
193 $cgi->param('payby') =~ /^(CARD|CHEK)$/
194 or die "unknown payby ". $cgi->param('payby');
197 $cgi->param('custnum') =~ /^(\d+)$/
198 or die "illegal custnum ". $cgi->param('custnum');
201 my $cust_main = qsearchs( 'cust_main', { 'custnum'=>$custnum } );
202 die "unknown custnum $custnum" unless $cust_main;
204 my $balance = $cust_main->balance;
208 my $conf = new FS::Conf;
210 #false laziness w/selfservice make_payment.html shortcut for one-country
211 my %states = map { $_->state => 1 }
212 qsearch('cust_main_county', {
213 'country' => $conf->config('countrydefault') || 'US'
215 my @states = sort { $a cmp $b } keys %states;