export NAS table to sqlradius, #14697
[freeside.git] / fs_selfservice / php / order_renew.php
1 <?php
2
3 require('freeside.class.php');
4 $freeside = new FreesideSelfService();
5
6 $session_id = $_GET['session_id'];
7
8 $renew_info = $freeside->renew_info( array(
9   'session_id' => $session_id,
10 ) );
11
12 $error = $renew_info['error'];
13
14 if ( $error ) {
15   header('Location:login.php?error='. urlencode($error));
16   die();
17 }
18
19 #in the simple case, just deal with the first package
20 $bill_date         = $renew_info['dates'][0]['bill_date'];
21 $bill_date_pretty  = $renew_info['dates'][0]['bill_date_pretty'];
22 $renew_date        = $renew_info['dates'][0]['renew_date'];
23 $renew_date_pretty = $renew_info['dates'][0]['renew_date_pretty'];
24 $amount            = $renew_info['dates'][0]['amount'];
25
26 $payment_info = $freeside->payment_info( array(
27   'session_id' => $session_id,
28 ) );
29
30 extract($payment_info);
31
32 ?>
33 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
34 <HTML>
35   <HEAD>
36     <TITLE>Renew Early</TITLE>
37   </HEAD>
38   <BODY>
39     <H1>Renew Early</H1>
40
41     <FONT SIZE="+1" COLOR="#ff0000"><?php echo htmlspecialchars($_GET['error']); ?></FONT>
42
43       <FORM NAME="OneTrueForm" METHOD="POST" ACTION="process_payment_order_renew.php" onSubmit="document.OneTrueForm.process.disabled=true">
44
45       <INPUT TYPE="hidden" NAME="date"       VALUE="<?php echo $date; ?>">
46       <INPUT TYPE="hidden" NAME="session_id" VALUE="<?php echo $session_id; ?>">
47       <INPUT TYPE="hidden" NAME="amount"     VALUE="<?php echo $amount; ?>">
48
49       A payment of $<?php echo $amount; ?> will renew your account through <?php echo $renew_date_pretty; ?>.<BR><BR>
50
51       <TABLE BGCOLOR="#cccccc">
52       <TR>
53         <TD ALIGN="right">Amount</TD>
54         <TD>
55           <TABLE><TR><TD BGCOLOR="#ffffff">
56             $<?php echo $amount; ?>
57           </TD></TR></TABLE>
58         </TD>
59       </TR>
60       <TR>
61         <TD ALIGN="right">Card&nbsp;type</TD>
62         <TD>
63           <SELECT NAME="card_type"><OPTION></OPTION>
64             <?php foreach ( array_keys($card_types) as $t ) { ?>
65               <OPTION <?php if ($card_type == $card_types[$t] ) { ?> SELECTED <?php } ?>
66                       VALUE="<?php echo $card_types[$t]; ?>"
67               ><?php echo $t; ?>
68             <?php } ?>
69           </SELECT>
70         </TD>
71       </TR>
72
73       <TR>
74         <TD ALIGN="right">Card&nbsp;number</TD>
75         <TD>
76           <TABLE>
77             <TR>
78               <TD>
79                 <INPUT TYPE="text" NAME="payinfo" SIZE=20 MAXLENGTH=19 VALUE="<?php echo $payinfo; ?>"> </TD>
80               <TD>Exp.</TD>
81               <TD>
82                 <SELECT NAME="month">
83                   <?php foreach ( array('01','02','03','04','05','06','07','08','09','10','11','12') as $m) { ?>
84                     <OPTION<?php if ($m == $month ) { ?> SELECTED<?php } ?>
85                     ><?php echo $m; ?>
86                   <?php } ?>
87                 </SELECT>
88               </TD>
89               <TD> / </TD>
90               <TD>
91                 <SELECT NAME="year">
92                   <?php $lt = localtime(); $y = $lt[5] + 1900;
93                         for ($y = $lt[5]+1900; $y < $lt[5] + 1910; $y++ ) { ?>
94                     <OPTION<?php if ($y == $year ) { ?> SELECTED<?php } ?>
95                     ><?php echo $y; ?>
96                   <?php } ?>
97                 </SELECT>
98               </TD>
99             </TR>
100           </TABLE>
101         </TD>
102       </TR>
103       <?php if ( $withcvv ) { ?>
104         <TR>
105           <TD ALIGN="right">CVV2&nbsp;(<A HREF="javascript:myopen('cvv2.html','cvv2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=480,height=288')">help</A>)</TD>
106           <TD><INPUT TYPE="text" NAME="paycvv" VALUE="" SIZE=4 MAXLENGTH=4></TD>
107         </TR>
108       <?php } ?>
109       <TR>
110         <TD ALIGN="right">Exact&nbsp;name&nbsp;on&nbsp;card</TD>
111         <TD><INPUT TYPE="text" SIZE=32 MAXLENGTH=80 NAME="payname" VALUE="<?php echo $payname; ?>"></TD>
112       </TR><TR>
113         <TD ALIGN="right">Card&nbsp;billing&nbsp;address</TD>
114         <TD>
115           <INPUT TYPE="text" SIZE=40 MAXLENGTH=80 NAME="address1" VALUE="<?php echo $address1; ?>">
116         </TD>
117       </TR><TR>
118         <TD ALIGN="right">Address&nbsp;line&nbsp;2</TD>
119         <TD>
120           <INPUT TYPE="text" SIZE=40 MAXLENGTH=80 NAME="address2" VALUE="<?php echo $address2; ?>">
121         </TD>
122       </TR><TR>
123         <TD ALIGN="right">City</TD>
124         <TD>
125           <TABLE>
126             <TR>
127               <TD>
128                 <INPUT TYPE="text" NAME="city" SIZE="12" MAXLENGTH=80 VALUE="<?php echo $city; ?>">
129               </TD>
130               <TD>State</TD>
131               <TD>
132                 <SELECT NAME="state">
133                   <?php foreach ( $states as $s ) { ?>
134                     <OPTION<?php if ($s == $state) { ?> SELECTED<?php } ?>
135                     ><?php echo $s; ?>
136                   <?php } ?>
137                 </SELECT>
138               </TD>
139               <TD>Zip</TD>
140               <TD>
141                 <INPUT TYPE="text" NAME="zip" SIZE=11 MAXLENGTH=10 VALUE="<?php echo $zip; ?>">
142               </TD>
143             </TR>
144           </TABLE>
145         </TD>
146       </TR>
147
148       <TR>
149         <TD COLSPAN=2>
150           <INPUT TYPE="checkbox" CHECKED NAME="save" VALUE="1">
151           Remember this information
152         </TD>
153       </TR><TR>
154         <TD COLSPAN=2>
155           <INPUT TYPE="checkbox"<?php if ( $payby == 'CARD' ) { ?> CHECKED<?php } ?> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }">
156           Charge future payments to this card automatically
157         </TD>
158       </TR>
159       </TABLE>
160       <BR>
161       <INPUT TYPE="hidden" NAME="paybatch" VALUE="<?php echo $paybatch; ?>">
162       <INPUT TYPE="submit" NAME="process" VALUE="Process payment"> <!-- onClick="this.disabled=true"> -->
163       </FORM>
164
165   </BODY>
166 </HTML>