Module: SingaporeCPFCalculator
- Defined in:
- lib/singapore_cpf_calculator.rb,
lib/singapore_cpf_calculator/version.rb,
lib/singapore_cpf_calculator/age_group.rb,
lib/singapore_cpf_calculator/year_2014.rb,
lib/singapore_cpf_calculator/year_2015.rb,
lib/singapore_cpf_calculator/year_2016.rb,
lib/singapore_cpf_calculator/before_spr.rb,
lib/singapore_cpf_calculator/spr_status.rb,
lib/singapore_cpf_calculator/year_common.rb,
lib/singapore_cpf_calculator/requirements.rb,
lib/singapore_cpf_calculator/year_2014/base.rb,
lib/singapore_cpf_calculator/year_2015/base.rb,
lib/singapore_cpf_calculator/year_2016/base.rb,
lib/singapore_cpf_calculator/base_calculator.rb,
lib/singapore_cpf_calculator/spr_1_fg_common.rb,
lib/singapore_cpf_calculator/spr_1_gg_common.rb,
lib/singapore_cpf_calculator/spr_2_fg_common.rb,
lib/singapore_cpf_calculator/spr_2_gg_common.rb,
lib/singapore_cpf_calculator/cpf_contribution.rb,
lib/singapore_cpf_calculator/year_2014/spr_1_fg.rb,
lib/singapore_cpf_calculator/year_2014/spr_1_gg.rb,
lib/singapore_cpf_calculator/year_2014/spr_2_fg.rb,
lib/singapore_cpf_calculator/year_2014/spr_2_gg.rb,
lib/singapore_cpf_calculator/year_2015/spr_1_fg.rb,
lib/singapore_cpf_calculator/year_2015/spr_1_gg.rb,
lib/singapore_cpf_calculator/year_2015/spr_2_fg.rb,
lib/singapore_cpf_calculator/year_2015/spr_2_gg.rb,
lib/singapore_cpf_calculator/year_2016/spr_1_fg.rb,
lib/singapore_cpf_calculator/year_2016/spr_1_gg.rb,
lib/singapore_cpf_calculator/year_2016/spr_2_fg.rb,
lib/singapore_cpf_calculator/year_2016/spr_2_gg.rb,
lib/singapore_cpf_calculator/citizen_or_spr_3_common.rb,
lib/singapore_cpf_calculator/residency_module_common.rb,
lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3.rb,
lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3.rb,
lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3.rb,
lib/singapore_cpf_calculator/null_contribution_calculator.rb,
lib/singapore_cpf_calculator/requirements/group_above_65_years.rb,
lib/singapore_cpf_calculator/requirements/group_50_years_and_below.rb,
lib/singapore_cpf_calculator/requirements/group_55_years_and_below.rb,
lib/singapore_cpf_calculator/requirements/group_above_50_to_55_years.rb,
lib/singapore_cpf_calculator/requirements/group_above_55_to_60_years.rb,
lib/singapore_cpf_calculator/requirements/group_above_60_to_65_years.rb,
lib/singapore_cpf_calculator/year_2014/spr_1_fg/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_1_gg/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_2_fg/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_2_gg/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_1_fg/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_1_gg/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_2_fg/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_1_fg/age_50_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_1_fg/age_50_to_55_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_1_fg/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_1_fg/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_1_gg/age_50_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_1_gg/age_50_to_55_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_1_gg/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_1_gg/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_2_fg/age_50_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_2_fg/age_50_to_55_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_2_fg/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_2_fg/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_2_gg/age_50_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_2_gg/age_50_to_55_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_2_gg/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/spr_2_gg/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_1_fg/age_50_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_1_fg/age_50_to_55_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_1_fg/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_1_fg/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_1_gg/age_50_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_1_gg/age_50_to_55_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_1_gg/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_1_gg/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_2_fg/age_50_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_2_fg/age_50_to_55_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_2_fg/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_2_fg/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_50_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_50_to_55_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_65_up_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_50_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_50_to_55_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_50_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_50_to_55_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_below_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb,
lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb
Defined Under Namespace
Modules: BeforeSPR, CitizenOrSPR3Common, NullContributionCalculator, Requirements, ResidencyModuleCommon, SPR1FGCommon, SPR1GGCommon, SPR2FGCommon, SPR2GGCommon, Year2014, Year2015, Year2016, YearCommon Classes: AgeGroup, BaseCalculator, CPFContribution, SPRStatus
Constant Summary collapse
- VERSION =
"1.2.0"
Class Method Summary collapse
-
.calculate(date:, birthdate:, residency_status:, spr_start_date: nil, ordinary_wages:, additional_wages:, employee_contribution_type: nil, employer_contribution_type: nil) ⇒ CPFContribution
@example: result = SingaporeCPFCalculator.calculate age: 32, date: Date.new(2014, 11, 15), residency_status: “permanent_resident”, spr_start_date: Date.new(2014, 11, 15), ordinary_wages: 700.00, additional_wages: 252.00, employee_contribution_type: “full”, employer_contribution_type: “full”.
Class Method Details
.calculate(date:, birthdate:, residency_status:, spr_start_date: nil, ordinary_wages:, additional_wages:, employee_contribution_type: nil, employer_contribution_type: nil) ⇒ CPFContribution
@example:
result = SingaporeCPFCalculator.calculate age: 32,
date: Date.new(2014, 11, 15),
residency_status: "permanent_resident",
spr_start_date: Date.new(2014, 11, 15),
ordinary_wages: 700.00,
additional_wages: 252.00,
employee_contribution_type: "full",
employer_contribution_type: "full"
result # => #<SingaporeCPFCalculator::CPFContribution ...>
result.employee # => 190.00
result.employer # => 153.00
result.total # => 343.00
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/singapore_cpf_calculator.rb', line 39 def calculate( date:, birthdate:, residency_status:, spr_start_date: nil, ordinary_wages:, additional_wages:, employee_contribution_type: nil, employer_contribution_type: nil ) validate_params date: date, employee_contribution_type: employee_contribution_type, employer_contribution_type: employer_contribution_type, residency_status: residency_status, spr_start_date: spr_start_date module_for_date(date). module_for_residency( status: residency_status, spr_start_date: spr_start_date, current_date: date, employee_contribution_type: employee_contribution_type, employer_contribution_type: employer_contribution_type ).calculator_for(date, birthdate: birthdate). calculate ordinary_wages: ordinary_wages, additional_wages: additional_wages end |