public function calculateTotalInterest(Loan $loan) { if ($loan->getInstallmentPeriod() == 0) { $totalInterest = $loan->getNativeDisbursedAmount() * ($loan->getInterestRate() / 100) * ($loan->getInstallmentCount() / 12); } else { $totalInterest = $loan->getNativeDisbursedAmount() * ($loan->getInterestRate() / 100) * ($loan->getInstallmentCount() / 52); } //TODO. change nativeAmount to USD return $totalInterest; }