Commit ee167589 by Damien Moulard

WIP: create new method to distribute TAV allowance, based on household

parent 61220dcf
...@@ -45,6 +45,9 @@ class TAVCotisationUtils ...@@ -45,6 +45,9 @@ class TAVCotisationUtils
} }
/** /**
* First method to calculate allowance:
* according to a contribution rate defined in user's profile (ProfilDeCotisation).
*
* Apply the cotisation profile rate to the amount paid * Apply the cotisation profile rate to the amount paid
* and register the complement as a new flux (only if rate != 1) * and register the complement as a new flux (only if rate != 1)
* *
...@@ -95,6 +98,42 @@ class TAVCotisationUtils ...@@ -95,6 +98,42 @@ class TAVCotisationUtils
} }
/** /**
* Second method to calculate allowance:
* allowance based on user's household.
*
* Rules are as follow:
* - 150 emlc for the first person in user's household
* - 75 emlc for each other
* - in case of shared custody for a dependent child, apply a percentage on the "75 emlc" amount for this child:
* 25%, 50% or 75% depending on the shared custody arrangement
*
* Once the full amount is calculated, cap user's balance.
* User account balance is capped at twice the amount previously calculated.
*/
public function applyAllowanceAccordingToHousehold() {
$profile = $flux->getDestinataire()->getProfilDeCotisation();
$cotisationAmount = $profile->getMontant();
$mlcAllowanceAmount = 150;
// $mlcAllowanceAmount += 75 * NombreDAdultesACharge;
// for each enfant à charge
// $childAllowanceAmount = 75;
// if (custody != null)
// $childAllowanceAmount = $childAllowanceAmount * custody
//
// $mlcAllowanceAmount += $childAllowanceAmount;
// // Apply cap
// $currentBalance = UserCurrentBalance;
// if ($currentBalance + $mlcAllowanceAmount >= 2 * $mlcAllowanceAmount)
// $capped = true
// $mlcAllowanceAmount = 2 * $mlcAllowanceAmount - $currentBalance // give difference to reach max balance
// create flux
}
/**
* Get the last cotisation of an adhérent * Get the last cotisation of an adhérent
* *
* @param Adherent $adherent * @param Adherent $adherent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment