Mid Term Adjustments Journeys
Here are the journeys and scripts used for the Mid Term Adjustments flow:
The following journey is available for Mid Term Adjustments:
This custom driven flow helps you to search and find a policy in order to start a new MTA (Mid-Term Adjustment) request. On Step 1 of the form driven flow, you can find the following actions:
-
Search button (#btnSearch) on click: This function gathers all the data added on the search fields and performs a search based on it with the help of the FTOS_INSPA_ChangePolicyRequestSearchMTA server automation script.
-
Reset button (#btnReset) on click: This function reset/empty all the fields from the form.
-
Choose Option button (.btn-option) on click: This function calls the FTOS_INSPA_ChangePolicyRequestInsertMTA server automation script with an object as parameter in order to insert a new MTA request.
Object parameters:
-
policyId - (string) - The policy ID.
-
paymentTypeId - (string) - The payment type ID.
-
paymentFrequencyId - (string) - The payment frequency ID.
The following function is used:
generateCutomGrid();
- This function generates the table for the search results from the #btnSearch function presented above.
Input parameters:
-
viewId - (string) - The ID (CSS ID) for the table.
-
viewDataSource - (Array) - An array with the results from the #btnSearch function.
-
viewColumns - (variable) - The type of columns for the DxDataGrid. This can have multiple options. For more information about this, please refer to DevExtreme columns configuration.
Output parameters:
-
N/A
The following functions are available for this journey:
formScope.hideButtonsAndSections()
: formScope function that hide Buttons and sections based on business conditions;
Input parameters:
-
N/A
Output parameters:
-
N/A
formScope.setRequiredAttributes()
: formScope function that sets some attributes required;
Input parameters:
-
N/A
Output parameters:
-
N/A
formScope.setChangePolicyAttributesReadOnly()
: formScope function that sets some attributes from the MTA read only;
Input parameters:
-
N/A
Output parameters:
-
N/A
formScope.setPolicyAttributesReadOnly()
: formScope function that sets some virtual attributes from the Policy read only;
Input parameters
-
N/A
Output parameters
-
N/A
setOptionSetItems(paramX, resource)
: formScope function that sets some virtual attributes from the Policy read only;
Input parameters:
-
paramX - array with optionsetsItems that we need to display
-
resource - an html id
Output parameters:
-
N/A
The following server automation scripts are available for Mid Term Adjustments:
This script creates a new change policy request based on the policy ID, the payment frequency ID and the payment type ID. Also, to create a new change policy request, this script runs 2 database queries (Fluent query) to perform the following:
-
The first query search/checks the database to make sure that there is no other change policy requestin Draft or Registered status. If yes, it throws an error with the queried change policy request number.
-
The second query is not used for the moment.
This script performs a search/query to retrieve the policies for the MTA - Search form.
This script creates records into the FTOS_INSPA_ChangePolicyCoverage
entity for the current MTA. The insurance items existing on the policy for which the MTA is inserted are added with a true onPolicy flag, and the remaining items from the product are added with a false onPolicy flag.
This script updates the premium amount for the Change Policy Coverage entries from the Change Policy Request form (MTA_ChangePolicyRequest - page 0/Step 1) and sets the attribute coverageValidated to false. Also, this script uses the getClientAge();
function which is presented into the MTA_GetPriceHelper server script library. The following functions are used:
getPaymentFrequency();
This function performs a query to return the new payment frequency for the current change policy request.
Input parameters:
-
cprId - (string) - The change policy request ID.
Output parameters: an object with the following props:
-
changeReqName.PolicyId - (string) - Policy ID associated with the queried Change policy request.
-
changeReqName.FrequencyValidated - (bool) - True or false.
-
payFreqName.Name - (string) - The name of the current payment frequency.
-
newPayFreqName.Name - (string) - The name of the new payment frequency.
insuranceProductItemId();
This function returns the insurance product item name based on the insurance product item ID.
Input parameters:
-
ipiId - (string) - The insurance product item ID.
Output parameters:
-
ipiName.Name - (string) - The insurance product item name.
getInsuranceProductItems();
This function returns different values based on the Policy ID and Change Policy Coverage ID.
Input parameters:
-
id - (string) - Policy id
-
cpcId - (string) - Change policy coverage id
Output parameters: an object with the following props:
-
FTOS_IP_InsuranceProduct.InsuranceProductCode - (string) - The insurance product code
-
FTOS_IP_InsuranceProductItem.Code - (string) - The insurance product item code
-
FTOS_IP_InsuranceType.Name - (string) - The insurance type name
changePolicyPaymentType();
This function runs for each result from getInsuranceProductItems();
function and calls the FTOS_IP_PremiumAmountAPI
script in order to update the premium amount.
Input parameters:
-
mandate - (object) - An object with the following data:
-
insuranceTypeName - (string) - Insurance type name
-
productCode - (string) - Insurance product code
-
insuranceProductItemDetails - (array) - An array with one or more objects>The object/s contains the following props:
-
code - (string) - Insurance product item code
-
calculationDetails - (object) - The object contains the following props:
-
coverage - (string) - Insurance product item name
-
frequency - (string) - This prop can be:
-
paymentFrequency optionSet name - if the frequencyValidated attribute is null
-
newPaymentFrequency optionSet name - if the frequencyValidated attribute is validated(true)
-
-
age - (number) - The insured client age
-
sumInsured - (number) - The insured amount
-
-
-
Output parameters: there can be 3 different outputs:
-
Error - If some of the data sent are incomplete or wrong.
-
Error - If the authentication details are wrong or missing.
-
Success - If the API call is successful, it returns the new premium amount and makes an update on the
FTOS_INSPA_ChangePolicyCoverage
entity with the new premium amount.
This script receives an ID through context data and a string describing the type of the action desired as follows:
-
for type “remove”: it removes the coverage requested through the ID from the new policy coverages.
-
for type “add”: it adds the coverage requested through the id to the new policy coverages.
-
for type “validateCoverage”: it changes the status of all new policy coverages to Validated.
This script contains all the actions that are made on buttons on MTA flow, ex: Cancel, decline, accepted, register etc. The following functions are used:
function getFrequencyUpdatedItems(policyId, ipiId)
: function that gets some informations from the FTOS_INSPA_Policy
and FTOS_INSPA_PolicyInsuranceItem
entities.
Input parameters:
-
policyId- unique identifier of the
FTOS_INSPA_Policy
entity. -
ipiId - unique identifier of the
FTOS_INSPA_PolicyInsuranceItem
entity.
Output parameters:
-
fluentQuery -> an object with the results.
getProductItemsForFrequency(newPolId)
: function that gets the Items from witch the frequency changes.
Input parameters:
-
newPolId - unique identifier of FTOS_INSPA_Policy entity, but the new version of it.
Output parameters:
-
query - an object with the results.
queryRegisterCoverage(entityId)
: function that gets the registered coverages from the FTOS_INSPA_ChangePolicyRequest
entity.
Input parameters:
-
entityId - unique identifier of
FTOS_INSPA_ChangePolicyRequest
entity.
Output parameters:
-
query - an object with the results.
getInfoForAddProductItem(policyId)
: function that gets informations from more entities, function that is necessary when adding the items on the new version of policy.
Input parameters:
-
policyId - unique identifier of FTOS_INSPA_Policy entityt.
Output parameters:
-
query - an object with the results.
addProductItemMTA(insertValues)
: the function gets all the necessary details of the product item ready to be added on the policy. After manipulating some data received on a policy generation, the function inserts a new product item in the FTOS_INSPA_PolicyInsuranceItem
entity.
Input parameters:
-
insertValues - object containing all the required details for finding and adding a new product item on the new policy.
Output parameters:
-
N/A.
getInstallmentsOnPolicy(policyId)
: function that gets the installments from a specified Policy.
Input parameters:
-
policyId - unique identifier of the
FTOS_INSPA_Policy
entity.
Output parameters:
-
ids - array with unique identifiers of
FTOS_INSQB_PaymentScheduleDetail
entity.
updateInstallmentsOnPolicy(newPolId, updatedPolicyPremiumAmount)
: function that updates the installmentAmount on the FTOS_INSQB_PaymentScheduleDetail
entity.
Input parameters:
-
newPolId - unique identifier of the
FTOS_INSPA_Policy
entity, but the new version of it. -
updatedPolicyPremiumAmount - the calculated premium amount.
Output parameters:
-
N/A.
getInitialPremiumAmount(policyId, insuranceItemId)
: function that gets the premium amount from the FTOS_INSPA_Policy
entity.
Input parameters:
-
policyId - uniquei dentifier of the
FTOS_INSPA_Policy
entity. -
insuranceItemId - unique identifier of
FTOS_INSPA_PolicyInsuranceItem
entity.
Output parameters:
-
initialPremium - the premium.
Server script that fills all the custom virtual attributes on MTA process. The following functionis used:
function getPolicyInfo(policyId)
: function that gets the informations from the FTOS_INSPA_Policy
entity.
Input parameters:
-
policyId - unique identifier of FTOS_INSPA_Policy entity.
Output parameters:
-
fetch - object with the results.
This script sets a new number for a new change policy request based on the PolicyChangeRequest sequencer.
This script is used to fetch/render the new version of the policy into MTA_ChangePolicyRequest/Section Step2/afterGenerate.js.
This script is used in order to return the mta for policy/ masterpolicy in the initial status if some actions were made on the MTA and the uw rules not passed.
This script is automatically triggered in order to change the due date on the policies that belongs under a master policy.
getInstallmentInfo(mpId)
: This function is used to retrieve policy installment/s info based on the master policy id.
Input parameters:
-
mpId - (string) - The master policy id
Output parameters: An array with one or multiple objects that contains the following parameters:
-
DueDate - (invariant date) - The policy installment due date
-
FTOSINSQBPaymentScheduleDetailId - (string) - The payment schedule detail id
The following libraries are available for Mid Term Adjustments.
This library contains different functions that help calculate the new premium amount.
getClientAge();
: this function returns the insured client age based on the Change Policy Request ID.
Input parameters:
-
cprId - (string) - Change policy request ID.
Output parameters:
-
accountAge - (number) - The insured client age or 0 if the client does not have a DOB set in the db.
getPaymentFrequency();
: this function returns the payment frequency name based on the payment frequency ID.
Input parameters:
-
payFreqId - (string) - Payment frequency ID.
Output parameters:
-
Payment frequency name or null if the ID does not exists.
getInsuranceProductItems();
: this function returns different attributes from the FTOS_INSPA_ChangePolicyCoverage
entity.
Input parameters:
-
cprId - (string) - Change policy request ID.
Output parameters: an object with the following data:
-
cpcData.FTOSINSPAChangePolicyCoverageId - (string) - Change policy coverage ID.
-
cpcData.CoverageTypeId - (string) - Coverage type ID.
-
cpcData.InsuranceProductItemId - (string) - Insurance product item iID.
-
cpcData.InsuredAmount - (numeric) - Insured amount.
getUpdatedPrices();
: this function updates/recalculate the premium amount based on an object.
Input parameters:
-
queriedObject - (object) - This object contains the following props:
-
insuranceTypeName - (string) - Insurance type name.
-
productCode - (string) - Insurance product code.
-
insuranceProductItemDetails - (array) - An array with one or more objects. The object/s contains the following props:
-
code - (string) - Insurance product item code.
-
calculationDetails - (object) - The object contains the following props:
-
coverage - (string) - Insurance product item name.
-
frequency - (string) - This prop can be:
-
paymentFrequency optionSet name - if the frequencyValidated attribute is null.
-
newPaymentFrequency optionSet name - if the frequencyValidated attribute is validated (true).
-
-
age - (number) - The insured client age.
-
sumInsured - (number) - The insured amount.
-
-
-
Output parameters: there can be 3 outputs:
-
Error - If some of the data sent are incomplete or wrong.
-
Error - If the authentication details are wrong or missing.
-
Success - If the API call is successful, returns the new premium amount.
Library that contains different functions that helps on MTA process.
function getAlterationTypes(policyId)
: function that gets the alteration types for a policy.
Input parameters:
-
policyId- unique identifier of the
FTOS_INSPA_Policy
entity.
Output parameters:
-
fetch- object with the results.
function getPolicyInsuranceItems(policyId)
: function that gets the insurance items for a policy.
Input parameters:
-
policyId - unique identifier of the
FTOS_INSPA_Policy
entity.
Output parameters:
-
query- object with the results.
This library contains functions for the Underwriting process.
(General) functions:
getUwType(productCode);
: This function gets the name of the product performing a query using the productCode.
Input parameters:
-
productCode- (string) - The product code from the FTOS_IP_InsuranceProduct entity;
Output parameters:
-
query - the result of the search above;
callFormulaStructure(params);
: This function calls the FTOS_IP_GetProductFormulasStructuresAPI
API.
Input parameters:
-
params- (obj) - The parameters the API need;
Output parameters:
-
N/A
callUwRules(params);
: This function calls the FTOS_IP_GetUWRulesResultAPI
API.
Input parameters:
-
params- (obj) - The parameters the API need;
Output parameters:
-
N/A
getPolicyInfoByPolicyId(policyId);
: This function gets the information of the Policy byperforming a query using the policyId.
Input parameters:
-
policyId- (guid) - Id from the FTOS_INSPA_Policy entity;
Output parameters:
-
query - the result of the search above;
getUwRulesInput(productCode, contextType, itemCode, policyId, policyNo);
: This function gets input params that are needed from the callUwRules() function.
Input parameters:
-
productCode- (string) - The product code from the FTOS_IP_InsuranceProduct entity;
-
contextType - string - the type of the context;
-
itemCode - (string) - the item code;
-
policyId - (guid) - Id from the FTOS_INSPA_Policy entity;
-
policyNo - (string) - Policy No from FTOS_INSPA_Policy entity;
Output parameters:
-
apiParams- (obj) - param for callUwRules() function;
getUWResultPassed(policyId);
: This function calls the uw function whith params above mentioned to check if the rules passed or not.
Input parameters:
-
policyId- (guid) - Id from the FTOS_INSPA_Policy entity;
Output parameters:
-
uWRulesPassed- (bool) - true/false;
getDataMappingPolicyUW(productCode, itemCode);
: This function performs a query to obtain the data mapping needen for getUwRulesInput() function.
Input parameters:
-
productCode- (string) - The product code from the FTOS_IP_InsuranceProduct entity;
-
itemCode - (string) - the item code;
Output parameters:
-
query - the result of the query above
This library stores the functions for the get premium amount process.
(General) functions:
getCoverageMapping();
: This function gets the mapping for the Coverages.
Input parameters:
-
N/A
Output parameters:
-
CoverageMapping- (json);
getPremiumAmountAPIParams(params, policyId, coverageUpdate);
: This function gets input params that are needed from the calculatedSum() function.
Input parameters:
-
policyId- (guid) - Id from the FTOS_INSPA_Policy entity;
-
params - (obj) - The parameters the API need
-
coverageUpdate - (bool) - true/false;
Output parameters:
-
result- the result of the search above;
getCoverageAttributeValue(coverageAttribute, policyId, itemCode);
: This function performs a query using above params to get the FTOS_INSPA_ChangePolicyRequest
id and the FTOS_IP_InsuranceProductItem
id.
Input parameters:
-
coverageAttribute - coberageAttribute from the coverage mapping;
-
policyId - (guid) - Id from the FTOS_INSPA_Policy entity;
-
itemCode - itemCode - (string) - the item code;
Output parameters:
-
fetchResult- (obj);
getDataMappingPolicy(productCode, itemCode);
: This function gets data mapping for specified Product performing a query to the Data Mapping entity;
Input parameters:
-
productCode- (string) - The product code from the FTOS_IP_InsuranceProduct entity;
-
itemCode - itemCode - (string) - the item code;
Output parameters:
-
query- (obj) - result of the query above;
getCalculationDetailsKey(input, segmentAttribute)
: This function gets the key that needs to be replaced.
Input parameters:
-
input- (json) - input from data mapping;
-
segmentAttribute- (string) - attribute from the mapping;
Output parameters:
-
keyToBeReplaced- (string);
getTariffType(productCode)
: This function performs a query in order to find the tariff Name.
Input parameters:
-
productCode- (string) - The product code from the FTOS_IP_InsuranceProduct entity;
Output parameters:
-
query- (string) - tariff Name;
getProductCodeFromPolicy(policyId)
: This function performs a query to obtain the productCode from the Insurance Product entity.
Input parameters:
-
policyId - (guid) - Id from the FTOS_INSPA_Policy entity;
Output parameters:
-
query - (string) - Insurance product code;
getInsuranceTypeFromPolicy(policyId)
: This function performs a query to obtain the insurance type Name from the Insurance Type Entity;
Input parameters:
-
policyId - (guid) - Id from the FTOS_INSPA_Policy entity;
Output parameters:
-
query- (string) - Insurance Type Name;
callPremiumAmountAPI(params)
This function calls the FTOS_IP_PremiumAmountAPI
API.
Input parameters:
-
params - (obj) - Params that the API above needs
Output parameters:
-
N/A
getPremiumAmount(params, policyId, coverageUpdate)
: This function calls the callPremiumAmountAPI() function to get the Data from the API.
Input parameters:
-
params - (obj) - Params that the FTOS_IP_PremiumAmountAPI needs;
-
policyId - (guid)- Id from the FTOS_INSPA_Policy entity;
-
coverageUpdate - (bool) - true/false;
Output parameters:
-
Data - obj - data from the FTOS_IP_PremiumAmountAPI api;
getCardsForMTA(params, policyId)
: This function get the cards from MTA .
Input parameters:
-
params - (obj) - Params;
-
policyId - (guid)- Id from the FTOS_INSPA_Policy entity;
Output parameters:
-
result- obj - result of the function;