927e7451cf55e710cd51f7c4432a8efda2ec037c
[freeside.git] / fs_signup / FS-SignupClient / cgi / signup.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: signup.cgi,v 1.29.2.20 2003-12-10 23:56:53 ivan Exp $
4
5 use strict;
6 use vars qw( @payby $cgi $locales $packages
7              $pops %pop %popnum2pop
8              $init_data $error
9              $last $first $ss $company $address1 $address2 $city $state $county
10              $country $zip $daytime $night $fax $invoicing_list $payby $payinfo
11              $paycvv $paydate $payname $referral_custnum $init_popstate
12              $pkgpart $username $password $password2 $sec_phrase $popnum
13              $agentnum $refnum
14              $ieak_file $ieak_template $cck_file $cck_template
15              $signup_html $signup_template
16              $success_html $success_template
17              $decline_html $decline_template
18              $ac $exch $loc
19              $email_name $pkg
20              $self_url
21            );
22 use subs qw( print_form print_okay print_decline
23              success_default decline_default
24              expselect );
25 use CGI;
26 #use CGI::Carp qw(fatalsToBrowser);
27 use Text::Template;
28 use Business::CreditCard;
29 use HTTP::Headers::UserAgent 2.00;
30 use FS::SignupClient 0.03 qw( signup_info new_customer );
31
32 #acceptable payment methods
33 #
34 #@payby = qw( CARD BILL COMP );
35 #@payby = qw( CARD BILL );
36 #@payby = qw( CARD );
37 @payby = qw( CARD PREPAY );
38
39 $ieak_file = '/usr/local/freeside/ieak.template';
40 $cck_file = '/usr/local/freeside/cck.template';
41 $signup_html = -e 'signup.html'
42                  ? 'signup.html'
43                  : '/usr/local/freeside/signup.html';
44 $success_html = -e 'success.html'
45                   ? 'success.html'
46                   : '/usr/local/freeside/success.html';
47 $decline_html = -e 'decline.html'
48                   ? 'decline.html'
49                   : '/usr/local/freeside/decline.html';
50
51
52 if ( -e $ieak_file ) {
53   my $ieak_txt = Text::Template::_load_text($ieak_file)
54     or die $Text::Template::ERROR;
55   $ieak_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
56   $ieak_txt = $1;
57   $ieak_txt =~ s/\r//g; # don't double \r on old templates
58   $ieak_txt =~ s/\n/\r\n/g;
59   $ieak_template = new Text::Template ( TYPE => 'STRING', SOURCE => $ieak_txt )
60     or die $Text::Template::ERROR;
61 } else {
62   $ieak_template = '';
63 }
64
65 if ( -e $cck_file ) {
66   my $cck_txt = Text::Template::_load_text($cck_file)
67     or die $Text::Template::ERROR;
68   $cck_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
69   $cck_txt = $1;
70   $cck_template = new Text::Template ( TYPE => 'STRING', SOURCE => $cck_txt )
71     or die $Text::Template::ERROR;
72 } else {
73   $cck_template = '';
74 }
75
76 $agentnum = '';
77 if ( -e $signup_html ) {
78   my $signup_txt = Text::Template::_load_text($signup_html)
79     or die $Text::Template::ERROR;
80   $signup_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
81   $signup_txt = $1;
82   $signup_template = new Text::Template ( TYPE => 'STRING',
83                                           SOURCE => $signup_txt,
84                                           DELIMITERS => [ '<%=', '%>' ]
85                                         )
86     or die $Text::Template::ERROR;
87   if ( $signup_txt =~
88          /<\s*INPUT TYPE="?hidden"?\s+NAME="?agentnum"?\s+VALUE="?(\d+)"?\s*>/si
89   ) {
90     $agentnum = $1;
91   }
92 } else {
93   #too much maintenance hassle to keep in this file
94   die "can't find ./signup.html or /usr/local/freeside/signup.html";
95   #$signup_template = new Text::Template ( TYPE => 'STRING',
96   #                                        SOURCE => &signup_default,
97   #                                        DELIMITERS => [ '<%=', '%>' ]
98   #                                      )
99   #  or die $Text::Template::ERROR;
100 }
101
102 if ( -e $success_html ) {
103   my $success_txt = Text::Template::_load_text($success_html)
104     or die $Text::Template::ERROR;
105   $success_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
106   $success_txt = $1;
107   $success_template = new Text::Template ( TYPE => 'STRING',
108                                            SOURCE => $success_txt,
109                                            DELIMITERS => [ '<%=', '%>' ],
110                                          )
111     or die $Text::Template::ERROR;
112 } else {
113   $success_template = new Text::Template ( TYPE => 'STRING',
114                                            SOURCE => &success_default,
115                                            DELIMITERS => [ '<%=', '%>' ],
116                                          )
117     or die $Text::Template::ERROR;
118 }
119
120 if ( -e $decline_html ) {
121   my $decline_txt = Text::Template::_load_text($decline_html)
122     or die $Text::Template::ERROR;
123   $decline_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
124   $decline_txt = $1;
125   $decline_template = new Text::Template ( TYPE => 'STRING',
126                                            SOURCE => $decline_txt,
127                                            DELIMITERS => [ '<%=', '%>' ],
128                                          )
129     or die $Text::Template::ERROR;
130 } else {
131   $decline_template = new Text::Template ( TYPE => 'STRING',
132                                            SOURCE => &decline_default,
133                                            DELIMITERS => [ '<%=', '%>' ],
134                                          )
135     or die $Text::Template::ERROR;
136 }
137
138
139 ( $locales, $packages, $pops, $init_data ) = signup_info();
140 @payby = @{$init_data->{'payby'}} if @{$init_data->{'payby'}};
141 $packages = $init_data->{agentnum2part_pkg}{$agentnum} if $agentnum;
142 %pop = ();
143 %popnum2pop = ();
144 foreach (@$pops) {
145   #push @{ $pop{ $_->{state} }->{ $_->{ac} } }, $_;
146   push @{ $pop{ $_->{state} } }, $_;
147   $popnum2pop{$_->{popnum}} = $_;
148 }
149
150 $cgi = new CGI;
151
152 if ( defined $cgi->param('magic') ) {
153   if ( $cgi->param('magic') eq 'process' ) {
154
155     if ( $cgi->param('state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/ ) {
156       $state = $1;
157       $county = $3 || '';
158       $country = $4;
159     } elsif ( $cgi->param('state') =~ /^(\w*)$/ ) {
160       $state = $1;
161       $cgi->param('county') =~ /^([\w ]*)$/
162         or die "illegal county: ". $cgi->param('county');
163       $county = $1;
164       $cgi->param('country') =~ /^(\w+)$/
165         or die "illegal country: ". $cgi->param('country');
166       $country = $1;
167     } else {
168       die "illegal state: ". $cgi->param('state');
169     }
170
171     $payby = $cgi->param('payby');
172     if ( $payby eq 'CHEK' ) {
173       #$payinfo = join('@', map { $cgi->param( $payby. "_payinfo$_" ) } (1,2) );
174       $payinfo = $cgi->param('CHEK_payinfo1').'@'.$cgi->param('CHEK_payinfo2');
175     } else {
176       $payinfo = $cgi->param( $payby. '_payinfo' );
177     }
178     $paydate =
179       $cgi->param( $payby. '_month' ). '-'. $cgi->param( $payby. '_year' );
180     $payname = $cgi->param( $payby. '_payname' );
181     $paycvv = defined $cgi->param( $payby. '_paycvv' )
182                 ? $cgi->param( $payby. '_paycvv' )
183                 : '';
184
185     if ( $invoicing_list = $cgi->param('invoicing_list') ) {
186       $invoicing_list .= ', POST' if $cgi->param('invoicing_list_POST');
187     } else {
188       $invoicing_list = 'POST';
189     }
190
191     $error = '';
192
193     $last             = $cgi->param('last');
194     $first            = $cgi->param('first');
195     $ss               = $cgi->param('ss');
196     $company          = $cgi->param('company');
197     $address1         = $cgi->param('address1');
198     $address2         = $cgi->param('address2');
199     $city             = $cgi->param('city');
200     #$county,
201     #$state,
202     $zip              = $cgi->param('zip');
203     #$country,
204     $daytime          = $cgi->param('daytime');
205     $night            = $cgi->param('night');
206     $fax              = $cgi->param('fax');
207     #$payby,
208     #$payinfo,
209     #$paydate,
210     #$payname,
211     #$invoicing_list,
212     $referral_custnum = $cgi->param('ref');
213     $pkgpart          = $cgi->param('pkgpart');
214     $username         = $cgi->param('username');
215     $sec_phrase       = $cgi->param('sec_phrase');
216     $password         = $cgi->param('_password');
217     $popnum           = $cgi->param('popnum');
218     #$agentnum, #         = $cgi->param('agentnum'),
219     $agentnum         ||= $cgi->param('agentnum');
220     $init_popstate    = $cgi->param('init_popstate');
221     $refnum           = $cgi->param('refnum');
222
223     if ( $cgi->param('_password') ne $cgi->param('_password2') ) {
224       $error = $init_data->{msgcat}{passwords_dont_match}; #msgcat
225       $password  = '';
226       $password2 = '';
227     } else {
228       $password2 = $cgi->param('_password2');
229
230       if ( $payby eq 'CARD' && $cgi->param('CARD_type') ) {
231         $payinfo =~ s/\D//g;
232
233         $payinfo =~ /^(\d{13,16})$/
234           or $error ||= $init_data->{msgcat}{invalid_card}; #. $self->payinfo;
235         $payinfo = $1;
236         validate($payinfo)
237           or $error ||= $init_data->{msgcat}{invalid_card}; #. $self->payinfo;
238         cardtype($payinfo) eq $cgi->param('CARD_type')
239           or $error ||= $init_data->{msgcat}{not_a}. $cgi->param('CARD_type');
240       }
241
242       $error ||= new_customer ( {
243         'last'             => $last,
244         'first'            => $first,
245         'ss'               => $ss,
246         'company'          => $company,
247         'address1'         => $address1,
248         'address2'         => $address2,
249         'city'             => $city,
250         'county'           => $county,
251         'state'            => $state,
252         'zip'              => $zip,
253         'country'          => $country,
254         'daytime'          => $daytime,
255         'night'            => $night,
256         'fax'              => $fax,
257         'payby'            => $payby,
258         'payinfo'          => $payinfo,
259         'paycvv'           => $paycvv,
260         'paydate'          => $paydate,
261         'payname'          => $payname,
262         'invoicing_list'   => $invoicing_list,
263         'referral_custnum' => $referral_custnum,
264         'pkgpart'          => $pkgpart,
265         'username'         => $username,
266         'sec_phrase'       => $sec_phrase,
267         '_password'        => $password,
268         'popnum'           => $popnum,
269         'agentnum'         => $agentnum,
270         'refnum'           => $refnum,
271         map { $_ => $cgi->param($_) } grep { /^snarf_/ } $cgi->param
272       } );
273
274     }
275     
276     if ( $error eq '_decline' ) {
277       print_decline();
278     } elsif ( $error ) {
279       #fudge the snarf info
280       no strict 'refs';
281       ${$_} = $cgi->param($_) foreach grep { /^snarf_/ } $cgi->param;
282       print_form();
283     } else {
284       print_okay();
285     }
286
287   } else {
288     die "unrecognized magic: ". $cgi->param('magic');
289   }
290 } else {
291   $error = '';
292   $last = '';
293   $first = '';
294   $ss = '';
295   $company = '';
296   $address1 = '';
297   $address2 = '';
298   $city = '';
299   $state = $cgi->param('init_popstate') || $init_data->{statedefault};
300   $county = '';
301   $country = $init_data->{countrydefault};
302   $zip = '';
303   $daytime = '';
304   $night = '';
305   $fax = '';
306   $invoicing_list = '';
307   $payby = '';
308   $payinfo = '';
309   $paydate = '';
310   $payname = '';
311   $pkgpart = '';
312   $username = '';
313   $password = '';
314   $password2 = '';
315   $sec_phrase = '';
316   $popnum = '';
317   $referral_custnum = $cgi->param('ref') || '';
318   $init_popstate = $cgi->param('init_popstate') || '';
319   $refnum = $init_data->{'refnum'};
320   print_form;
321 }
322
323 sub print_form {
324
325   $cgi->delete('ref');
326   $cgi->delete('init_popstate');
327   $self_url = $cgi->self_url;
328
329   $error = "Error: $error" if $error;
330
331   print $cgi->header( '-expires' => 'now' ),
332         $signup_template->fill_in();
333
334 }
335
336 sub print_decline {
337   print $cgi->header( '-expires' => 'now' ),
338         $decline_template->fill_in();
339 }
340
341 sub print_okay {
342   my $user_agent = new HTTP::Headers::UserAgent $ENV{HTTP_USER_AGENT};
343
344   $cgi->param('username') =~ /^(.+)$/
345     or die "fatal: invalid username got past FS::SignupClient::new_customer";
346   my $username = $1;
347   $cgi->param('_password') =~ /^(.+)$/
348     or die "fatal: invalid password got past FS::SignupClient::new_customer";
349   my $password = $1;
350   ( $cgi->param('first'). ' '. $cgi->param('last') ) =~ /^(.*)$/
351     or die "fatal: invalid email_name got past FS::SignupClient::new_customer";
352   $email_name = $1; #global for template
353
354   my $pop = $popnum2pop{$cgi->param('popnum')};
355     #or die "fatal: invalid popnum got past FS::SignupClient::new_customer";
356   if ( $pop ) {
357     ( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} );
358   } else {
359     ( $ac, $exch, $loc ) = ( '', '', ''); #presumably you're not using them.
360   }
361
362   #global for template
363   $pkg = ( grep { $_->{'pkgpart'} eq $pkgpart } @$packages )[0]->{'pkg'};
364
365   if ( $ieak_template
366        && $user_agent->platform eq 'ia32'
367        && $user_agent->os =~ /^win/
368        && ($user_agent->browser)[0] eq 'IE'
369      )
370   { #send an IEAK config
371     print $cgi->header('application/x-Internet-signup'),
372           $ieak_template->fill_in();
373   } elsif ( $cck_template
374             && $user_agent->platform eq 'ia32'
375             && $user_agent->os =~ /^win/
376             && ($user_agent->browser)[0] eq 'Netscape'
377           )
378   { #send a Netscape config
379     my $cck_data = $cck_template->fill_in();
380     print $cgi->header('application/x-netscape-autoconfigure-dialer-v2'),
381           map {
382             m/(.*)\s+(.*)$/;
383             pack("N", length($1)). $1. pack("N", length($2)). $2;
384           } split(/\n/, $cck_data);
385
386   } else { #send a simple confirmation
387     print $cgi->header( '-expires' => 'now' ),
388           $success_template->fill_in();
389   }
390 }
391
392 #horrible false laziness with FS/FS/svc_acct_pop.pm::popselector
393 sub popselector {
394   my( $popnum, $state ) = @_;
395
396   return '<INPUT TYPE="hidden" NAME="popnum" VALUE="">' unless @$pops;
397   return $pops->[0]{city}. ', '. $pops->[0]{state}.
398          ' ('. $pops->[0]{ac}. ')/'. $pops->[0]{exch}. '-'. $pops->[0]{loc}.
399          '<INPUT TYPE="hidden" NAME="popnum" VALUE="'. $pops->[0]{popnum}. '">'
400     if scalar(@$pops) == 1;
401
402   #my %pop = ();
403   #push @{ $pop{$_->{state}} }, $_ foreach @$pops;
404
405   my $text;
406
407   if ( $init_popstate ) {
408     $text .= '<INPUT TYPE="hidden" NAME="init_popstate" VALUE="'.
409              $init_popstate. '">';
410   } else {
411     $text .= <<END;
412       <SCRIPT>
413       function opt(what,href,text) {
414         var optionName = new Option(text, href, false, false)
415         var length = what.length;
416         what.options[length] = optionName;
417       }
418       function popstate_changed(what) {
419         state = what.options[what.selectedIndex].text;
420         what.form.popnum.options.length = 0;
421         what.form.popnum.options[0] = new Option("", "", false, true);
422 END
423
424     foreach my $popstate ( sort { $a cmp $b } keys %pop ) {
425       $text .= "\nif ( state == \"$popstate\" ) {\n";
426
427       foreach my $pop ( @{$pop{$popstate}}) {
428         my $o_popnum = $pop->{popnum};
429         my $poptext =  $pop->{city}. ', '. $pop->{state}.
430                        ' ('. $pop->{ac}. ')/'. $pop->{exch}. '-'. $pop->{loc};
431
432         $text .= "opt(what.form.popnum, \"$o_popnum\", \"$poptext\");\n"
433       }
434       $text .= "}\n";
435     }
436
437     $text .= "}\n</SCRIPT>\n";
438
439     $text .=
440       qq!<SELECT NAME="popstate" SIZE=1 onChange="popstate_changed(this)">!.
441       qq!<OPTION> !;
442     $text .= "<OPTION>$_" foreach sort { $a cmp $b } keys %pop;
443     $text .= '</SELECT>'; #callback? return 3 html pieces?  #'</TD><TD>';
444
445   }
446   $text .= qq!<SELECT NAME="popnum" SIZE=1><OPTION> !;
447
448   #comment this block to disable initial list population
449   my @initial_select = ();
450   if ( $init_popstate ) {
451     @initial_select = grep { $_->{state} eq $init_popstate } @$pops;
452   } else {
453     if ( scalar( @$pops ) > 100 ) {
454       push @initial_select, $popnum2pop{$popnum} if $popnum2pop{$popnum};
455     } else {
456       @initial_select = @$pops;
457     }
458   }
459   foreach my $pop ( sort { $a->{state} cmp $b->{state} } @initial_select ) {
460     $text .= qq!<OPTION VALUE="!. $pop->{popnum}. '"'.
461              ( ( $popnum && $pop->{popnum} == $popnum ) ? ' SELECTED' : '' ). ">".
462              $pop->{city}. ', '. $pop->{state}.
463                ' ('. $pop->{ac}. ')/'. $pop->{exch}. '-'. $pop->{loc};
464   }
465   $text .= '</SELECT>';
466
467   $text;
468 }
469
470 sub expselect {
471   my $prefix = shift;
472   my $date = shift || '';
473   my( $m, $y ) = ( 0, 0 );
474   if ( $date  =~ /^(\d{4})-(\d{2})-\d{2}$/ ) { #PostgreSQL date format
475     ( $m, $y ) = ( $2, $1 );
476   } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
477     ( $m, $y ) = ( $1, $3 );
478   }
479   my $return = qq!<SELECT NAME="$prefix!. qq!_month" SIZE="1">!;
480   for ( 1 .. 12 ) {
481     $return .= "<OPTION";
482     $return .= " SELECTED" if $_ == $m;
483     $return .= ">$_";
484   }
485   $return .= qq!</SELECT>/<SELECT NAME="$prefix!. qq!_year" SIZE="1">!;
486   for ( 2001 .. 2037 ) {
487     $return .= "<OPTION";
488     $return .= " SELECTED" if $_ == $y;
489     $return .= ">$_";
490   }
491   $return .= "</SELECT>";
492
493   $return;
494 }
495
496 #false laziness w/FS::cust_main_county
497 sub regionselector {
498   my ( $selected_county, $selected_state, $selected_country,
499        $prefix, $onchange ) = @_;
500
501   $prefix = '' unless defined $prefix;
502
503   my $countyflag = 0;
504
505   my %cust_main_county;
506
507 #  unless ( @cust_main_county ) { #cache 
508     #@cust_main_county = qsearch('cust_main_county', {} );
509     #foreach my $c ( @cust_main_county ) {
510     foreach my $c ( @$locales ) {
511       #$countyflag=1 if $c->county;
512       $countyflag=1 if $c->{county};
513       #push @{$cust_main_county{$c->country}{$c->state}}, $c->county;
514       #$cust_main_county{$c->country}{$c->state}{$c->county} = 1;
515       $cust_main_county{$c->{country}}{$c->{state}}{$c->{county}} = 1;
516     }
517 #  }
518   $countyflag=1 if $selected_county;
519
520   my $script_html = <<END;
521     <SCRIPT>
522     function opt(what,value,text) {
523       var optionName = new Option(text, value, false, false);
524       var length = what.length;
525       what.options[length] = optionName;
526     }
527     function ${prefix}country_changed(what) {
528       country = what.options[what.selectedIndex].text;
529       for ( var i = what.form.${prefix}state.length; i >= 0; i-- )
530           what.form.${prefix}state.options[i] = null;
531 END
532       #what.form.${prefix}state.options[0] = new Option('', '', false, true);
533
534   foreach my $country ( sort keys %cust_main_county ) {
535     $script_html .= "\nif ( country == \"$country\" ) {\n";
536     foreach my $state ( sort keys %{$cust_main_county{$country}} ) {
537       my $text = $state || '(n/a)';
538       $script_html .= qq!opt(what.form.${prefix}state, "$state", "$text");\n!;
539     }
540     $script_html .= "}\n";
541   }
542
543   $script_html .= <<END;
544     }
545     function ${prefix}state_changed(what) {
546 END
547
548   if ( $countyflag ) {
549     $script_html .= <<END;
550       state = what.options[what.selectedIndex].text;
551       country = what.form.${prefix}country.options[what.form.${prefix}country.selectedIndex].text;
552       for ( var i = what.form.${prefix}county.length; i >= 0; i-- )
553           what.form.${prefix}county.options[i] = null;
554 END
555
556     foreach my $country ( sort keys %cust_main_county ) {
557       $script_html .= "\nif ( country == \"$country\" ) {\n";
558       foreach my $state ( sort keys %{$cust_main_county{$country}} ) {
559         $script_html .= "\nif ( state == \"$state\" ) {\n";
560           #foreach my $county ( sort @{$cust_main_county{$country}{$state}} ) {
561           foreach my $county ( sort keys %{$cust_main_county{$country}{$state}} ) {
562             my $text = $county || '(n/a)';
563             $script_html .=
564               qq!opt(what.form.${prefix}county, "$county", "$text");\n!;
565           }
566         $script_html .= "}\n";
567       }
568       $script_html .= "}\n";
569     }
570   }
571
572   $script_html .= <<END;
573     }
574     </SCRIPT>
575 END
576
577   my $county_html = $script_html;
578   if ( $countyflag ) {
579     $county_html .= qq!<SELECT NAME="${prefix}county" onChange="$onchange">!;
580     $county_html .= '</SELECT>';
581   } else {
582     $county_html .=
583       qq!<INPUT TYPE="hidden" NAME="${prefix}county" VALUE="$selected_county">!;
584   }
585
586   my $state_html = qq!<SELECT NAME="${prefix}state" !.
587                    qq!onChange="${prefix}state_changed(this); $onchange">!;
588   foreach my $state ( sort keys %{ $cust_main_county{$selected_country} } ) {
589     my $text = $state || '(n/a)';
590     my $selected = $state eq $selected_state ? 'SELECTED' : '';
591     $state_html .= "\n<OPTION $selected VALUE=$state>$text</OPTION>"
592   }
593   $state_html .= '</SELECT>';
594
595   $state_html .= '</SELECT>';
596
597   my $country_html = qq!<SELECT NAME="${prefix}country" !.
598                      qq!onChange="${prefix}country_changed(this); $onchange">!;
599   my $countrydefault = $init_data->{countrydefault} || 'US';
600   foreach my $country (
601     sort { ($b eq $countrydefault) <=> ($a eq $countrydefault) or $a cmp $b }
602       keys %cust_main_county
603   ) {
604     my $selected = $country eq $selected_country ? ' SELECTED' : '';
605     $country_html .= "\n<OPTION$selected>$country</OPTION>"
606   }
607   $country_html .= '</SELECT>';
608
609   ($county_html, $state_html, $country_html);
610
611 }
612
613 sub success_default { #html to use if you don't specify a success file
614   <<'END';
615 <HTML><HEAD><TITLE>Signup successful</TITLE></HEAD>
616 <BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Signup successful</FONT><BR><BR>
617 Thanks for signing up!
618 <BR><BR>
619 Signup information for <%= $email_name %>:
620 <BR><BR>
621 Username: <%= $username %><BR>
622 Password: <%= $password %><BR>
623 Access number: (<%= $ac %>) / <%= $exch %> - <%= $local %><BR>
624 Package: <%= $pkg %><BR>
625 </BODY></HTML>
626 END
627 }
628
629 sub decline_default { #html to use if there is a decline
630   <<'END';
631 <HTML><HEAD><TITLE>Processing error</TITLE></HEAD>
632 <BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Processing error</FONT><BR><BR>
633 There has been an error processing your account.  Please contact customer
634 support.
635 </BODY></HTML>
636 END
637 }
638