Dynamic Logic Functions

This section describes the dynamic logic functions that are used to create claim transactions from claims.

The examples of dynamic logic that are included are intended to give a general indication of what is required and possible. The examples are 'working code' but are not necessarily ready for 'production' use.

Although it is possible to access the claim lines from the claim transaction object that is provided as input to several of the functions; this is not recommended for performance reasons. This is especially important with larger claims as the access of a claim line could trigger the loading of all lines. Similar considerations apply to the bills of a claim transaction object and claim lines of a bill.

The examples in Create Claim Transaction Header, Create Bill Transaction and Create Claim Line Transaction contain an element servicedMember. The name of this element depends on the configuration of insurable entity type Person in the Insurable Entities page.

Create Claim Transaction Header

Dynamic functions of this type create a claim transaction 'header' from a claim that is being finalized with the following details:

  • Claim

  • Claim Messages

  • Claim Diagnoses

  • Claim Status History, Claim Callout History and Pend Reason History entries

  • Claim Unfinalize Reasons

  • Policy Product

These dynamic functions are executed once per claim.

Table 1. Create Claim Transaction Header
Parameter Name Parameter Type Input or Output Description

transactionScenario

Input

Transaction creation scenario that has been selected for the current transaction. Provided to allow access to parameters of the scenario.

claim

Claim

Input

Claim being finalized

ctrClaim

CTR Claim

Input / Output

Input: CTR Claim with only claim code, version, and transaction date prepopulated. Output: CTR Claim.

These parameters are bound to the script before it is invoked.

The following CTR Claim fields are set outside of dynamic logic and cannot be set from the dynamic logic:

  • ctrClaim.code,

  • ctrClaim.version,

  • ctrClaim.reversalIndicator, and

  • ctrClaim.transactionDate.

The dynamic logic can transfer all desirable values from the claim and its referenced objects to the CTR claim, including:

  • the CTR claim message object to transfer each claim message

  • the CTR claim diagnosis object to transfer each claim diagnosis

  • the CTR claim state history object to transfer each state history entry and its claim callout history and pend reason history entries

  • the CTR claim unfinalize reason object to transfer each claim unfinalize reason

  • the CTR claim policy product object to transfer each policy product

In addition, this logic can set additional details specific to the claim transaction (that is, to set values that are derived as opposed to simply being transferred).

Example:

// NOTE The code, version and transactionDateTime of ctrClaim are prepopulated
        [
        "authorizationCode",
        "claimDate",
        "dueDate",
        "endDate",
        "entryDate",
        "expirationDate",
        "externalRemarks",
        "internalRemarks",
        "nextPayerCode",
        "paidDate",
        "precedingPayerCode",
        "priceDate",
        "processType",
        "providerEntityReference",
        "providerReference",
        "receiptDate",
        "startDate",
        "type",
        "referenceCode"].each{ fieldname ->
        ctrClaim."$fieldname" = claim."$fieldname"}

ctrClaim.emergencyIndicator = claim.emergency ? "Y" : "N"
ctrClaim.ignoreHistoryIndicator = claim.ignoreHistory ? "Y" : "N"
ctrClaim.manualIndicator = claim.manual ? "Y" : "N"
ctrClaim.totalAllowedAmount = claim.totalAllowedAmount?.amount
ctrClaim.totalAllowedAmountCurrency = claim.totalAllowedAmount?.currencyCode
ctrClaim.totalClaimedAmount = claim.totalClaimedAmount?.amount
ctrClaim.totalClaimedAmountCurrency = claim.totalClaimedAmount?.currencyCode
ctrClaim.totalCoveredAmount = claim.totalCoveredAmount?.amount
ctrClaim.totalCoveredAmountCurrency = claim.totalCoveredAmount?.currencyCode

// Externalize Foreign Keys (and add referenced attributes)
if (claim.brand != null){
    ctrClaim.brandCode = claim.brand.code
    ctrClaim.brandAccessCode = claim.brand.accessRestriction?.code
    ctrClaim.brandDescription = claim.brand.getDescr()

    ctrClaim.brandPayerName = claim.brand.payer.name
    ctrClaim.brandPayerAccessCode = claim.brand.payer.accessRestriction?.code
}
else { //assume claim.payerCode != null
    ctrClaim.payerCode = claim.payerCode.code
}

ctrClaim.claimantProvCode = claim.claimantProvider?.code
ctrClaim.claimantProvCodeDef = claim.claimantProvider?.flexCodeSystem?.code
ctrClaim.claimantRelCode = claim.claimantRelation?.code
if (claim.claimantRelation != null){
    ctrClaim.claimantName = claim.claimantRelation.name
}
else {
    ctrClaim.claimantName = claim.claimantProvider?.name
}
if (claim.claimantRelation instanceof Person) {
    ctrClaim.claimantAccessCode = claim.claimantRelation?.accessRestriction?.code
    ctrClaim.claimantContactAccessCode = claim.claimantRelation?.accessRestrictionContactDetail?.code
}
ctrClaim.claimSetCode = claim.claimSet?.code
ctrClaim.classificationSchemeCode = claim.classificationScheme?.code
ctrClaim.classificationCode = claim.classification?.code
ctrClaim.formCode = claim.claimForm.code
ctrClaim.formDescription = claim.claimForm.descr
ctrClaim.dataAccessGroupCode = claim.dataAccessGroup?.code
ctrClaim.dataAccessGroupAccessCode = claim.dataAccessGroup?.accessRestriction?.code
ctrClaim.locationProvCode = claim.locationProvider?.code
ctrClaim.locationProvCodeDef = claim.locationProvider?.flexCodeSystem?.code
ctrClaim.locationProvName = claim.locationProvider?.name
//retrieve the address that is valid on the claim date
if (claim.locationProvider instanceof IndividualProvider) {
    ctrClaim.locationProvAddress = claim.locationProvider.renderingAddressList.asOf().last()?.serviceAddress.getDescriptor()
} else {
    ctrClaim.locationProvAddress = claim.locationProvider?.serviceAddressList.asOf().last()?.getDescriptor()
}
ctrClaim.locationTypeCode = claim.locationType?.code
ctrClaim.locationTypeDescription = claim.locationType?.descr
ctrClaim.payerCode = claim.payerCode?.code
ctrClaim.payBeneficiaryProvCodeDef = claim.paymentBeneficiaryProvider?.flexCodeSystem?.code
ctrClaim.payBeneficiaryProvCode = claim.paymentBeneficiaryProvider?.code
ctrClaim.payBeneficiaryRelCode = claim.paymentBeneficiaryRelation?.code
if (claim.paymentBeneficiaryRelation != null){
    ctrClaim.payBeneficiaryName = claim.paymentBeneficiaryRelation.name
}
else {
    ctrClaim.payBeneficiaryName = claim.paymentBeneficiaryProvider?.name
}
ctrClaim.payReceiverProvCodeDef = claim.paymentReceiverProvider?.flexCodeSystem?.code
ctrClaim.payReceiverProvCode = claim.paymentReceiverProvider?.code
ctrClaim.payReceiverRelCode = claim.paymentReceiverRelation?.code
if (claim.paymentReceiverRelation != null){
    ctrClaim.payReceiverName = claim.paymentReceiverRelation.name
}
else {
    ctrClaim.payReceiverName = claim.paymentReceiverProvider?.name
}
ctrClaim.referralProvName = claim.referralProvider?.name
ctrClaim.referralProvCode = claim.referralProvider?.code
ctrClaim.referralProvCodeDef = claim.referralProvider?.flexCodeSystem?.code
ctrClaim.serviceProvName = claim.serviceProvider?.name
ctrClaim.serviceProvCode = claim.serviceProvider?.code
ctrClaim.serviceProvCodeDef = claim.serviceProvider?.flexCodeSystem?.code
ctrClaim.serviceSpecialtyCode = claim.serviceSpecialty?.code

