public function process() { if (!$this->txbepay_load_status) { PSU::db('banner')->StartTrans(); if ($this->status_flag == 'success') { if ($this->txbepay_trans_type == 1) { $this->detail_code = 'IQEW'; $this->detail_desc = 'Credit-Card-Payment-Thank You'; $this->multiplier = 1; } elseif ($this->txbepay_trans_type == 2) { $this->detail_code = 'IREW'; $this->detail_desc = 'Credit-Card-Refund'; $this->multiplier = -1; } elseif ($this->txbepay_trans_type == 3) { $this->detail_code = 'IQEC'; $this->detail_desc = 'E-Check-Payment-Thank You'; $this->multiplier = 1; } //end else $this->transaction = new \PSU\AR\Transaction\Receivable($this->txbepay_order_number, $this->txbepay_trans_total / 100, $this->multiplier); $this->bursar_term = $this->transaction->term_code; $receivable_template = $this->init_template(); $this->transaction->split($receivable_template); if (PSU::has_filter('etrans_post_split')) { PSU::apply_filters('etrans_post_split', $this); } //end if $this->transaction->save(); if (PSU::has_filter('etrans_post_save')) { PSU::apply_filters('etrans_post_save', $this); } //end if $this->txbepay_load_status = 'loaded'; $this->txbepay_load_date = date('Y-m-d'); $this->save(); $amount = !PSU::db('banner')->HasFailedTrans() ? $this->txbepay_trans_total / 100 : false; } else { $this->txbepay_load_status = 'no_load'; $this->txbepay_load_date = date('Y-m-d'); $this->save(); $amount = 0; } //end else PSU::db('banner')->CompleteTrans(); return $amount; } //end if return false; }
function testFilter() { PSU::add_filter('testFilter_1', array($this, 'method_filter')); $this->assertEquals(PSU::apply_filters('testFilter_1', 'foobar'), 'method_filter_foobar', 'Filter via object method'); PSU::add_filter('testFilter_2', 'global_function_filter'); $this->assertEquals(PSU::apply_filters('testFilter_2', 'foobar'), 'global_function_filter_foobar', 'Filter via global function'); PSU::add_filter('testFilter_3', array($this, 'multifilter1')); PSU::add_filter('testFilter_3', array($this, 'multifilter2')); $this->assertEquals(PSU::apply_filters('testFilter_3', 'foobar'), 'multifilter2_multifilter1_foobar', 'Chaining filters'); PSU::add_filter('testFilter_4', array($this, 'multifilter3'), 11); PSU::add_filter('testFilter_4', array($this, 'multifilter2')); PSU::add_filter('testFilter_4', array($this, 'multifilter1'), 9); $this->assertEquals(PSU::apply_filters('testFilter_4', 'foobar'), 'multifilter3_multifilter2_multifilter1_foobar', 'Chaining filters with priority #1'); PSU::add_filter('testFilter_5', array($this, 'multifilter1'), 9); PSU::add_filter('testFilter_5', array($this, 'multifilter3'), 11); PSU::add_filter('testFilter_5', array($this, 'multifilter2')); $this->assertEquals(PSU::apply_filters('testFilter_5', 'foobar'), 'multifilter3_multifilter2_multifilter1_foobar', 'Chaining filters with priority #2'); }
public function process() { if ($this->psu_status == 'eod') { \PSU::db('banner')->StartTrans(); if ($this->status_flag == 'success') { if ($this->transactiontype == 1) { $this->detail_code = 'IQEW'; $this->detail_desc = 'Credit-Card-Payment-Thank You'; $this->multiplier = -1; // send notification to bursar if an unknown creditcard payment has been received if ($this->transactionstatus == 4) { $message = 'There was a "Transaction Status = 4" payment paid via Commerce Manager. Here is the debug information:' . "\n\n"; $message .= print_r($this, true); \PSU::mail('bursar@plymouth.edu,mtbatchelder@plymouth.edu', 'Alert: Unknown Credit Card Payment via Nelnet', $message); } //end if } elseif ($this->transactiontype == 2) { $this->detail_code = 'IREW'; $this->detail_desc = 'Credit-Card-Refund'; $this->multiplier = 1; // send notification to bursar if an unknown creditcard refund has been received if ($this->transactionstatus == 4) { $message = 'There was a "Transaction Status = 4" credit card refund fed by via Commerce Manager. Here is the debug information:' . "\n\n"; $message .= print_r($this, true); $email = array('*****@*****.**'); if (!\PSU::isDev()) { $email[] = '*****@*****.**'; } //end if \PSU::mail($email, 'Alert: Unknown Credit Card Refund via Nelnet', $message); } //end if } elseif ($this->transactiontype == 3) { $this->detail_code = 'IQEC'; $this->detail_desc = 'E-Check-Payment-Thank You'; $this->multiplier = -1; } //end else $this->transaction = new \PSU\AR\Transaction\Receivable($this->ordernumber, $this->totalamount / 100, $this->multiplier); $this->bursar_term = $this->transaction->term_code; $receivable_template = $this->init_template(); $this->transaction->split($receivable_template); if (\PSU::has_filter('etrans_post_split')) { \PSU::apply_filters('etrans_post_split', $this); } //end if $this->transaction->save(); if (\PSU::has_filter('etrans_post_save')) { \PSU::apply_filters('etrans_post_save', $this); } //end if $this->psu_status = 'loaded'; $this->save(); $amount = !PSU::db('banner')->HasFailedTrans() ? $this->totalamount / 100 : false; } else { $this->psu_status = 'no_load'; $this->save(); $amount = 0; } //end else PSU::db('banner')->CompleteTrans(); return $amount; } //end if PSU::db('banner')->CompleteTrans(false); return false; }
$app->tpl = new TeacherCert\Template(); $app->user = PSUPerson::get($_SESSION['wp_id']); $app->populate('config', new \PSU\Config()); $app->config->load(); $app->populate('resolver', new TeacherCert\Template\Resolver($app->config)); $app->populate('breadcrumbs', new \PSU\Template\Breadcrumbs()); $app->breadcrumbs->push(new \PSU\Template\Breadcrumb('Home', $app->config->get('teacher-cert', 'base_url') . '/')); $app->tpl->assign('user', $app->user); $app->tpl->assign('back_url', $_SERVER['HTTP_REFERER']); // mocks go after the first responder (above) and below normal routes (below) if (defined('TCERT_MOCK') && TCERT_MOCK) { include PSU_BASE_DIR . '/debug/teacher-cert-mock.php'; } // Assign this after mock.php has run $app->tpl->assign('permissions', $app->permissions); $app->student_view = PSU::apply_filters('student_view', $app->student_view); // User does not have tcert permission; is it a student // trying to access his student gates? if ($app->permissions->has('tcert')) { // no special overrides; } else { // non-tcert folks can only read $response->readonly(true); // non-faculty can only view the student page if (!$app->permissions->has('faculty')) { if (!$app->student_view) { $response->redirect($GLOBALS['BASE_URL'] . '/me/'); } } } // instantiate gate systems collection
/** * split transaction into receivable entries * * @param $record_template \b bare-bones TBRACCD field array that will be used for all TBRACCD records during transaction processing */ public function split($record_template) { $this->amount_paid_remaining = $this->amount; /** * Implementing the below code to work with AR office in an effort * to have student payments only apply to the term that they select * within the online billing app. */ $term_code = $record_template['term_code'] ?: $this->term_code; $this->term_payment($term_code, $record_template, $this->amount); return $this; //------------Currently Ignoring Everything Below Here--------------- // find the earliest unsatisfied term $early_term = $this->person->bill->earliest_unsatisfied_term; $only_term_types = array(); $pre_apply = array(); $skip = array(); // populate $only_term_types via filter if filter exists and level has been set if (\PSU::has_filter('transaction_term_types') && $this->level) { $only_term_types = \PSU::apply_filters('transaction_term_types', $only_term_types, $this->level); } //end if // populate $skip via filter if filter exists if (\PSU::has_filter('transaction_term_skip') && $this->level) { $skip = \PSU::apply_filters('transaction_term_skip', $skip, $this->person->bill, $this->level); } //end if // populate $pre_apply via filter if filter is set if (\PSU::has_filter('transaction_split_pre_apply')) { $pre_apply = \PSU::apply_filters('transaction_split_pre_apply', $pre_apply, $this->person->bill); // loop over terms to pre-apply payments to foreach ($pre_apply as $term => $value) { $this->term_payment($term, $record_template, $value); } //end while } //end if $found_term = false; // loop over term balances foreach ((array) $this->person->bill->all_term_balances as $term => $value) { // find the current term if (!$found_term && $term != $early_term) { continue; } elseif ($term == $early_term) { $found_term = true; } elseif ($value <= 0) { continue; } // if there are values in $only_term_types then we only want to put // transactions in specific terms. If this term is not in the list // of allowable terms, then skip it. if (!empty($only_term_types)) { if (!in_array(\PSU\Student::term_type($term), $only_term_types)) { continue; } //end if } //end if // if there are values in $skip then we want to be sure // we skip it. if (!empty($skip)) { if (in_array($term, $skip)) { continue; } //end if } //end if $this->term_payment($term, $record_template, $value); } //end while // if there is STILL money needing to be posted, prep a dummy term and post if ($this->amount_paid_remaining > 0) { // We don't want to find old activity, and if we are here, we have applied funds to the current ter, // Target the next term specified by the bursar otherwise fall back to this term $term = \PSU\AR::bursar_future_term(strtolower($this->level)) ?: $this->person->bill->last_balance_term(); $payment = $record_template; $payment['term_code'] = $term; $payment['amount'] = $this->amount_paid_remaining; $this->amount_paid_remaining = 0; $this->add_entry($payment); } //end if return $this; }
/** * parse resultset for records * * @param $rset \b ADOdbRecordSet * @param $key \b key to index the record of of * @param $id \b id of the registered sql statement. * If this id is set, for each $row, the psusql_{id} filter * is applied if the filter exists in the registry */ public function parse_results(ADORecordset $rset, $key = null, $id = null) { $records = array(); foreach ($rset as $row) { if ($id) { if (PSU::has_filter('psusql_' . $id . '_parse_results')) { $row = PSU::apply_filters('psusql_' . $id . '_parse_results', $row); } //end if } //end if if ($key) { $records[$row[$key]] = $row; } else { $records[] = $row; } //end else } //end foreach if (PSU::has_filter('psusql_' . $id . '_records')) { $records = PSU::apply_filters('psusql_' . $id . '_records', $records); } //end if $this->count = count($records); return $records; }
/** * Return the url keyword information. * * @param $keyword the target keyword */ function getKeywordInfo($keyword, $domain = 'go.plymouth.edu') { $domain = PSU::apply_filters('go_hostname', $domain); if ($keyword == 'main/404html') { $keyword = $this->cleanKeyword(str_replace('/go/', '', $_SERVER['REQUEST_URI'])); return $this->getKeywordInfo($keyword, $domain); } //end if // at minimum, we examine a cleaned keyword $keyword = $this->cleanKeyword($keyword); $keyword_orig = $keyword; $keyword_long = $keyword; // long version, not exploded into an array $key_array = explode('/', $keyword); $keyword = $key_array[0]; $args = array($domain); $keywords = array($keyword); if ($keyword_long != $keyword) { // look for the full keyword itself $keywords[] = $keyword_long; } array_walk($keywords, function (&$item, $key) { $item = PSU::db('go')->qstr($item); }); $keywords = implode(', ', $keywords); $info = PSU::db('go')->GetRow("\r\n\t\t\tSELECT\r\n\t\t\t\td.url, k.id AS keyword_id,\r\n\t\t\t\td.sso_url,\r\n\t\t\t\td.id AS destination_id,\r\n\t\t\t\tk.is_ambiguous,\r\n\t\t\t\tk.dynamic_destination_id,\r\n\t\t\t\tk.keyword,\r\n\t\t\t\tdom.domain AS go_domain,\r\n\t\t\t\td.pidm_required\r\n\t\t\tFROM\r\n\t\t\t\tkeyword k LEFT JOIN\r\n\t\t\t\tdomain dom ON k.domain_id = dom.id LEFT JOIN\r\n\t\t\t\tdestination d ON k.destination_id=d.id\r\n\t\t\tWHERE\r\n\t\t\t\tk.keyword IN ( {$keywords} ) AND\r\n\t\t\t\tdom.domain = ?\r\n\t\t\tORDER BY LENGTH( k.keyword ) DESC\r\n\t\t", $args); // if we matched on a keyword that contained forward slash (/)... if ($keyword != $keyword_long && $info['keyword'] == $keyword_long) { // ... skip all the query string stuff return $info; } $info['keyword'] = $keyword; // append variables to the URLs if ($info['destination_id'] && count($key_array) > 1) { unset($key_array[0]); $url = ''; if ($info['dynamic_destination_id']) { $url = $db->GetOne("SELECT url FROM destination WHERE id='{$info['dynamic_destination_id']}'"); } else { $url = $info['url']; } // end else $info['dyn_url'] = ''; $info['dyn_url'] = $this->addVarsToURL($url, $key_array); if (strpos($info['dyn_url'], '$') !== false) { $info['dyn_url'] = ''; } //end if } //end if $info['url'] = $info['dyn_url'] ? $info['dyn_url'] : $info['url']; return $info; }