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;
9 <TH ALIGN="right"><% mt('Card number') |h %></TH>
14 <INPUT TYPE="text" NAME="payinfo" SIZE=20 MAXLENGTH=19 VALUE="<%$payinfo%>"> </TD>
15 <TH><% mt('Exp.') |h %></TH>
18 % for ( ( map "0$_", 1 .. 9 ), 10 .. 12 ) {
20 <OPTION<% $_ == $month ? ' SELECTED' : '' %>><% $_ %>
28 % my @a = localtime; for ( $a[5]+1900 .. $a[5]+1915 ) {
30 <OPTION<% $_ == $year ? ' SELECTED' : '' %>><% $_ %>
40 <TH ALIGN="right"><% mt('CVV2') |h %></TH>
41 <TD><INPUT TYPE="text" NAME="paycvv" VALUE="<% $paycvv %>" SIZE=4 MAXLENGTH=4>
42 (<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>)
46 <TH ALIGN="right"><% mt('Exact name on card') |h %></TH>
47 <TD><INPUT TYPE="text" SIZE=32 MAXLENGTH=80 NAME="payname" VALUE="<%$payname%>"></TD>
50 <& /elements/location.html,
51 'object' => $location,
53 'address1_label' => emt('Card billing address'),
56 % } elsif ( $payby eq 'CHEK' ) {
58 % my( $account, $aba, $branch, $payname, $ss, $paytype, $paystate,
59 % $stateid, $stateid_state )
60 % = ( '', '', '', '', '', '', '', '', '' );
62 % #false laziness w/{edit,view}/cust_main/billing.html
63 % my $routing_label = $conf->config('echeck-country') eq 'US'
64 % ? 'ABA/Routing number'
66 % my $routing_size = $conf->config('echeck-country') eq 'CA' ? 4 : 10;
67 % my $routing_maxlength = $conf->config('echeck-country') eq 'CA' ? 3 : 9;
69 <INPUT TYPE="hidden" NAME="month" VALUE="12">
70 <INPUT TYPE="hidden" NAME="year" VALUE="2037">
72 <TD ALIGN="right"><% mt('Account number') |h %></TD>
73 <TD><INPUT TYPE="text" SIZE=10 NAME="payinfo1" VALUE="<%$account%>"></TD>
74 <TD ALIGN="right"><% mt('Type') |h %></TD>
75 <TD><SELECT NAME="paytype"><% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } FS::cust_payby->paytypes) %></SELECT></TD>
78 <TD ALIGN="right"><% mt($routing_label) |h %></TD>
80 <INPUT TYPE="text" SIZE="<% $routing_size %>" MAXLENGTH="<% $routing_maxlength %>" NAME="payinfo2" VALUE="<%$aba%>">
81 (<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>)
84 % if ( $conf->config('echeck-country') eq 'CA' ) {
86 <TD ALIGN="right"><% mt('Branch number') |h %></TD>
88 <INPUT TYPE="text" NAME="payinfo3" VALUE="<%$branch%>" SIZE=6 MAXLENGTH=5>
93 <TD ALIGN="right"><% mt('Bank name') |h %></TD>
94 <TD><INPUT TYPE="text" NAME="payname" VALUE="<%$payname%>"></TD>
97 % if ( $conf->exists('show_bankstate') ) {
99 <TD ALIGN="right"><% mt('Bank state') |h %></TD>
100 <TD><& /elements/select-state.html,
101 'disable_empty' => 0,
102 'empty_label' => emt('(choose)'),
103 'state' => $paystate,
104 'country' => $cust_main->country,
110 <INPUT TYPE="hidden" NAME="paystate" VALUE="<% $paystate %>">
113 % if ( $conf->exists('show_ss') ) {
116 <% mt('Account holder') |h %><BR>
117 <% mt('Social security or tax ID #') |h %>
119 <TD><INPUT TYPE="text" NAME="ss" VALUE="<% $ss %>"></TD>
122 <INPUT TYPE="hidden" NAME="ss" VALUE="<% $ss %>"></TD>
125 % if ( $conf->exists('show_stateid') ) {
128 <% mt('Account holder') |h %><BR>
129 <% mt("Driver's license or state ID #") |h %>
131 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $stateid %>"></TD>
132 <TD ALIGN="right"><% mt('State') |h %></TD>
133 <TD><& /elements/select-state.html,
134 'disable_empty' => 0,
135 'empty_label' => emt('(choose)'),
136 'state' => $stateid_state,
137 'country' => $cust_main->country,
138 'prefix' => 'stateid_',
143 <INPUT TYPE="hidden" NAME="stateid" VALUE="<% $stateid %>">
144 <INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $stateid_state %>">
147 % } #end CARD/CHEK-specific section
152 <INPUT TYPE="checkbox" CHECKED NAME="save" VALUE="1">
153 <% mt('Remember this information') |h %>
159 <INPUT TYPE="checkbox"<% $auto ? ' CHECKED' : '' %> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }">
160 <% mt("Charge future payments to this [_1] automatically",$type{$payby}) |h %>
161 % if ( @cust_payby ) {
163 <SELECT NAME="weight">
164 % for ( 1 .. 1+scalar(grep { $_->payby =~ /^(CARD|CHEK)$/ } @cust_payby) ) {
165 <OPTION VALUE="<%$_%>"><% mt( $weight{$_} ) |h %>
169 <INPUT TYPE="hidden" NAME="weight" VALUE="1">
192 my @cust_payby = @{$opt{cust_payby}};
194 my %type = ( 'CARD' => 'credit card',
195 'CHEK' => 'electronic check (ACH)',
198 $cgi->param('payby') =~ /^(CARD|CHEK)$/
199 or die "unknown payby ". $cgi->param('payby');
202 $cgi->param('custnum') =~ /^(\d+)$/
203 or die "illegal custnum ". $cgi->param('custnum');
206 my $cust_main = qsearchs( 'cust_main', { 'custnum'=>$custnum } );
207 die "unknown custnum $custnum" unless $cust_main;
209 my $balance = $cust_main->balance;
213 my $conf = new FS::Conf;
215 #false laziness w/selfservice make_payment.html shortcut for one-country
216 my %states = map { $_->state => 1 }
217 qsearch('cust_main_county', {
218 'country' => $conf->config('countrydefault') || 'US'
220 my @states = sort { $a cmp $b } keys %states;