if (claim.servicedEntity?.insurableEntityType?.code == "PERSON") {
    ctrClaim.servicedEntityType = claim.servicedEntity?.insurableEntityType?.code
    ctrClaim.servicedEntityCode = claim.servicedMember?.code
    ctrClaim.servicedEntityName = claim.servicedMember?.name
    ctrClaim.servicedEntityDate = claim.servicedMember?.dateOfBirth
    ctrClaim.servicedEntityDateInterpretation = claim.servicedMember?.dobInterpretation
    ctrClaim.servicedEntityAccessCode = claim.servicedMember?.accessRestriction?.code
    ctrClaim.servicedEntityContactAccessCode = claim.servicedMember?.accessRestrictionContactDetail?.code
}
else {
    ctrClaim.servicedEntityType = claim.servicedEntity?.insurableEntityType?.code
    ctrClaim.servicedEntityCode = claim.servicedEntity?.code
    ctrClaim.servicedEntityName = claim.servicedEntity?.descr
    ctrClaim.servicedEntityDate = claim.servicedEntity?.entityDate
}
ctrClaim.specReceiverProvCode = claim.paymentSpecificationReceiverProvider?.code
ctrClaim.specReceiverProvCodeDef = claim.paymentSpecificationReceiverProvider?.flexCodeSystem?.code
ctrClaim.specReceiverRelCode = claim.paymentSpecificationReceiverRelation?.code
if (claim.paymentSpecificationReceiverRelation != null){
    ctrClaim.specReceiverName = claim.paymentSpecificationReceiverRelation.name
}
else {
    ctrClaim.specReceiverName = claim.paymentSpecificationReceiverProvider?.name
}
ctrClaim.transactionSourceCode = claim.transactionSource?.code
// Transfer Messages
for (claimMessage in claim?.claimMessageList) {
    if (claimMessage.message != null){
       def ctrClaimMessage = new CtrClaimMessage()
       ctrClaimMessage.code = claimMessage.message.code
       ctrClaimMessage.externalCode = claimMessage.message.externalCode
       ctrClaimMessage.origin = claimMessage.origin
       ctrClaimMessage.severity = claimMessage.message.severity
       ctrClaimMessage.priority = claimMessage.message.priority
       ctrClaimMessage.messageText = claimMessage.getMessageText()
       ctrClaimMessage.providerMessageText = claimMessage.getProviderText()
       ctrClaimMessage.alternativeMessageText = claimMessage.getAlternativeMessageText()
       (0 .. 9).each{
           def propName = "value"+it
           ctrClaimMessage."$propName" = claimMessage."$propName"
       }
       ctrClaimMessage.transactionSourceCode = claimMessage.transactionSource?.code
       ctrClaimMessage.referenceCode = claimMessage.referenceCode
       ctrClaim.addCtrClaimMessage(ctrClaimMessage)
    }
}
// Transfer Diagnoses
for (claimDiagnosis in claim?.claimDiagnosisList) {
    if (claimDiagnosis.diagnosis != null){
       def ctrClaimDiagnosis = new CtrClaimDiagnosis()
       ctrClaimDiagnosis.code = claimDiagnosis.diagnosis.code
       ctrClaimDiagnosis.codeDef = claimDiagnosis.diagnosis.flexCodeSystem.code
       ctrClaimDiagnosis.description = claimDiagnosis.diagnosis.getDescr()
       ctrClaimDiagnosis.sequence = claimDiagnosis.sequence
       ctrClaimDiagnosis.typeCode = claimDiagnosis.diagnosisType?.code
       ctrClaimDiagnosis.typeDescription = claimDiagnosis.diagnosisType?.descr
       ctrClaimDiagnosis.accessCode = claimDiagnosis.diagnosis.accessRestriction?.code
       ctrClaimDiagnosis.presentOnAdmissionCode = claimDiagnosis.presentOnAdmission?.code
       ctrClaimDiagnosis.presentOnAdmissionDesc = claimDiagnosis.presentOnAdmission?.description
       ctrClaim.addCtrClaimDiagnosis(ctrClaimDiagnosis)
    }
}
// Transfer Status History
for (claimStatusHistory in claim.claimStatusHistoryList) {
    def ctrClaimStatusHistory = new CtrStatusHistory()
    ctrClaimStatusHistory.status = claimStatusHistory.status
    ctrClaimStatusHistory.statusDateTime = claimStatusHistory.dateTime
    for (claimPendReasonHistory in claimStatusHistory?.claimPendReasonHistoryList) {
        def ctrPendReasonHistory = new CtrPendReasonHistory()
        ctrPendReasonHistory.code = claimPendReasonHistory.pendReason.code
        ctrPendReasonHistory.externalCode = claimPendReasonHistory.pendReason.externalCode
        ctrPendReasonHistory.billProviderReference = claimPendReasonHistory.billProviderReference
        ctrPendReasonHistory.claimLineCode = claimPendReasonHistory.claimLineCode
        ctrPendReasonHistory.userLoginName = claimPendReasonHistory.resolvedBy?.loginName
        ctrPendReasonHistory.resolvedDateTime = claimPendReasonHistory.resolvedDateTime
        ctrPendReasonHistory.alternativeText = claimPendReasonHistory.pendReason.alternativeExternalText
        ctrPendReasonHistory.providerText = claimPendReasonHistory.pendReason.externalTextProvider
        ctrClaimStatusHistory.addCtrPendReasonHistory(ctrPendReasonHistory)
    }
    for (claimCalloutHistory in claimStatusHistory?.claimCalloutHistoryList) {
        if (claimCalloutHistory.displayInUi)
        {
        def ctrCalloutHistory = new CtrCalloutHistory()
        ctrCalloutHistory.definitionCode = claimCalloutHistory.definitionCode
        ctrCalloutHistory.definitionDescription = claimCalloutHistory.definitionDescr
        ctrCalloutHistory.requestSentDateTime = claimCalloutHistory.requestSentDateTime
        ctrCalloutHistory.responseReceivedDateTime = claimCalloutHistory.responseReceivedDateTime
        ctrClaimStatusHistory.addCtrCalloutHistory(ctrCalloutHistory)
        }
    }
    ctrClaim.addCtrStatusHistory(ctrClaimStatusHistory)
}
// Transfer Unfinalize Reasons
for (claimUnfinalizeReason in claim.claimUnfinalizeReasonList) {
    if( claimUnfinalizeReason.unfinalizeReason != null){
        def ctrClaimUnfinalizeReason = new CtrClaimUnfinalizeReason()
        ctrClaimUnfinalizeReason.code = claimUnfinalizeReason.unfinalizeReason.code
        ctrClaimUnfinalizeReason.externalCode = claimUnfinalizeReason.unfinalizeReason.externalCode
        ctrClaimUnfinalizeReason.sourceReference = claimUnfinalizeReason.sourceReference
        ctrClaim.addCtrClaimUnfinalizeReason(ctrClaimUnfinalizeReason)
    }
}

