From: jonathan Date: Wed, 20 May 2015 07:18:38 +0000 (+0000) Subject: RT#28842: NG portal - Changes for prepaid needs X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=0dbf4c6c74eb213d1648f0f0676de04efc388aa4 RT#28842: NG portal - Changes for prepaid needs --- diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index a6f8d371d..dfa90e2f2 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -140,6 +140,7 @@ sub skin_info { 'logo' => scalar($conf->config_binary('logo.png', $agentnum )), ( map { $_ => join("\n", $conf->config("selfservice-$_", $agentnum ) ) } qw( head body_header body_footer company_address ) ), + 'money_char' => $conf->config("money_char") || '$', 'menu' => join("\n", $conf->config("ng_selfservice-menu", $agentnum ) ) || 'main.php Home diff --git a/ng_selfservice/index.php b/ng_selfservice/index.php index 540f1f800..62b6562c8 100644 --- a/ng_selfservice/index.php +++ b/ng_selfservice/index.php @@ -30,7 +30,7 @@ if ( $error ) { -< /TR> + diff --git a/ng_selfservice/prepaid.php b/ng_selfservice/prepaid.php new file mode 100644 index 000000000..14784007b --- /dev/null +++ b/ng_selfservice/prepaid.php @@ -0,0 +1,202 @@ + + + +change_pkg(array( + 'session_id' => $_COOKIE['session_id'], + 'pkgpart' => $pkgpart, + 'pkgnum' => $pkgnum, + )); + if ( isset($change_results['error']) && $change_results['error'] ) { + $error = $change_results['error']; + } else { + $success .= ' Package applied to your account.'; + $pkgnum = ''; + $pkgpart = ''; + } + } else if ($pkgnum) { + $error = 'No account selected'; + } else if ($pkgpart) { + $error = 'No package selected'; + } +} + +if ($prepaid_cardnum) { + $payment_results = $freeside->process_prepay(array( + 'session_id' => $_COOKIE['session_id'], + 'prepaid_cardnum' => $prepaid_cardnum, + )); + if ( isset($payment_results['error']) && $payment_results['error'] ) { + $error = $payment_results['error']; + } else { + $success .= ' Prepaid card applied to your account.'; + $prepaid_cardnum = ''; + } +} + +$customer_info = $freeside->customer_info_short( array( + 'session_id' => $_COOKIE['session_id'], +) ); +if ( isset($customer_info['error']) && $customer_info['error'] ) { + $error = $customer_info['error']; +} + +$signup_info = $freeside->signup_info( array('customer_session_id' => $_COOKIE['session_id'], 'keys' => ['part_pkg']) ); +if (isset($signup_info['error']) && $signup_info['error']) { + $error = $signup_info['error']; +} + +$list_pkgs = $freeside->list_pkgs( array( + 'session_id' => $_COOKIE['session_id'], +) ); +if ( isset($list_pkgs['error']) && $list_pkgs['error'] ) { + $error = $list_pkgs['error']; +} + +extract($customer_info); +extract($signup_info); +extract($list_pkgs); + +$actsvcs = array(); +$expsvcs = array(); +foreach ($cust_pkg as $pkg) { + $thissvc = array(); + $thissvc['svcnum'] = $pkg['primary_cust_svc']['svcnum']; + $thissvc['overlimit'] = $pkg['primary_cust_svc']['overlimit']; + $thissvc['label'] = $pkg['primary_cust_svc']['label'][1]; + $thissvc['pkgnum'] = $pkg['pkgnum']; + $thissvc['status'] = $pkg['status']; + $actsvcs[$thissvc['svcnum']] = $thissvc; + if ($thissvc['overlimit']) { + $expsvcs[$thissvc['svcnum']] = $thissvc; + } +} + +if (count($actsvcs) > 0) { + $list_svcs = $freeside->list_svcs( array( + 'session_id' => $_COOKIE['session_id'], + ) ); + if ( isset($list_svcs['error']) && $list_svcs['error'] ) { + $error = $list_svcs['error']; + } + extract($list_svcs); + foreach ($svcs as $svc) { + if (isset($actsvcs[$svc['svcnum']])) { + $actsvcs[$svc['svcnum']]['seconds'] = strlen($svc['seconds']) ? $svc['seconds'] : 'Unlimited'; + } + } +} + +if ($success) { + echo '

' . $success . '

'; +} +include('elements/error.php'); + +if (count($actsvcs) > 0) { +?> + + +' . ucfirst($svc['status']) . ''; + } +?> + + + + + +
AccountSeconds Remaining
+ + +

:

+ + + +
+ + 0) { +?> + +

+Select an account to recharge:
+ +

+ +

+Select a package to add to account
+ +

+ + + +

You have no services to recharge at this time.

+ + 0) or (count($expsvcs) > 0)) { +?> + +

+Enter prepaid card number:
+ +

+ + + + + +
+ + + +