/// <summary>
        /// Search the policy deductibles and excess records to see if there are any deductible reason codes 
        /// and attach them to the Transaction context in the form of the new DeductibleReasonCode data class.
        /// </summary>
        /// <param name="pluginHelper">Plugin Helper</param>
        private void LoadReasonCodes(PluginHelper<ClaimHeader> pluginHelper)
        {
            ClaimHeader claimHeader = pluginHelper.Component;
            // Only process if our Policy Product links to an external system (e.g. Genius) 
            // AND a Deductible Reason Code (ClaimHeaderAnalysisCode08) isn't already set
            if (!string.IsNullOrEmpty(claimHeader.PolicyExternalDataSource) && string.IsNullOrEmpty(claimHeader.ClaimHeaderAnalysisCode08))
            {
                ProductClaimDefinition productClaimDef = claimHeader.GetProduct().ProductClaimDefinition;
                // Check if we have Automatic Deductible Processing on the claim header set as Standard
                if (productClaimDef.ClaimHeaderAutomaticDeductibleProcessingMethod == (short)StaticValues.ClaimHeaderAutomaticDeductibleProcessingMethod.StandardClaimHeaderDeductible)
                {
                    IAXAClaimsQuery query = new AXAClaimsQueries();
                    // Get the reason codes for the Generic Data Type of "AND2" (Deductible) using the Policy Reference
                    Dictionary<string, List<CodeRow>> reasonCodes = query.GetPolicyReasonCodes(claimHeader.ProposedPolicyReference, "AND2");
                    if (reasonCodes.Count == 0)
                    {
                        // No Deductible Reason Codes found? Check for reason codes on AD Excess (AND3)
                        reasonCodes = query.GetPolicyReasonCodes(claimHeader.ProposedPolicyReference, "AND3");
                    }

                    if (reasonCodes.Count > 0)
                    {
                        // Add to the transaction context for the claim header.
                        DeductibleReasonCode deductibleReasonCode = new DeductibleReasonCode(reasonCodes);
                        claimHeader.Context.AddAttachedData(deductibleReasonCode);
                        claimHeader.Context.RegisterComponentChange(claimHeader.DataId, Xiap.Framework.Data.BusinessDataState.Modified);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update Excess and  Deductable data from Genius 
        /// </summary>
        /// <param name="claimDetail">claim Detail</param>
        /// <param name="policyCoverageID">Policy Coverage ID</param>
        private void UpdateEDData(ClaimDetail claimDetail, long? policyCoverageID)
        {
            ClaimHeader claimHeader = claimDetail.ClaimHeader;

            // Extract of E&D data will only occur once. If another uncancelled CD already exists which is linked to policy component, then it is assumed that E&D data has already been retrieved
            if (claimHeader.ClaimDetails.Where(a => a.PolicyLinkLevel > 0 && a.DataId != claimDetail.DataId && a.PolicyCoverageID!=null 
                && a.ClaimDetailInternalStatus
                != (short?)StaticValues.ClaimDetailInternalStatus.ClosedCreatedinError && a.ClaimDetailInternalStatus != (short?)StaticValues.ClaimDetailInternalStatus.Finalized).Any())
            {
                return;
            }
            
            ProductClaimDefinition productClaimDef = claimHeader.GetProduct().ProductClaimDefinition;
            if (productClaimDef.ClaimHeaderAutomaticDeductibleProcessingMethod == (short)StaticValues.ClaimHeaderAutomaticDeductibleProcessingMethod.StandardClaimHeaderDeductible
                && claimHeader.PolicyHeaderID > 0)
            {
                if (policyCoverageID > 0)
                {
                    bool updateTerms = false;
                    // Retrieve the policy data onto the claim
                    IAXAClaimsQuery query = new AXAClaimsQueries();
                    IEnumerable<IGenericDataItem> deductibleGDItems = query.GetPolicyDeductibles(policyCoverageID.Value, claimDetail.PolicyLinkLevel.Value, claimHeader.ClaimHeaderAnalysisCode09, claimHeader.ClaimHeaderAnalysisCode04, claimHeader.ClaimHeaderAnalysisCode08, "AND2");
                    if (deductibleGDItems != null && deductibleGDItems.Count() > 0)
                    {
                        // Assumed that ClaimHeader Generic data set for AND4 is set to default on creation
                        string[] policyRefs = new string[5];
                        ClaimGenericDataItem policyRefData = null;
                        if (claimHeader.GenericDataSet != null)
                        {
                            policyRefData = (ClaimGenericDataItem)claimHeader.GenericDataSet.GenericDataItems.Where(a => a.GenericDataTypeCode == "AND4").FirstOrDefault();
                            if (policyRefData != null)
                            {
                                policyRefs = query.GetPolicyReferences(claimHeader.ProposedPolicyReference);
                            }
                        }

                        this.UpdateClaimDeductibleData(claimHeader, deductibleGDItems, policyRefData, policyRefs);
                        updateTerms = true;
                    }

                    IEnumerable<IGenericDataItem> excessGDItems = query.GetPolicyDeductibles(policyCoverageID.Value, claimDetail.PolicyLinkLevel.Value, claimHeader.ClaimHeaderAnalysisCode09, claimHeader.ClaimHeaderAnalysisCode04, claimHeader.ClaimHeaderAnalysisCode08, "AND3");
                    if (excessGDItems != null && excessGDItems.Count() > 0)
                    {
                        this.UpdateClaimADExcessData(claimHeader, excessGDItems);
                        updateTerms = true;
                    }

                    if (updateTerms)
                    {
                        this.UpdateTermsData(claimHeader);
                    }
                    else
                    {
                        if (claimHeader.UWHeader != null && claimHeader.UWHeader.ITerms != null && claimHeader.UWHeader.ITerms.Count > 0)
                        {
                            IUWTerms uwTerm = claimHeader.UWHeader.ITerms.OrderByDescending(x => x.VersionNumber).FirstOrDefault();
                            if (!string.IsNullOrWhiteSpace(uwTerm.MainOriginalCurrencyCode))
                            {
                                claimHeader.ClaimCurrencyCode = uwTerm.MainOriginalCurrencyCode;
                            }
                            else
                            {
                                claimHeader.ClaimCurrencyCode = ClaimConstants.DEFAULT_CURRENCY_CODE;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Update Term Data Claim Currency Code From Genius
 /// </summary>
 /// <param name="claimHeader">Claim Header</param>
 private void UpdateTermsData(ClaimHeader claimHeader)
 {
     IAXAClaimsQuery query = new AXAClaimsQueries();
     IUWTerms term = query.GetlatestTerm(claimHeader.PolicyHeaderID.Value);
     if (term != null && !string.IsNullOrEmpty(term.MainOriginalCurrencyCode))
     {
         claimHeader.ClaimCurrencyCode = term.MainOriginalCurrencyCode;
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Load policy deductibles
        /// </summary>
        /// <param name="claimHeader">Claim Header</param>
        /// <returns>AXA policy excess and deductible data</returns>
        private AXAPolicyEDData LoadPolicyDeductibles(ClaimHeader claimHeader)
        {
           // Initialise to false
           AXAPolicyEDData policyEDData = new AXAPolicyEDData(false, false);
           // If policy is attached or changed, set context level flag to identify whether policy deductibles exist
           ProductClaimDefinition productClaimDef = claimHeader.GetProduct().ProductClaimDefinition;
           if (productClaimDef.ClaimHeaderAutomaticDeductibleProcessingMethod == (short)StaticValues.ClaimHeaderAutomaticDeductibleProcessingMethod.StandardClaimHeaderDeductible)
           {
               IAXAClaimsQuery query = new AXAClaimsQueries();
               bool deductibleExist = false;
               bool EDExcessExist = false;
               query.PolicyDeductiblesExist(claimHeader.PolicyHeaderID.Value, "AND2", "AND3", out deductibleExist, out EDExcessExist);
               policyEDData.DeductiblesExist = deductibleExist;
               policyEDData.EDExcessExist = EDExcessExist;
           }

           return policyEDData;
       }
 private void UpdateTermsData(ClaimHeader claimHeader)
 {
     IAXAClaimsQuery query = new AXAClaimsQueries();
     IUWTerms term = query.GetlatestTerm(claimHeader.PolicyHeaderID.Value);
     claimHeader.ClaimCurrencyCode = ClaimConstants.DEFAULT_CURRENCY_CODE;
     //if (term != null && !string.IsNullOrEmpty(term.MainOriginalCurrencyCode))
     //{
     //    claimHeader.ClaimCurrencyCode = term.MainOriginalCurrencyCode;
     //}
 }
        public bool UpdateEDData(ClaimDetail claimDetail, long? policyCoverageID)
        {
            ClaimHeader claimHeader = claimDetail.ClaimHeader;

            // Extract of E&D data will only occur once. If another uncancelled CD already exists which is linked to policy component, then it is assumed that E&D data has already been retrieved
            if (claimHeader.ClaimDetails.Where(a => a.PolicyLinkLevel > 0 && a.DataId != claimDetail.DataId && a.PolicyCoverageID != null
                && a.ClaimDetailInternalStatus
                != (short?)StaticValues.ClaimDetailInternalStatus.ClosedCreatedinError && a.ClaimDetailInternalStatus != (short?)StaticValues.ClaimDetailInternalStatus.Finalized).Any())
            {
                Logger.WarnFormat("This ClaimDetail does not satisfy the E&D update criteria; there could be an uncancelled CD linked to the Policy component\r\n{0}",
                    JObject.FromObject(new
                    {
                        claimDetail.ClaimHeader.ClaimReference,
                        claimDetail.ClaimDetailReference,
                        PolicyLinkLevel = ((StaticValues.PolicyLinkLevel)claimDetail.PolicyLinkLevel).ToString(),
                        ClaimDetailInternalStatus = ((StaticValues.ClaimDetailInternalStatus)claimDetail.ClaimDetailInternalStatus).ToString()
                    }));
                return false;
            }
            Logger.InfoFormat("Attempting update of Excess and Deductibles values\r\n[\r\n\t{{ClaimRefernece:{0}}}\r\n]", claimHeader.ClaimReference);
            ProductClaimDefinition productClaimDef = claimHeader.GetProduct().ProductClaimDefinition;
            if (productClaimDef.ClaimHeaderAutomaticDeductibleProcessingMethod == (short)StaticValues.ClaimHeaderAutomaticDeductibleProcessingMethod.StandardClaimHeaderDeductible
                && claimHeader.PolicyHeaderID > 0)
            {
                if (policyCoverageID > 0)
                {
                    Logger.InfoFormat("Coverage Link found\r\n{0}\r\n",
                        JObject.FromObject(new { claimHeader.ClaimReference, claimDetail.ClaimDetailReference, policyCoverageID }));
                    bool updateTerms = false;
                    // Retrieve the policy data onto the claim
                    IAXAClaimsQuery query = new AXAClaimsQueries();
                    Logger.InfoFormat("GetPolicyDeductibles query parameters for ClaimReference '{0}'\r\n[\r\n\tcomponentID={1}\r\n\tlinkLevel={2}\r\n\tvehicleType={3}\r\n\tdivision={4}\r\n\treasonCode={5}\r\n\tidentifier={6}\r\n]",
                        claimHeader.ClaimReference, policyCoverageID.Value, claimDetail.PolicyLinkLevel.Value, claimHeader.ClaimHeaderAnalysisCode09, claimHeader.ClaimHeaderAnalysisCode04, claimHeader.ClaimHeaderAnalysisCode08, "AND2");
                    IEnumerable<IGenericDataItem> deductibleGDItems = query.GetPolicyDeductibles(policyCoverageID.Value, claimDetail.PolicyLinkLevel.Value, claimHeader.ClaimHeaderAnalysisCode09, claimHeader.ClaimHeaderAnalysisCode04, claimHeader.ClaimHeaderAnalysisCode08, "AND2");

                    if (deductibleGDItems != null && deductibleGDItems.Count() > 0)
                    {
                        Logger.InfoFormat("Deductibles found\r\n{0}\r\n",
                            JObject.FromObject(new { claimDetail.ClaimDetailReference, DeductibleGenericDataItems = deductibleGDItems.Count() }));
                        // Assumed that ClaimHeader Generic data set for AND4 is set to default on creation
                        string[] policyRefs = new string[5];
                        ClaimGenericDataItem policyRefData = null;
                        ClaimGenericDataSet dataSet = claimHeader.GenericDataSet;
                        if (dataSet == null)
                        {
                            dataSet = (ClaimGenericDataSet)claimHeader.CreateGenericDataSet(true);
                            claimHeader.GenericDataSet = dataSet;

                        }
                        if (dataSet.ClaimGenericDataItems.All(gdi => gdi.GenericDataTypeCode != "AND4"))
                        {
                            IClaimGenericDataSetContainer claimGenericDataSetContainer = claimHeader;
                            var genericDataDefinitionHeader = claimHeader.GetProductGDDefinitionHeader();
                            var genericDataDefinitionDetail =
                                genericDataDefinitionHeader.ProductGDDefinitionDetails.FirstOrDefault(
                                    gd =>
                                    gd.GenericDataTypeCode == "AND4");
                            if (genericDataDefinitionDetail != null)
                            {

                                dataSet.AddGenericDataItem(genericDataDefinitionDetail.ProductGDDefinitionDetailID,
                                                           claimGenericDataSetContainer.GDSParentStartDate);
                                Logger.InfoFormat("Created GDI for AND4\r\n{0}",
                                    JObject.FromObject(new
                                    {
                                        claimHeader.ClaimReference
                                    }));
                            }
                        }
                        policyRefData = dataSet.GenericDataItems.Cast<ClaimGenericDataItem>().FirstOrDefault(a => a.GenericDataTypeCode == "AND4");
                        if (policyRefData != null)
                        {
                            policyRefs = query.GetPolicyReferences(claimHeader.ProposedPolicyReference);
                        }
                        Logger.InfoFormat("Claim has been updated with the following Policy References\r\n{0}",
                            JObject.FromObject(new
                            {
                                claimHeader.ClaimReference,
                                PolicyReferences = policyRefs
                            }));
                        this.UpdateClaimDeductibleData(claimHeader, deductibleGDItems, policyRefData, policyRefs);
                        updateTerms = true;
                    }

                    IEnumerable<IGenericDataItem> excessGDItems = query.GetPolicyDeductibles(policyCoverageID.Value, claimDetail.PolicyLinkLevel.Value, claimHeader.ClaimHeaderAnalysisCode09, claimHeader.ClaimHeaderAnalysisCode04, claimHeader.ClaimHeaderAnalysisCode08, "AND3");

                    if (excessGDItems != null && excessGDItems.Count() > 0)
                    {
                        this.UpdateClaimADExcessData(claimHeader, excessGDItems);
                        updateTerms = true;
                    }

                    if (updateTerms)
                    {
                        this.UpdateTermsData(claimHeader);
                    }
                    else
                    {
                        //if (claimHeader.UWHeader != null && claimHeader.UWHeader.ITerms != null && claimHeader.UWHeader.ITerms.Count > 0)
                        //{
                        //    IUWTerms uwTerm = claimHeader.UWHeader.ITerms.OrderByDescending(x => x.VersionNumber).FirstOrDefault();
                        //if (!string.IsNullOrWhiteSpace(uwTerm.MainOriginalCurrencyCode))
                        //{
                        //    claimHeader.ClaimCurrencyCode = uwTerm.MainOriginalCurrencyCode;
                        //}
                        //else
                        //{
                        claimHeader.ClaimCurrencyCode = ClaimConstants.DEFAULT_CURRENCY_CODE;
                        //}
                        //}
                    }
                }
            }
            return true;
        }