Create Bill Transaction

Dynamic functions of this type create a claim transaction bill for a bill of claim that is being finalized with the following details:

  • Bill

  • Bill Messages

  • Bill Diagnoses

These dynamic functions are executed once per bill of a claim.

Table 2. Create Bill Transaction
Parameter Name Parameter Type Input / Output Description

transactionScenario

Input

Transaction creation scenario that has been selected for the current transaction. Provided to allow access to parameters of the scenario.

claim

Claim

Input

Claim being finalized. Included only for reference purposes.

bill

Bill

Input

Bill being processed.

ctrBill

CTR Bill

Input / Output

Input: Empty CTR Bill. Output CTR Bill.

The dynamic logic can transfer all desirable values from the bill and its referenced objects to the CTR bill, including:

  • the CTR bill message object to transfer each bill message

  • the CTR bill diagnosis object to transfer each bill diagnosis

In addition, this logic can set additional details specific to the claim transaction (that is, to set values that are derived as opposed to simply being transferred).

Example:

//available are bill, ctrBill, and claim
        [
        "authorizationCode",
        "billDate",
        "providerEntityReference",
        "providerReference",
        "referenceCode"].each{ fieldname ->
        ctrBill."$fieldname" = bill."$fieldname"}
ctrBill.emergencyIndicator = bill.emergency? "Y" : "N"
// Externalize Foreign Keys (and add referenced attributes)
ctrBill.locationProvCode = bill.locationProvider?.code
ctrBill.locationProvCodeDef = bill.locationProvider?.flexCodeSystem?.code
ctrBill.locationProvName = bill.locationProvider?.name
ctrBill.locationTypeCode = bill.locationType?.code
ctrBill.locationTypeDescription = bill.locationType?.descr
ctrBill.payReceiverProvCode = bill.paymentReceiverProvider?.code
ctrBill.payReceiverProvCodeDef = bill.paymentReceiverProvider?.flexCodeSystem?.code
ctrBill.payReceiverRelCode = bill.paymentReceiverRelation?.code
if (bill.paymentReceiverRelation != null){
    ctrBill.payReceiverName = bill.paymentReceiverRelation.name
}
else {
    ctrBill.payReceiverName = bill.paymentReceiverProvider?.name
}
ctrBill.referralProvCode = bill.referralProvider?.code
ctrBill.referralProvCodeDef = bill.referralProvider?.flexCodeSystem?.code
ctrBill.referralProvName = bill.referralProvider?.name
ctrBill.serviceProvCode = bill.serviceProvider?.code
ctrBill.serviceProvCodeDef = bill.serviceProvider?.flexCodeSystem?.code
ctrBill.serviceProvName = bill.serviceProvider?.name
ctrBill.serviceSpecialtyCode = bill.serviceSpecialty?.code

if (claim.servicedEntity?.insurableEntityType?.code == "PERSON") {
    ctrBill.servicedEntityType = bill.servicedEntity?.insurableEntityType?.code
    ctrBill.servicedEntityCode = bill.servicedMember?.code
    ctrBill.servicedEntityName = bill.servicedMember?.name
    ctrBill.servicedEntityDate = bill.servicedMember?.dateOfBirth
    ctrBill.servicedEntityDateInterpretation = bill.servicedMember?.dobInterpretation
    ctrBill.servicedEntityAccessCode = bill.servicedMember?.accessRestriction?.code
    ctrBill.servicedEntityContactAccessCode = bill.servicedMember?.accessRestrictionContactDetail?.code
}
else {
    ctrBill.servicedEntityType = bill.servicedEntity?.insurableEntityType?.code
    ctrBill.servicedEntityCode = bill.servicedEntity?.code
    ctrBill.servicedEntityName = bill.servicedEntity?.descr
    ctrBill.servicedEntityDate = bill.servicedEntity?.entityDate
}

// Transfer Diagnoses
for (billDiagnosis in bill?.billDiagnosisList) {
    def ctrBillDiagnosis = new CtrBillDiagnosis()
    ctrBillDiagnosis.code = billDiagnosis.diagnosis?.code
    ctrBillDiagnosis.codeDef = billDiagnosis.diagnosis?.flexCodeSystem.code
    ctrBillDiagnosis.description = billDiagnosis.diagnosis?.getDescr()
    ctrBillDiagnosis.sequence = billDiagnosis.sequence
    ctrBillDiagnosis.typeCode = billDiagnosis.diagnosisType.code
    ctrBillDiagnosis.typeDescription = billDiagnosis.diagnosisType.descr
    ctrBillDiagnosis.accessCode = billDiagnosis.diagnosis?.accessRestriction?.code
    ctrBill.addCtrBillDiagnosis(ctrBillDiagnosis)
}
// Transfer Messages
for (billMessage in bill?.billMessageList) {
    def ctrBillMessage = new CtrBillMessage()
    ctrBillMessage.code = billMessage.message != null ? billMessage.message?.code : billMessage.code
    ctrBillMessage.origin = billMessage.origin
    ctrBillMessage.messageText = billMessage.getMessageText()
    ctrBillMessage.providerMessageText = billMessage.getProviderText()
    ctrBillMessage.alternativeMessageText = billMessage.getAlternativeMessageText()
    ctrBillMessage.severity = billMessage.message?.severity
    ctrBillMessage.priority = billMessage.message?.priority
    ctrBillMessage.externalCode = billMessage.message?.externalCode
    (0 .. 9).each{
        def propName = "value"+it
        ctrBillMessage."$propName" = billMessage."$propName"
    }
    ctrBill.addCtrBillMessage(ctrBillMessage)
}

Create Claim Line Transaction

Dynamic functions of this type create a claim transaction claim line for a line of a claim that is being finalized with the following details:

  • Claim Line

  • Claim Line Messages

  • Claim Line Diagnoses

  • Modifiers

  • Coverages

  • Claim Sub Lines

These dynamic functions are executed once per claim line of a claim.

Table 3. Create Claim Line Transaction
Parameter Parameter Type Input or Output Description

transactionScenario

Input

Transaction creation scenario that has been selected for the current transaction. Provided to allow access to parameters of the scenario.

claim

Claim

Input

