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