1 <? $title ='Prepaid Card Account Recharge'; include('elements/header.php'); ?>
2 <? $current_menu = 'prepaid.php'; include('elements/menu.php'); ?>
5 // This page is currently only designed for packages that use prepaid pricing.
6 // Usage limits should be in seconds, and you currently cannot mix packages that have
7 // usage limits with packages that don't. Payments must be made by prepaid card.
8 // The account service must be flagged as primary service of package.
10 // You can't change packages if you have a positive balance, but you CAN use
11 // this form to only change package or only use a prepaid card--doing both isn't
14 $prepaid_cardnum = isset($_POST['prepaid_cardnum']) ? $_POST['prepaid_cardnum'] : '';
15 $pkgpart = isset($_POST['pkgpart']) ? $_POST['pkgpart'] : '';
16 $pkgnum = isset($_POST['pkgnum']) ? $_POST['pkgnum'] : '';
20 if ($pkgnum || $pkgpart) {
21 if ($pkgnum && $pkgpart) {
22 $change_results = $freeside->change_pkg(array(
23 'session_id' => $_COOKIE['session_id'],
24 'pkgpart' => $pkgpart,
27 if ( isset($change_results['error']) && $change_results['error'] ) {
28 $error = $change_results['error'];
30 $success .= ' Package applied to your account.';
35 $error = 'No account selected';
36 } else if ($pkgpart) {
37 $error = 'No package selected';
41 if ($prepaid_cardnum) {
42 $payment_results = $freeside->process_prepay(array(
43 'session_id' => $_COOKIE['session_id'],
44 'prepaid_cardnum' => $prepaid_cardnum,
46 if ( isset($payment_results['error']) && $payment_results['error'] ) {
47 $error = $payment_results['error'];
49 $success .= ' Prepaid card applied to your account.';
50 $prepaid_cardnum = '';
54 $customer_info = $freeside->customer_info_short( array(
55 'session_id' => $_COOKIE['session_id'],
57 if ( isset($customer_info['error']) && $customer_info['error'] ) {
58 $error = $customer_info['error'];
61 $signup_info = $freeside->signup_info( array('customer_session_id' => $_COOKIE['session_id'], 'keys' => ['part_pkg']) );
62 if (isset($signup_info['error']) && $signup_info['error']) {
63 $error = $signup_info['error'];
66 $list_pkgs = $freeside->list_pkgs( array(
67 'session_id' => $_COOKIE['session_id'],
69 if ( isset($list_pkgs['error']) && $list_pkgs['error'] ) {
70 $error = $list_pkgs['error'];
73 extract($customer_info);
74 extract($signup_info);
79 foreach ($cust_pkg as $pkg) {
81 $thissvc['svcnum'] = $pkg['primary_cust_svc']['svcnum'];
82 $thissvc['overlimit'] = $pkg['primary_cust_svc']['overlimit'];
83 $thissvc['label'] = $pkg['primary_cust_svc']['label'][1];
84 $thissvc['pkgnum'] = $pkg['pkgnum'];
85 $thissvc['status'] = $pkg['status'];
86 $actsvcs[$thissvc['svcnum']] = $thissvc;
87 if ($thissvc['overlimit'] or ($thissvc['status'] != 'active')) {
88 $expsvcs[$thissvc['svcnum']] = $thissvc;
92 if (count($actsvcs) > 0) {
93 $list_svcs = $freeside->list_svcs( array(
94 'session_id' => $_COOKIE['session_id'],
96 if ( isset($list_svcs['error']) && $list_svcs['error'] ) {
97 $error = $list_svcs['error'];
100 foreach ($svcs as $svc) {
101 if (isset($actsvcs[$svc['svcnum']])) {
102 $actsvcs[$svc['svcnum']]['seconds'] = strlen($svc['seconds']) ? $svc['seconds'] : 'Unlimited';
108 echo '<P><B>' . $success . '</B></P>';
110 include('elements/error.php');
112 if (count($actsvcs) > 0) {
114 <TABLE STYLE="text-align: left;">
115 <TR><TH>Account</TH><TH STYLE="text-align: right;">Seconds Remaining</TH></TR>
117 foreach ($actsvcs as $svc) {
118 if ($svc['status'] == 'active') {
119 $slabel = $svc['seconds'];
121 $slabel = '<I>' . ucfirst($svc['status']) . '</I>';
125 <TD><? echo $svc['label'] ?></TD>
126 <TD STYLE="text-align: right;"><? echo $slabel ?></TD>
135 $blabel = ($balance < 0) ? 'Credit' : 'Balance';
138 <P><B><? echo $blabel ?>:</B> <? echo $money_char . abs($balance) ?></P>
144 <FORM NAME="OneTrueForm" METHOD="POST" ACTION="prepaid.php" onSubmit="document.OneTrueForm.process.disabled=true">
148 if (count($expsvcs) > 0) {
152 <B>Select an account to recharge:</B><BR>
153 <SELECT NAME="pkgnum">
154 <OPTION VALUE=""></OPTION>
155 <? foreach ($expsvcs as $svc) { ?>
156 <OPTION VALUE="<? echo $svc['pkgnum'] ?>"<? echo $pkgnum == $svc['pkgnum'] ? ' CHECKED' : '' ?>>
157 <? echo $svc['label'] ?>
164 <B>Select a package to add to account</B><BR>
165 <SELECT NAME="pkgpart">
166 <OPTION VALUE=""></OPTION>
167 <? foreach ($part_pkg as $pkg) { ?>
168 <OPTION VALUE="<? echo $pkg['pkgpart'] ?>"<? echo $pkgpart == $pkg['pkgpart'] ? ' CHECKED' : '' ?>>
169 <? echo $pkg['pkg'] . ' - ' . $money_char . $pkg['options']['recur_fee'] ?>
179 <P>You have no services to recharge at this time.</P>
184 if (($balance > 0) or (count($expsvcs) > 0)) {
188 <B>Enter prepaid card number:</B><BR>
189 <INPUT TYPE="text" NAME="prepaid_cardnum" VALUE="<? echo $prepaid_cardnum ?>">
192 <INPUT TYPE="submit" NAME="submit" VALUE="Submit">
200 <? include('elements/menu_footer.php'); ?>
201 <? include('elements/footer.php'); ?>