Claim being finalized. Included only for reference purposes.

claimLine

ClaimLine

Input

Claim line being processed.

ctrClaimLine

CTR ClaimLine

Input / Output

Input: Empty CTR Claim Line with code prepopulated. Output CTR Claim Line.

ctrClaimLine.code is set outside of the dynamic logic and cannot be set in the dynamic logic.

The dynamic logic can transfer all desirable values from the claim line and its referenced objects to the CTR claim line, including:

  • the CTR claim line message object to transfer each claim line message

  • the CTR claim line diagnosis object to transfer each claim line diagnosis

  • the CTR claim line modifiers object to transfer each claim line modifier

  • the CTR claim line coverage object to transfer each claim line coverage

  • the CTR claim sub line object to transfer each claim line sub lines

  • the CTR claim line contract reference to transfer each claim line contract reference

  • the CTR claim line benefit specification object to transfer each claim line benefit specification

  • the CTR claim line provider pricing clauses object to transfer each claim line provider pricing clause

  • the CTR claim line applied parameter object to transfer each claim line applied parameter

In addition, this logic can set additional details specific to the claim transaction (that is, to set values that are derived as opposed to simply being transferred).

Example:

// Transfer native fields
// NOTE The code of ctrClaimLine is prepopulated
[
    "allowedNumberOfUnits",
    "authorizationCode",
    "authorizationExceptionType",
    "benefitsAgeInputDate",
    "benefitsAgeInputDate",
    "claimedNumberOfUnits",
    "coveredNumberOfUnits",
    "endDate",
    "priceInputDate",
    "priceInputNumberOfUnits",
    "providerEntityReference",
    "providerReference",
    "referenceCode",
    "sequence",
    "startDate",
    "status",
    "waitingPeriodInputDate"].each{ fieldname ->
        ctrClaimLine."$fieldname" = claimLine."$fieldname"}

ctrClaimLine.allowedAmount = claimLine.allowedAmount?.amount
ctrClaimLine.allowedAmountCurrency = claimLine.allowedAmount?.currencyCode
ctrClaimLine.benefitsInputAmount = claimLine.benefitsInputAmount?.amount
ctrClaimLine.benefitsInputAmountCurrency = claimLine.benefitsInputAmount?.currencyCode
ctrClaimLine.claimedAmount = claimLine.claimedAmount?.amount
ctrClaimLine.claimedAmountCurrency = claimLine.claimedAmount?.currencyCode
ctrClaimLine.coveredAmount = claimLine.coveredAmount?.amount
ctrClaimLine.coveredAmountCurrency = claimLine.coveredAmount?.currencyCode
ctrClaimLine.encounterIndicator = claimLine.encounter ? "Y" : "N"
ctrClaimLine.emergencyIndicator = claimLine.emergency ? "Y" : "N"
ctrClaimLine.precedingPayerPaidAmount = claimLine.precedingPayerPaidAmount?.amount
ctrClaimLine.precedingPayerPaidAmountCurrency = claimLine.precedingPayerPaidAmount?.currencyCode
ctrClaimLine.processAsIn = claimLine.processAsIn ? "Y" : "N"
ctrClaimLine.replacedIndicator  = claimLine.replaced ? "Y" : "N"

ctrClaimLine.subscriptionDate= claimLine.claimLineOverride?.subscriptionDate
ctrClaimLine.familyCode = claimLine.claimLineOverride?.familyCode

 // Externalize Foreign Keys (and add referenced attributes)
ctrClaimLine.authorizationRegimeCode = claimLine.claimLineOverride?.authorizationRegime?.code
ctrClaimLine.benefitsProvCodeDef = claimLine.benefitsProvider?.flexCodeSystem?.code
ctrClaimLine.benefitsProvCode = claimLine.benefitsProvider?.code
ctrClaimLine.benefitsProvName = claimLine.benefitsProvider?.name
ctrClaimLine.claimDate = claimLine.claim.claimDate
ctrClaimLine.classificationCode = claimLine.classification?.code
ctrClaimLine.classificationAuthorizationCode = claimLine.authorization?.code
ctrClaimLine.coverageRegimeCode = claimLine.claimLineOverride?.coverageRegime?.code
ctrClaimLine.coverageRegimeNoAuthCode = claimLine.claimLineOverride?.coverageRegimeNoAuth?.code
ctrClaimLine.coverageSpecificationCode = claimLine.claimLineOverride?.coverageSpecification?.code
ctrClaimLine.fundingArrangementCode = claimLine.claimLineOverride?.fundingArrangement?.code
ctrClaimLine.locationProvCode = claimLine.locationProvider?.code
ctrClaimLine.locationProvCodeDef = claimLine.locationProvider?.flexCodeSystem?.code
ctrClaimLine.locationProvName = claimLine.locationProvider?.name
ctrClaimLine.locationTypeCode = claimLine.locationType?.code
ctrClaimLine.locationTypeDescription = claimLine.locationType?.descr
ctrClaimLine.payReceiverProvCode = claimLine.paymentReceiverProvider?.code
ctrClaimLine.payReceiverProvCodeDef = claimLine.paymentReceiverProvider?.flexCodeSystem?.code
ctrClaimLine.payReceiverRelCode = claimLine.paymentReceiverRelation?.code
if (claimLine.paymentReceiverRelation != null){
    ctrClaimLine.payReceiverName = claimLine.paymentReceiverRelation.name
}
else {
    ctrClaimLine.payReceiverName = claimLine.paymentReceiverProvider?.name
}
ctrClaimLine.postBenefitsRegimeCode = claimLine.claimLineOverride?.postBenefitsRegime?.code
ctrClaimLine.priceIndProvCode = claimLine.priceIndividualProvider?.code
ctrClaimLine.priceIndProvCodeDef = claimLine.priceIndividualProvider?.flexCodeSystem?.code
ctrClaimLine.priceIndProvName = claimLine.priceIndividualProvider?.name
ctrClaimLine.priceOrgProvCode = claimLine.priceOrganizationProvider?.code
ctrClaimLine.priceOrgProvCodeDef = claimLine.priceOrganizationProvider?.flexCodeSystem?.code
ctrClaimLine.priceOrgProvName = claimLine.priceOrganizationProvider?.name
ctrClaimLine.pricePrincipalProc1Ind = claimLine.pricePrincipalProcedure1 ? "Y" : "N"
ctrClaimLine.pricePrincipalProc2Ind = claimLine.pricePrincipalProcedure2 ? "Y" : "N"
ctrClaimLine.pricePrincipalProc3Ind = claimLine.pricePrincipalProcedure3 ? "Y" : "N"

