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;
 }
Ejemplo n.º 2
0
 /**
  * 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;
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 /**
  * 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;
 }