...
create
run service updateFromPHInsuree
NotifiedAmount = ContractValuation(false)
Contract state will become “Draft”
edit/update
check rights for contract / amendments
check status
if in “draft”/ “request for information“ / “counter“ only the code cannot be changed,
if in “Negotiable” changes are possible only with the authority “Approve/ask for change”
delete
check rights
block deleting contract not in Updateable or Approvable state
submit
check right
RectifiedAmount = ContractValuation(false)
send signal
Contract state will become “Negotiable”
approved
check rights (Approve/ask for change)
send signal
RectifiedAmount = ContractValuation(true)
Contract state will become “Executable”
createContribution
createcontractPayment
counter
check right (Approve/ask for change)
Contract state will become “counter”,
renew
create a new contract that follow the existing active contract (if not yet existing)
amend
check rights
create a new “amendment“ contract from the last amendement
increment Amendment of 1 (i.e. 1st amendment will have 1, 2nd: 2 … )
change status of the previous contract/amendement to 6 “addendum“ (Nice to have: 4 and 6 when addendum approved)
NotifiedAmount = ContractValuation(false)
Amendement state will become “Draft”
ContractValuation(bool save)
create the ContractContributionPlanDetails based on the ContractDetails (nice to have: if periodicity of the contribution plan is smaller that the contract datevalidFrom-datevalidTo then create enough ContractContributionPlanDetails to cover for the contract duration)
if the save param is true
use GetContributionLength to get the dateValidFrom DateValidTo of ContractContributionPlanDetails
createCCPDetails
if amendement: Contract value = value of the contributionplandetails - amount already payed for that contract (contract in state 7-8)
return the total amount
createCCPDetails
Check if there is a policy to cover from the dateValidFrom DateValidTo
if none: create one using the duration from the product with the status “open/ouvert“ 32
if there is one that cover the full duration: use it
if there is one that does NOT cover the full duration: create a new policy to cover the missing part and split the ContractContributionPlanDetails and linked to the matching policies (dates of ContractContributionPlanDetails ) must be within policy dates.
create the matching CCPDetail (C: contract, P: policy CCPD Contract contributionplanDetails)
1 policy: CCPD.DateVaildFrom = C.DateVaildFrom CCPD.DateVaildTo = C.DateVaildFrom + Duration
2 policies:
CCPD1.DateVaildFrom = C.DateVaildFrom & CCPD.DateVaildTo = p1.expiry_date / P2.startdate
CCPD2.DateVaildFrom = p1.expiry_date / P2.startdate & CCPD2.DateVaildTo = C.DateVaildFrom + Duration
createContribution
create the contributions (from openimis-be-contribuiton_py) based on the ContractContributionPlanDetails
createcontractPayment
create a payment that cover all contributions related to the contract
updateFromPHInsuree
if PH is set, Update the ContractDetails based on the PHInsuree
getNegativeAmountAmendement (creditnote)
look for approved contract (amendement) for that PH that have a negative AmountDue
activateContractedPolicies (listen to payment signal)
NICE TO HAVE: this function will call a function for the contributionplan to retrieve the list of insuree dependant that need to be covered by the contact (in addition to get the dependantsinsuree )
Activate the policy related to the contract (create policy insuree for the contract period + grace period)
Contract state will become “effective”,
change status to 7 - Effective
TerminateContract
previous contract of the (DateValidTo) will become “terminated“
PHInsureToCDetatils
Takes a PHinsuree as input and a contractDetails as output where the insuree and the CPB from the PH insureee will be used
This is likely to be called by the mutation to create details from front end when the PH is set
...