ctrClaimLine.procedureAccessCode = claimLine.procedure?.accessRestriction?.code
ctrClaimLine.procedureCode = claimLine.procedure?.code
ctrClaimLine.procedureCodeDef = claimLine.procedure?.flexCodeSystem?.code
ctrClaimLine.procedureDescription = claimLine.procedure?.getDescr()
ctrClaimLine.procedure2AccessCode = claimLine.procedure2?.accessRestriction?.code
ctrClaimLine.procedure2Code = claimLine.procedure2?.code
ctrClaimLine.procedure2CodeDef = claimLine.procedure2?.flexCodeSystem?.code
ctrClaimLine.procedure2Description = claimLine.procedure2?.getDescr()
ctrClaimLine.procedure3AccessCode = claimLine.procedure3?.accessRestriction?.code
ctrClaimLine.procedure3Code = claimLine.procedure3?.code
ctrClaimLine.procedure3CodeDef = claimLine.procedure3?.flexCodeSystem?.code
ctrClaimLine.procedure3Description = claimLine.procedure3?.getDescr()

ctrClaimLine.productCode = claimLine.claimLineOverride?.product?.code
ctrClaimLine.productFamilyCode = claimLine.claimLineOverride?.productFamily?.code
ctrClaimLine.productLineCode = claimLine.claimLineOverride?.productLine?.code

ctrClaimLine.referralProvCode = claimLine.referralProvider?.code
ctrClaimLine.referralProvCodeDef = claimLine.referralProvider?.flexCodeSystem?.code
ctrClaimLine.referralProvName = claimLine.referralProvider?.name
ctrClaimLine.replacedByCode = claimLine.replacementClaimLine?.code
ctrClaimLine.replacesCode = claimLine.originalClaimLine?.code

ctrClaimLine.reservationCode = claimLine.reservationLine?.claim?.code
ctrClaimLine.reservationLineCode = claimLine.reservationLine?.code

ctrClaimLine.serviceProvCode = claimLine.serviceProvider?.code
ctrClaimLine.serviceProvCodeDef = claimLine.serviceProvider?.flexCodeSystem?.code
ctrClaimLine.serviceProvName = claimLine.serviceProvider?.name
ctrClaimLine.serviceSpecialtyCode = claimLine.serviceSpecialty?.code

if (claim.servicedEntity?.insurableEntityType?.code == "PERSON") {
    ctrClaimLine.servicedEntityType = claimLine.servicedEntity?.insurableEntityType?.code
    ctrClaimLine.servicedEntityCode = claimLine.servicedMember?.code
    ctrClaimLine.servicedEntityName = claimLine.servicedMember?.name
    ctrClaimLine.servicedEntityDate = claimLine.servicedMember?.dateOfBirth
    ctrClaimLine.servicedEntityDateInterpretation = claimLine.servicedMember?.dobInterpretation
    ctrClaimLine.servicedEntityAccessCode = claimLine.servicedMember?.accessRestriction?.code
    ctrClaimLine.servicedEntityContactAccessCode = claimLine.servicedMember?.accessRestrictionContactDetail?.code
}
else {
    ctrClaimLine.servicedEntityType = claimLine.servicedEntity?.insurableEntityType?.code
    ctrClaimLine.servicedEntityCode = claimLine.servicedEntity?.code
    ctrClaimLine.servicedEntityName = claimLine.servicedEntity?.descr
    ctrClaimLine.servicedEntityDate = claimLine.servicedEntity?.entityDate
}

ctrClaimLine.transactionSourceCode = claimLine.transactionSource?.code
ctrClaimLine.waitingPeriodRegimeCode = claimLine.claimLineOverride?.waitingPeriodRegime?.code

