Class: Formulas::StudentLoanRepayment::FixRepaymentPerPeriod

Inherits:
RepaymentBase
  • Object
show all
Defined in:
lib/formulas/student_loan_repayment/fix_repayment_per_period.rb

Constant Summary collapse

FIX_RATE =
0.12
DEFAULT_THRESHOLD =
{
  weekly: [390, 52],
  fortnightly: [780, 26],
  four_weeks: [1560, 13],
  monthly: [1690, 12],
  annually: [20280, 1],
}

Instance Method Summary collapse

Methods inherited from RepaymentBase

#initialize

Constructor Details

This class inherits a constructor from Formulas::StudentLoanRepayment::RepaymentBase

Instance Method Details

#repaymentObject



22
23
24
25
26
# File 'lib/formulas/student_loan_repayment/fix_repayment_per_period.rb', line 22

def repayment
  selected_base = @repayment_threshold[@salary.frequency]
  less_base_cost = @salary.pay - selected_base[0]
  ((FIX_RATE * less_base_cost * selected_base[1]) / 12).round(2)
end