Decision-Testing¶
Create Decision Test¶
Adding rules:¶
Add configuration file to ~\Risk\Risk.Rules\Risk.Rules.Test\AutomationLayer\TestData\s3\
Example
blocklist_speed_config:
```json{
"DecisionName": "Blocklist_Testing",
"Features": {
"merchantId/access-control/blockedList/equals/bool?": "merchantId.IsBlockedInBlockedList",
"userId/access-control/blockedList/equals/bool?": "userId.IsBlockedInBlockedList",
"merchantId/access-control/merchantId/equals/bool?": "merchantId.IsBlockedInMerchantIdList",
"merchantId/list/blocked/Everywhere/equals/bool": "merchantCode.IsBlocked",
"blockedList/access-control/list": "merchantIdBlockedList",
"allowedlist/access-control/list": "merchantIdAllowedList",
"input/blocklist_testing/AllowedmerchantId/string": "AllowedMerchantId",
"input/blocklist_testing/BlockedmerchantId/string": "BlockedmerchantId"
},
"Rules": [
{
"Id": "f79a396c-4458-4f7d-8da1-f34e3rde0bee",
"Name": "Check Merchant Id is blocked",
"Description": "Rule to test Access Control List",
"Order": 1,
"LastUpdatedBy": "thilini.kaluthanthri@majority.com",
"LastUpdatedOn": "2023-06-15T16:31:05.454319Z",
"MessageToUserTemplate": "TemporaryBlock",
"RuleState": "Online"
},
{
"Id": "f79a396c-4458-4f7d-8da1-f34e3rde0bcc",
"Name": "Check User Id or merchant Id is blocked",
"Description": "Rule to test Access Control List On BlockList",
"Order": 2,
"LastUpdatedBy": "thilini.kaluthanthri@majority.com",
"LastUpdatedOn": "2023-06-16T16:31:05.454319Z",
"MessageToUserTemplate": "TemporaryBlock",
"RuleState": "Online"
},
{
"Id": "b00a0eb3-e3eb-4c6a-abbf-06675d613845",
"Name": "Check Merchant Code is blocked",
"Description": "If merchant code is in blocked list then deny",
"Order": 3,
"LastUpdatedBy": "Jansi Rajkumar Thangapandi",
"LastUpdatedOn": "2023-01-24T09:53:00.1424201Z",
"MessageToUserTemplate": "TemporaryBlock",
"RuleState": "Online"
},
{
"Id": "e8bb7388-10c3-43a2-953f-dbad2c9f67c1",
"Name": "DenyTransaction If merchantId Not In Allowed List",
"Description": "DenyTransaction If merchantId Not In List",
"LastUpdatedBy": "Jansi Rajkumar Thangapandi",
"LastUpdatedOn": "2023-07-20T12:53:20.000Z",
"MessageToUserTemplate": "ACHDailyMax",
"Order": 4,
"RuleState": "Online"
},
{
"Id": "cfd24daf-001c-4cbc-907d-3e385b1f0688",
"Name": "MerchantId in Blocked list then Deny",
"Description": "MerchantId in Blocked list then Deny",
"LastUpdatedBy": "Jansi Rajkumar Thangapandi",
"LastUpdatedOn": "2023-07-20T12:54:11.886Z",
"MessageToUserTemplate": "ACHMonthlyMax",
"Order": 5,
"RuleState": "Online"
}
],
"IsActive": true
}
Then under ~\Risk\Risk.Rules\Risk.Rules.Test\AutomationLayer\TestData\s3\rules\ create a folder called the same as the config file (minus the config part). E.g. blocklist_testing
Under the new folder create xml files for each rule, name after the rule id e.g. b00a0eb3-e3eb-4c6a-abbf-06675d613845 (note: no .xml)
```xml
<?xml version="1.0" encoding="utf-8"?>
<codeeffects xmlns="https://codeeffects.com/schemas/rule/41"
xmlns:ui="https://codeeffects.com/schemas/ui/4">
<rule id="b00a0eb3-e3eb-4c6a-abbf-06675d613845" webrule="5.0.24.8"
utc="2023-01-24T09:53:00.1183"
type="Risk.Rules.Service.Rule.Types.FlexType, Risk.Rules.Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
eval="false">
<definition>
<if>
<clause>
<condition type="equal">
<property name="merchantId/list/blocked/Everywhere/equals/bool" />
<value type="System.Boolean">true</value>
</condition>
</clause>
<then>
<method name="Deny" />
</then>
</if>
</definition>
<format>
<lines />
</format>
</rule>
</codeeffects>
Note: Set the above created files to copy always in Visual Studio.
When the above is done add a decision point to the ~\Risk\app-config\risk-decision-points-config.json
e.g.:
"Blocklist_Testing": {
"Id": 8,
"Name": "Blocklist_Testing",
"IsActive": true,
"Description": "For testing block list feature",
"Features": [
"merchantId.IsBlockedInBlockedList",
"userId.IsBlockedInBlockedList",
"merchantId.IsBlockedInMerchantIdList"
],
"Actions": [],
"Limits": {},
"ReferencedDecisionPoints": []
},