// Transfer Messages
for (claimLineMessage in claimLine.claimLineMessageList) {
    if (claimLineMessage.message != null){
       def ctrClaimLineMessage = new CtrClaimLineMessage()
       ctrClaimLineMessage.code = claimLineMessage.message.code
       ctrClaimLineMessage.origin = claimLineMessage.origin
       ctrClaimLineMessage.messageText = claimLineMessage.getMessageText()
       ctrClaimLineMessage.providerMessageText = claimLineMessage.getProviderText()
       ctrClaimLineMessage.alternativeMessageText = claimLineMessage.getAlternativeMessageText()
       ctrClaimLineMessage.severity = claimLineMessage.message.severity
       ctrClaimLineMessage.priority = claimLineMessage.message.priority
       ctrClaimLineMessage.externalCode = claimLineMessage.message.externalCode
       ctrClaimLineMessage.productCode = claimLineMessage.product?.code
       (0..9).each{
          def propName = "value"+it
          ctrClaimLineMessage."$propName" = claimLineMessage."$propName"
       }
       ctrClaimLineMessage.transactionSourceCode = claimLineMessage.transactionSource?.code
       ctrClaimLineMessage.referenceCode = claimLineMessage.referenceCode
       ctrClaimLine.addCtrClaimLineMessage(ctrClaimLineMessage)
    }
}
// Transfer Claim Line Diagnosis
for (claimLineDiagnosis in claimLine.claimLineDiagnosisList) {
    if (claimLineDiagnosis.diagnosis != null){
     def ctrClaimLineDiagnosis = new CtrClaimLineDiagnosis()
     ctrClaimLineDiagnosis.code = claimLineDiagnosis.diagnosis.code
     ctrClaimLineDiagnosis.codeDef = claimLineDiagnosis.diagnosis.flexCodeSystem.code
     ctrClaimLineDiagnosis.description = claimLineDiagnosis.diagnosis.getDescr()
     ctrClaimLineDiagnosis.sequence = claimLineDiagnosis.sequence
     ctrClaimLineDiagnosis.typeCode = claimLineDiagnosis.diagnosisType.code
     ctrClaimLineDiagnosis.typeDescription = claimLineDiagnosis.diagnosisType.descr
            ctrClaimLineDiagnosis.accessCode = claimLineDiagnosis.diagnosis.accessRestriction?.code
     ctrClaimLine.addCtrClaimLineDiagnosis(ctrClaimLineDiagnosis)
    }
}
// Transfer Claim Line Modifier
for (claimLineModifier in claimLine.claimLineModifierList) {
    if(claimLineModifier.modifier != null){
        def ctrClaimLineModifier = new CtrClaimLineModifier()
        ctrClaimLineModifier.code = claimLineModifier.modifier.code
        ctrClaimLineModifier.description = claimLineModifier.modifier.getDescr()
        ctrClaimLine.addCtrClaimLineModifier(ctrClaimLineModifier)
    }
}
// Transfer Claim Line Contract Reference
for (claimLineContractReference in claimLine.claimLineContractReferenceList) {
    if(claimLineContractReference.contractReference != null){
        def ctrClaimLineContractReference = new CtrClaimLineContractReference()
        ctrClaimLineContractReference.code = claimLineContractReference.contractReference.code
        ctrClaimLineContractReference.description = claimLineContractReference.contractReference.descr
        ctrClaimLine.addCtrClaimLineContractReference(ctrClaimLineContractReference)
    }
}
// Transfer Claim SubLine
for (claimSubLine in claimLine.claimSubLineList) {
    def ctrClaimSubLine = new CtrClaimSubLine()
    ctrClaimSubLine.sequence = claimSubLine.sequence
    ctrClaimSubLine.claimedNumberOfUnits = claimSubLine.claimedNumberOfUnits
    ctrClaimSubLine.procedureCode = claimSubLine.procedure?.code
    ctrClaimSubLine.procedureCodeDef = claimSubLine.procedure?.flexCodeSystem?.code
    ctrClaimSubLine.procedureAccessCode = claimSubLine.procedure?.accessRestriction?.code
    ctrClaimLine.addCtrClaimSubLine(ctrClaimSubLine)
}
// Transfer Claim Line Coverages
// NOTE the ctrClaimLineCoverages are used in the logic for creating the financial details
for (claimLineCoverage in claimLine.claimLineCoverageList) {
    def ctrClaimLineCoverage = new CtrClaimLineCoverage()
    ctrClaimLineCoverage.action = claimLineCoverage.action
    ctrClaimLineCoverage.amount = claimLineCoverage.amount.amount
    ctrClaimLineCoverage.amountCurrency = claimLineCoverage.amount.currencyCode
    ctrClaimLineCoverage.numberOfUnits = claimLineCoverage.numberOfUnits
    ctrClaimLineCoverage.productCode = claimLineCoverage.product.code
    ctrClaimLineCoverage.productDescription = claimLineCoverage.product.getDescr()
    ctrClaimLineCoverage.productBrandCode = claimLineCoverage.product.brand.getCode()
    ctrClaimLineCoverage.productBrandDescription = claimLineCoverage.product.brand.getDescr()
    ctrClaimLineCoverage.productFamilyCode = claimLineCoverage.product?.productFamily?.code
    ctrClaimLineCoverage.coverageLabelCode = claimLineCoverage.coverageLabel.code
    ctrClaimLineCoverage.displayName = claimLineCoverage.displayName
    ctrClaimLineCoverage.coverageLabelDisplaySequence = claimLineCoverage.coverageLabel.displaySequence
    ctrClaimLine.addCtrClaimLineCoverage(ctrClaimLineCoverage)
}
// Transfer Claim Line Benefit Specification
for (claimLineBenefitSpecification in claimLine.claimLineBenefitSpecificationList) {
    if(claimLineBenefitSpecification.benefitSpecification != null){
        def ctrClaimLineBenefitSpecification = new CtrClaimLineBenefitSpecification()
        ctrClaimLineBenefitSpecification.benefitSpecificationCode = claimLineBenefitSpecification.benefitSpecification.code
        ctrClaimLineBenefitSpecification.benefitSpecificationSubtype = claimLineBenefitSpecification.benefitSpecification.subtype
        ctrClaimLineBenefitSpecification.productCode = claimLineBenefitSpecification.product.code
        ctrClaimLineBenefitSpecification.productProviderGroupStatus = claimLineBenefitSpecification.productProviderGroupStatus
        ctrClaimLineBenefitSpecification.productProviderGroupCode = claimLineBenefitSpecification.productProviderGroup?.code
        ctrClaimLineBenefitSpecification.specificProviderGroupStatus = claimLineBenefitSpecification.specificProviderGroupStatus
        ctrClaimLineBenefitSpecification.specificProviderGroupCode = claimLineBenefitSpecification.specificProviderGroup?.code
        ctrClaimLineBenefitSpecification.inheritedProviderGroupStatus = claimLineBenefitSpecification.inheritedProviderGroupStatus
        ctrClaimLineBenefitSpecification.processedAsIn = claimLineBenefitSpecification.processedAsIn? "Y" : "N"
        if (claimLineBenefitSpecification.coverageRegime != null) {
            ctrClaimLineBenefitSpecification.regimeCode = claimLineBenefitSpecification.coverageRegime.code
        } else if (claimLineBenefitSpecification.authorizationRegime != null) {
            ctrClaimLineBenefitSpecification.regimeCode = claimLineBenefitSpecification.authorizationRegime.code
        } else if (claimLineBenefitSpecification.waitingPeriodRegime != null) {
            ctrClaimLineBenefitSpecification.regimeCode = claimLineBenefitSpecification.waitingPeriodRegime.code
        } else if (claimLineBenefitSpecification.postBenefitsRegime != null) {
            ctrClaimLineBenefitSpecification.regimeCode = claimLineBenefitSpecification.postBenefitsRegime.code
        }
        ctrClaimLine.addCtrClaimLineBenefitSpecification(ctrClaimLineBenefitSpecification)
    }
}
// Transfer Claim Line Provider Pricing Clauses
for (claimLineProviderPricingClause in claimLine.claimLineProviderPricingClauseList) {
    def ctrClaimLineProviderPricingClause = new CtrClaimLineProviderPricingClause()
    ctrClaimLineProviderPricingClause.sequence = claimLineProviderPricingClause.sequence
    ctrClaimLineProviderPricingClause.amount = claimLineProviderPricingClause.amount?.amount
    ctrClaimLineProviderPricingClause.amountCurrency = claimLineProviderPricingClause.amount?.currencyCode
    ctrClaimLineProviderPricingClause.mark = claimLineProviderPricingClause.mark
    ctrClaimLineProviderPricingClause.providerPricingClauseDescr = claimLineProviderPricingClause.providerPricingClause.getDescr()
    // Store the type and code of the reimbursement method or pricing rule
    if (claimLineProviderPricingClause.providerPricingClause.reimbursementMethod != null) {
        ctrClaimLineProviderPricingClause.methodRuleType = claimLineProviderPricingClause.providerPricingClause.reimbursementMethod.getSubtypeBoilerplate()
        ctrClaimLineProviderPricingClause.methodRuleCode = claimLineProviderPricingClause.providerPricingClause.reimbursementMethod.code
    } else {
        ctrClaimLineProviderPricingClause.methodRuleType = claimLineProviderPricingClause.providerPricingClause.pricingRule.getSubtypeBoilerplate()
        ctrClaimLineProviderPricingClause.methodRuleCode = claimLineProviderPricingClause.providerPricingClause.pricingRule.code
    }
    // Store the quantifier, which can be sourced from either one of a number of PPC attributes
    if (claimLineProviderPricingClause.providerPricingClause.percentage != null) {
        ctrClaimLineProviderPricingClause.quantifier = claimLineProviderPricingClause.providerPricingClause.percentage
    } else if (claimLineProviderPricingClause.providerPricingClause.maximumNumber != null) {
        ctrClaimLineProviderPricingClause.quantifier = claimLineProviderPricingClause.providerPricingClause.maximumNumber
    } else if (claimLineProviderPricingClause.providerPricingClause.maximumServiceDays != null) {
        ctrClaimLineProviderPricingClause.quantifier = claimLineProviderPricingClause.providerPricingClause.maximumServiceDays
    } else if (claimLineProviderPricingClause.providerPricingClause.amount != null) {
        ctrClaimLineProviderPricingClause.quantifier = claimLineProviderPricingClause.providerPricingClause.amount
    }
    ctrClaimLine.addCtrClaimLineProviderPricingClause(ctrClaimLineProviderPricingClause)
}
// Transfer Claim Line Applied Parameter
for(claimLineAppliedParameter in claimLine.claimLineAppliedParameterList) {
    def ctrClaimLineAppliedParameter = new CtrClaimLineAppliedParameter()
    ctrClaimLineAppliedParameter.amountPerUnit = claimLineAppliedParameter.amountPerUnit?.amount
    ctrClaimLineAppliedParameter.amountPerUnitCurrency = claimLineAppliedParameter.amountPerUnit?.currency?.code
    ctrClaimLineAppliedParameter.percentage = claimLineAppliedParameter.percentage
    ctrClaimLineAppliedParameter.benefitSpecificationCode = claimLineAppliedParameter.benefitSpecification?.code
    ctrClaimLineAppliedParameter.coverWithholdCategoryCode = claimLineAppliedParameter.coverWithholdCategory?.code
    ctrClaimLineAppliedParameter.aliasCode = claimLineAppliedParameter.aliasCode
    ctrClaimLineAppliedParameter.limitCode = claimLineAppliedParameter.limit?.code
    ctrClaimLineAppliedParameter.productCode = claimLineAppliedParameter.product?.code
    ctrClaimLineAppliedParameter.maximumAmount = claimLineAppliedParameter.maximumAmount?.amount
    ctrClaimLineAppliedParameter.maximumAmountCurrency = claimLineAppliedParameter.maximumAmount?.currency?.code
    ctrClaimLineAppliedParameter.maximumNumber = claimLineAppliedParameter.maximumNumber
    ctrClaimLineAppliedParameter.maximumServiceDays = claimLineAppliedParameter.maximumServiceDays
    ctrClaimLineAppliedParameter.reachedAction = claimLineAppliedParameter.reachedAction
    ctrClaimLine.addCtrClaimLineAppliedParameter(ctrClaimLineAppliedParameter)
}

