This check if the user has already 5 debit cards saved. If yes, it doesn't allows more debit cards to be saved. This is per user checking
{
"tenantId": 600962,
"configDefinitionCode": "CCSZZZZ0017",
"schemaCode": "SCMZZZZ0005",
"schemaVersion": 1,
"configVersion": 1,
"configuration": "ruleName: 'PAYMENT_INSTRUMENT_ATTEMPTS'\ndrl: 'import com.synapse.castle.ruleengine.input.PaymentInstrumentAttemptsRuleInput;\n import com.synapse.castle.ruleengine.output.PaymentInstrumentAttemptsRuleOutput;\n import com.synapse.castle.entity.PaymentInstrument;\n import java.util.*;\n \n global PaymentInstrumentAttemptsRuleOutput ruleEvaluationOutput;\n \n dialect \"mvel\"\n \n rule \"Rule for checking if the number of debit cards exceeds the debit card limit\"\n agenda-group \"PAYMENT_INSTRUMENT_ATTEMPTS\"\n when\n $input: PaymentInstrumentAttemptsRuleInput()\n eval($input.getPaymentInstrumentType() == \"DEBIT_CARD\")\n List(size >= 5) from collect(PaymentInstrument(paymentInstrumentType.name() == \"DEBIT_CARD\") from $input.getPaymentInstruments())\n then\n ruleEvaluationOutput.setResult(PaymentInstrumentAttemptsRuleOutput.Result.NOT_ALLOWED);\n ruleEvaluationOutput.setReason(\"DEBIT_CARD_LIMIT_EXCEEDED\");\n ruleEvaluationOutput.setTriggeredRuleName(\"Rule for checking if the number of debit cards exceeds the debit card limit\");\n halt();\n end'",
"configurationType": "TENANT",
"configurationTypeId": "600962",
"status": "ACTIVE",
"hasSecrets": true,
"createdBy": "f43d697b-7da3-4b96-b5e9-0c9949b33662",
"createdAt": "2025-12-24T06:30:18.854Z",
"updatedAt": "2025-12-24T06:30:18.854Z"
}
ruleName: 'PAYMENT_INSTRUMENT_ATTEMPTS'
drl: 'import com.synapse.castle.ruleengine.input.PaymentInstrumentAttemptsRuleInput;
import com.synapse.castle.ruleengine.output.PaymentInstrumentAttemptsRuleOutput;
import com.synapse.castle.entity.PaymentInstrument;
import java.util.*;
global PaymentInstrumentAttemptsRuleOutput ruleEvaluationOutput;
dialect "mvel"
rule "Rule for checking if the number of debit cards exceeds the debit card limit"
agenda-group "PAYMENT_INSTRUMENT_ATTEMPTS"
when
$input: PaymentInstrumentAttemptsRuleInput()
eval($input.getPaymentInstrumentType() == "DEBIT_CARD")
List(size >= 5) from collect(PaymentInstrument(paymentInstrumentType.name() == "DEBIT_CARD") from $input.getPaymentInstruments())
then
ruleEvaluationOutput.setResult(PaymentInstrumentAttemptsRuleOutput.Result.NOT_ALLOWED);
ruleEvaluationOutput.setReason("DEBIT_CARD_LIMIT_EXCEEDED");
ruleEvaluationOutput.setTriggeredRuleName("Rule for checking if the number of debit cards exceeds the debit card limit");
halt();
end'