diff --git a/openfisca_tunisia_pension/parameters/retraite/rsna/bareme_annuite.yaml b/openfisca_tunisia_pension/parameters/retraite/rsna/bareme_annuite.yaml new file mode 100644 index 0000000..2499bd5 --- /dev/null +++ b/openfisca_tunisia_pension/parameters/retraite/rsna/bareme_annuite.yaml @@ -0,0 +1,23 @@ +description: Taux d'annuité par trimestre validé +brackets: +- threshold: + 1960-01-01: + value: 0 + rate: + 1960-01-01: + value: 0.01 +- threshold: + 1960-01-01: + value: 40 + rate: + 1960-01-01: + value: 0.005 +- threshold: + 1960-01-01: + value: 160 + rate: + 1960-01-01: + value: 0 +metadata: + threshold_unit: trimestre + rate_unit: /1 diff --git a/openfisca_tunisia_pension/regimes/regime.py b/openfisca_tunisia_pension/regimes/regime.py index a2e1109..0fdb049 100644 --- a/openfisca_tunisia_pension/regimes/regime.py +++ b/openfisca_tunisia_pension/regimes/regime.py @@ -228,10 +228,10 @@ class taux_de_liquidation(Variable): label = 'Taux de liquidation de la pension' def formula(individu, period, parameters): - decote = individu('regime_name_decote', period) - surcote = individu('regime_name_surcote', period) - taux_plein = parameters(period).regime_name.taux_plein.taux_plein - return taux_plein * (1 - decote + surcote) + bareme_annuite = parameters(period).retraite.regime_name.bareme_annuite + duree_assurance = individu('regime_name_duree_assurance', period) + taux_annuite = bareme_annuite.calc(duree_assurance) + return taux_annuite # def revalorise(variable_31_decembre_annee_precedente, variable_originale, annee_de_liquidation, revalorisation, period): diff --git a/openfisca_tunisia_pension/variables/cnrps.py b/openfisca_tunisia_pension/variables/cnrps.py index a1dafc8..218c716 100644 --- a/openfisca_tunisia_pension/variables/cnrps.py +++ b/openfisca_tunisia_pension/variables/cnrps.py @@ -191,7 +191,7 @@ class cnrps_taux_de_liquidation(Variable): label = 'Taux de liquidation de la pension' def formula(individu, period, parameters): - decote = individu('cnrps_decote', period) - surcote = individu('cnrps_surcote', period) - taux_plein = parameters(period).cnrps.taux_plein.taux_plein - return taux_plein * (1 - decote + surcote) \ No newline at end of file + bareme_annuite = parameters(period).retraite.cnrps.bareme_annuite + duree_assurance = individu('cnrps_duree_assurance', period) + taux_annuite = bareme_annuite.calc(duree_assurance) + return taux_annuite \ No newline at end of file diff --git a/openfisca_tunisia_pension/variables/rsa.py b/openfisca_tunisia_pension/variables/rsa.py index 5543fb7..eb0d422 100644 --- a/openfisca_tunisia_pension/variables/rsa.py +++ b/openfisca_tunisia_pension/variables/rsa.py @@ -187,7 +187,7 @@ class rsa_taux_de_liquidation(Variable): label = 'Taux de liquidation de la pension' def formula(individu, period, parameters): - decote = individu('rsa_decote', period) - surcote = individu('rsa_surcote', period) - taux_plein = parameters(period).rsa.taux_plein.taux_plein - return taux_plein * (1 - decote + surcote) \ No newline at end of file + bareme_annuite = parameters(period).retraite.rsa.bareme_annuite + duree_assurance = individu('rsa_duree_assurance', period) + taux_annuite = bareme_annuite.calc(duree_assurance) + return taux_annuite \ No newline at end of file diff --git a/openfisca_tunisia_pension/variables/rsna.py b/openfisca_tunisia_pension/variables/rsna.py index 21cdc10..52d610b 100644 --- a/openfisca_tunisia_pension/variables/rsna.py +++ b/openfisca_tunisia_pension/variables/rsna.py @@ -187,7 +187,7 @@ class rsna_taux_de_liquidation(Variable): label = 'Taux de liquidation de la pension' def formula(individu, period, parameters): - decote = individu('rsna_decote', period) - surcote = individu('rsna_surcote', period) - taux_plein = parameters(period).rsna.taux_plein.taux_plein - return taux_plein * (1 - decote + surcote) \ No newline at end of file + bareme_annuite = parameters(period).retraite.rsna.bareme_annuite + duree_assurance = individu('rsna_duree_assurance', period) + taux_annuite = bareme_annuite.calc(duree_assurance) + return taux_annuite \ No newline at end of file diff --git a/tests/formulas/cnrps/cnrps_pension.yaml b/tests/formulas/cnrps/cnrps_pension.yaml new file mode 100644 index 0000000..dd6e584 --- /dev/null +++ b/tests/formulas/cnrps/cnrps_pension.yaml @@ -0,0 +1,55 @@ +- name: "5 ans de trimetres CNRPS" + period: 2011 + absolute_error_margin: 0.5 + input: + cnrps_duree_assurance: 5 * 4 + output: + cnrps_taux_de_liquidation: .1 + +- name: "10 ans de trimetres CNRPS" + period: 2011 + absolute_error_margin: 0.5 + input: + cnrps_duree_assurance: 10 * 4 + output: + cnrps_taux_de_liquidation: .2 + +- name: "13 ans de trimetres CNRPS" + period: 2011 + absolute_error_margin: 0.5 + input: + cnrps_duree_assurance: 13 * 4 + output: + cnrps_taux_de_liquidation: .2 + .09 + +- name: "21 ans de trimetres CNRPS" + period: 2011 + absolute_error_margin: 0.5 + input: + cnrps_duree_assurance: 21 * 4 + output: + cnrps_taux_de_liquidation: .5 + .02 + +- name: "31 ans de trimetres CNRPS" + period: 2011 + absolute_error_margin: 0.5 + input: + cnrps_duree_assurance: 31 * 4 + output: + cnrps_taux_de_liquidation: .5 + .22 + +- name: "40 ans de trimetres CNRPS" + period: 2011 + absolute_error_margin: 0.5 + input: + cnrps_duree_assurance: 40 * 4 + output: + cnrps_taux_de_liquidation: .9 + +- name: "50 ans de trimetres CNRPS" + period: 2011 + absolute_error_margin: 0.5 + input: + cnrps_duree_assurance: 50 * 4 + output: + cnrps_taux_de_liquidation: .9