Create Financial Transaction

Dynamic functions of this type assign values to the financial transaction and the related financial transaction process data which are created when the claim is finalized. When a claim is finalized, a skeleton financial transaction is automatically created. The skeleton financial transaction holds the fixed attributes that are required for the next processing steps. These dynamic logic functions need to assign values to the financial transaction and its process data dependent on the customer requirements.

These dynamic functions are executed once per claim.

Table 4. Create Financial Transaction
Parameter Parameter Type Input or Output Description

transactionScenario

Input

Transaction creation scenario that has been selected for the current transaction. Provided to allow access to parameters of the scenario.

claim

Claim

Input

Claim being finalized. Included for reference purposes and the ability to add a financial hold to the claim.

ctrClaim

ctr Claim

Input

financialTransaction

Financial Transaction

Input /Output

Input: Skeleton financial transaction created when the claim is being finalized consisting of:

  • a base financial object if it not already exists</li>

  • a financial transaction with reference to the base financial object

  • a financial transaction process data with reference to the financial transaction

Output: financial transaction with all relevant attributes populated for the claim that is being finalized.

The following Financial Transaction fields are set outside of dynamic logic and cannot be set from the dynamic logic:

  • financialTransaction.version,

  • financialTransaction.reversal,

  • financialTransaction.subtype

  • financialTransaction.indicatorFinal

  • financialTransaction.processingType

  • financialTransaction.sourceString.

The dynamic logic can:

  • set attributes of the new Financial Transaction and corresponding Financial Transaction Process Data elements of the object.

  • add Financial Transaction Process Detail element and set their attributes

  • add claim holds using the predefined method addClaimHold

Example

 // Financial Transaction Process Data

 // Native Fields, for which local Dynamic Logic should be defined:
 // financialTransaction.financialTransactionProcessData.dueDate =
 // financialTransaction.financialTransactionProcessData.financialMessageMandatory =
 // financialTransaction.financialTransactionProcessData.finMessageBulkingGroup =
 // financialTransaction.financialTransactionProcessData.internalRemarks =
 // financialTransaction.financialTransactionProcessData.penaltyDate =

 // Add Financial Hold to the claim (optional)
 // claim.addClaimHold("HOLD_TYPE","EXPIRATION_DATE")

Create Financial Transaction Detail

Dynamic functions of this type create financial transaction details and the related financial transaction detail process data for claim line transaction coverage. Financial transaction details are not part of the skeleton financial transaction because there might be situations where no financial transaction detail is required for a claim line transaction coverage.

These dynamic functions are executed once per claim line transaction coverage.

Table 5. Create Financial Transaction Detail
Parameter Parameter Type Input or Output Description

transactionScenario

Input

Transaction creation scenario that has been selected for the current transaction. Provided to allow access to parameters of the scenario.

claim

Claim

Input

Claim being finalized. Included only for reference purposes.

claimLine

Claim Line

Input

Claim Line being processed.

ctrClaim

CTR Claim

Input

CTR Claim being processed.

ctrClaimLine

CTR Claim Line

Input

CTR Claim Line to which the CTR Coverage belongs.

ctrClaimLineCoverage

CTR Claim Line Coverage

Input

The CTR Coverage from which the values are read and passed to the financial transaction detail(s) and financial transaction detail process data.

financialTransaction

Financial Transaction

Input/Output

Input:Financial transaction constructed so far.

Output: Financial transaction with updated attribute(s) and/or new financial transaction detail(s).

The following Financial Transaction Detail field is set outside of dynamic logic and cannot be set from within the dynamic logic:

  • financialTransactionDetail.sequenceNumber.

The dynamic logic can:

  • create 0 or more default Financial Transaction Details. A default Financial Transaction Detail consists of

    • a Financial Transaction Detail with reference to the Financial Transaction

    • a Financial Transaction Detail Process Data with reference to the Financial Transaction Detail

  • set attributes of new Financial Transaction Detail and corresponding Financial Transaction Process Data elements

  • set Financial Transaction (and its corresponding process data) attributes

  • set Financial Transaction Process Detail attributes

  • adjust the total amount of the financial transaction when a financial transaction detail is created

The dynamic logic for creating financial transaction details is likely to be more complex than creating one financial transaction detail for each coverage. For example, logic may need to be added to break (some) coverages into multiple financial transaction details to handle allocations of a single covered amount to more than one payment receiver or to meet other specific accounting requirements.

Example

