Open topic with navigation

TIBCO BusinessEvents® Enterprise Edition 6.3.1

# Adding the FraudDetection Rule

Here is the example code for adding the FraudDetection rule.

Copy

FraudDetection Rule Source Code

    /**
     * @description
     * @author
     */
    rule Rules.FraudDetection {

        attribute {
            priority = 5;
            forwardChain = true;
        }

        declare {
            Concepts.Account    account;
        }

        when {

            //1. Checks that the Account status is not set to Suspended
            account.Status != "Suspended";

            //2. Checks the number of debits in the verification interval
            (Temporal.History.howMany(
                    account.Debits,
                    DateTime.getTimeInMillis(DateTime.now()) - FraudCriteria.interval,
                    DateTime.getTimeInMillis(DateTime.now()),
                    true)
                > FraudCriteria.numTransactions &&

            //3. Checks the percentage of the average balance that was debited in the verification interval
            Temporal.Numeric.addAllHistoryDouble(
                    account.Debits,
                    DateTime.getTimeInMillis(DateTime.now()) - FraudCriteria.interval)
                > (FraudCriteria.debitsPercent * account.AvgMonthlyBalance));
        }

        then {
            account.Status = "Suspended";
            System.debugOut("#### Account ID " + account@extId
                    + " STATUS set to Suspended. Fraud suspected.");
        }

    }

Did you find this helpful?

YesNo
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO BusinessEvents® Enterprise Edition

Copyright © 2004-2024. Cloud Software Group, Inc. All Rights Reserved.