public function buildTransactionHistory($purchases, $start_ts = false) { if (!$start_ts) { $start_ts = $this->start_ts; } $this->has_eclassroom = false; $this->total_gc = 0; $this->total_eclassroom = 0; $this->gross_income = 0; $this->net_income = 0; $this->owner_expenses = 0; $this->transaction_history = new GcrTransactionHistory($this->institution); if (!empty($purchases)) { foreach ($purchases as $purchase) { $txns = ''; if ($purchase->isRecurring()) { $txns = $purchase->getPaypalTransactions('Completed', $start_ts, $this->end_ts); $refunds = $purchase->getPaypalTransactions('Refunded', $start_ts, $this->end_ts); } else { if ($purchase->isEclassroomCourse()) { $this->has_eclassroom = true; } $refunds = GcrPaypalTable::getRefunds($purchase->getProfileId(), $start_ts, $this->end_ts); } $this->transaction_history->add(new GcrTransaction($purchase, $txns, $refunds)); } } $this->transaction_history->buildItems(); }
public function getRefunds($start_ts = null, $end_ts = null) { return GcrPaypalTable::getRefunds($this->txn_id, $start_ts, $end_ts); }