// Create Financial Transaction Details
def financialTransactionDetail = new FinancialTransactionDetail()
financialTransactionDetail.setDefaultValues()
financialTransactionDetail.amount = ctrClaimLineCoverage.amount
financialTransactionDetail.amountCurrency = ctrClaimLineCoverage.amountCurrency
financialTransactionDetail.componentCode = ctrClaimLineCoverage.coverageLabelCode
financialTransactionDetail.componentDisplaySequence = ctrClaimLineCoverage.coverageLabelDisplaySequence
financialTransactionDetail.numberOfUnits = ctrClaimLineCoverage.numberOfUnits
financialTransactionDetail.productBrandCode = ctrClaimLineCoverage.productBrandCode
financialTransactionDetail.productCode = ctrClaimLineCoverage.productCode
financialTransactionDetail.productFamilyCode = ctrClaimLineCoverage.productFamilyCode
// Financial Transaction Process Data
def financialTransactionDetailProcessData = new FinancialTransactionDetailProcessData()
financialTransactionDetailProcessData.setDefaultValues()
financialTransactionDetailProcessData.paymentBeneficiaryCode =  ctrClaim.payBeneficiaryProvCode != null ?  ctrClaim.payBeneficiaryProvCode : ctrClaim.payBeneficiaryRelCode
financialTransactionDetailProcessData.paymentBeneficiaryFlexCodeDefinitionCode = ctrClaim.payBeneficiaryProvCodeDef
financialTransactionDetailProcessData.counterpartyCode = ctrClaimLine.payReceiverProvCode != null ? ctrClaimLine.payReceiverProvCode : ctrClaimLine.payReceiverRelCode
financialTransactionDetailProcessData.counterpartyQualifier = ctrClaimLine.payReceiverProvCodeDef
// Native Fields, for which local Dynamic Logic should be defined:
// financialTransactionDetailProcessData.invoice =
// financialTransactionDetailProcessData.accountingBulkingGroup =
// financialTransactionDetailProcessData.accountDetailGrouping =
// financialTransactionDetailProcessData.accountingBulkingGroup =
// financialTransactionDetailProcessData.generalLedgerAccount =
// financialTransactionDetailProcessData.internalRemarks =
// financialTransactionDetailProcessData.invoiceBulkingGroup =
// financialTransactionDetailProcessData.invoiceLineBulkingGroup =
// financialTransactionDetailProcessData.invoiceLineGrouping =
// financialTransactionDetailProcessData.payFromBankAccount =

financialTransaction.addFinancialTransactionDetail(financialTransactionDetail)
financialTransactionDetail.setFinancialTransactionDetailProcessData(financialTransactionDetailProcessData)
financialTransactionDetailProcessData.setFinancialTransactionDetail(financialTransactionDetail)
// Update Financial Transaction Total Amount
financialTransaction.totalAmount = financialTransaction.totalAmount + financialTransactionDetail.amount
// Update Financial Transaction Total Amount Currency in case this was the first detail in the financial transaction
financialTransaction.totalAmountCurrency = financialTransactionDetail.amountCurrency

Change Financial Transaction

Dynamic functions of this type can add financial transaction details to a financial transaction and modify financial transaction and financial transaction process data attributes. This logic is intended for use to create financial transaction details that do not relate to specific claim line transaction coverages such as ASO fees to be charged per claim.

This function can also be used to modify reinsurance financial transaction details that were automatically created by the application.

These dynamic functions are executed once per claim.

Table 6. Change Financial Transaction
Parameter Parameter Type Input or Output Description

transactionScenario

Input

Transaction creation scenario that has been selected for the current transaction. Provided to allow access to parameters of the scenario.

claim

Claim

Input

Claim being finalized. Included for reference purposes and the ability to add a financial hold to the claim.

ctrClaim

CTR Claim

Input

reinsuranceMap

Map

Input

map between the reinsurance financial details and the claim line coverage from which they were generated. This allows customers to enrich reinsurance details with information that is available on the working copy claim

financialTransaction

Financial Transaction

Input /Output

Input:Financial transaction constructed in the create financial transaction dynamic logic function.

Output: Financial transaction with updated attributes.

The dynamic logic can:

  • create 0 or more Financial Transaction Details

  • set attributes of new Financial Transaction Detail and corresponding Financial Transaction Process Data elements

  • set Financial Transaction (and its corresponding process data) attributes

  • set Financial Transaction Process Detail attributes

  • adjust the total amount of the financial transaction in case additional financial transaction details are added

  • add claim holds using the predefined method addClaimHold

The dynamic logic for modifying financial transactions and adding financial transaction details depends heavily on the required scenario and is likely to be more complex than creating one financial transaction detail for each coverage. For example, logic may need to be added to create an additional financial transaction detail for handling of ASO fees where the amount and payment receiver are determined by look-up on person’s group accounts.

Example

// Create Financial Transaction Detail
FinancialTransactionDetail financialTransactionDetail = new FinancialTransactionDetail()
financialTransactionDetail.setDefaultValues()
financialTransactionDetail.componentCode = "ADMIN SERVICES FEE"
financialTransactionDetail.amount = -10
financialTransactionDetail.amountCurrency = "USD"
// Or, if this should be a percentage, instead of a fixed value:
//     financialTransactionDetail.amount = .05 * ctrClaim.totalCoveredAmount
//     financialTransactionDetail.amountCurrency = ctrClaim.totalCoveredAmountCurrency

// Create Financial Transaction Process Detail Data
FinancialTransactionDetailProcessData financialTransactionDetailProcessData = new FinancialTransactionDetailProcessData()
financialTransactionDetailProcessData.setDefaultValues()
// Populating various fields:
//     financialTransactionDetailProcessData.paymentBeneficiaryCode =
//     financialTransactionDetailProcessData.paymentBeneficiaryFlexCodeDefinitionCode =
//     financialTransactionDetailProcessData.counterpartyCode =
//     financialTransactionDetailProcessData.counterpartyQualifier =
//     financialTransactionDetailProcessData.invoice =
//     financialTransactionDetailProcessData.accountingBulkingGroup =
//     financialTransactionDetailProcessData.invoiceDestination = InvoiceDestination.Receivable
//     financialTransactionDetailProcessData.invoiceDestination = InvoiceDestination.Payable
//     financialTransactionDetailProcessData.accountDetailGrouping =
//     financialTransactionDetailProcessData.generalLedgerAccount =
//     financialTransactionDetailProcessData.internalRemarks =
//     financialTransactionDetailProcessData.invoiceBulkingGroup =
//     financialTransactionDetailProcessData.invoiceLineBulkingGroup =
//     financialTransactionDetailProcessData.invoiceLineGrouping =
//     financialTransactionDetailProcessData.payFromBankAccount =

// Link the Financial Transaction Detail to the Financial Transaction Detail Process Data, and vice versa

financialTransactionDetail.setFinancialTransactionDetailProcessData(financialTransactionDetailProcessData)
financialTransactionDetailProcessData.setFinancialTransactionDetail(financialTransactionDetail)

// Add the Financial Transaction Detail to the Financial Transaction

financialTransaction.addFinancialTransactionDetail(financialTransactionDetail);

// Update the total amount of the Financial Transaction

financialTransaction.totalAmount = financialTransaction.totalAmount + financialTransactionDetail.amount

// Set the total amount currency of the Financial Transaction, in case this was its first Financial Transaction Detail

financialTransaction.totalAmountCurrency = financialTransactionDetail.amountCurrency

// Enrich each of the reinsurance Financial Transaction Details with information that is available on the working copy claim

reinsuranceMap.each { financialTransactionDetail, claimLineCoverage ->
    financialTransactionDetail.exampleField1 = claimLineCoverage.exampleValue1
    financialTransactionDetail.exampleField2 = claimLineCoverage.claimLine.claim.exampleValue2
}