Skip to content

Commit b681b33

Browse files
issues with rule filter are fixed. Also internal function issues fixed.
1 parent 0734c0c commit b681b33

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

test/rules.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var rules = [
3333
"name": "transaction minimum",
3434
"description": "blocks transactions below value x",
3535
"priority": 3,
36-
"on":1,
36+
"on":true,
3737
"condition":
3838
function(R) {
3939
R.when(this && (this.transactionTotal < 500));
@@ -50,7 +50,7 @@ var rules = [
5050
"name" : "high credibility customer - avoid checks and bypass",
5151
"description" : "if the users credibility value is more, then avoid checking further.",
5252
"priority":2,
53-
"on":1,
53+
"on":true,
5454
"condition":
5555
function(R) {
5656
R.when(this && this.userCredibility && (this.userCredibility > 5));
@@ -67,7 +67,7 @@ var rules = [
6767
"name": "block AME > 10000",
6868
"description": "filter American Express credit cards for payment above 10000",
6969
"priority": 4,
70-
"on":1,
70+
"on":true,
7171
"condition":
7272
function(R) {
7373
R.when(this && (this.cardType == "Credit Card") && (this.cardIssuer == "American Express") && (this.transactionTotal > 1000));
@@ -84,7 +84,7 @@ var rules = [
8484
"name":"block Cashcard Payment",
8585
"description": "reject the payment if the payment type belong to cash card",
8686
"priority":8,
87-
"on":1,
87+
"on":true,
8888
"condition":
8989
function(R) {
9090

@@ -105,7 +105,7 @@ var rules = [
105105
"name":"block guest payment above 10000",
106106
"description": "reject the payment if the payment above 10000 and customer type is guest",
107107
"priority":6,
108-
"on":1,
108+
"on":true,
109109
"condition":
110110
function(R) {
111111
R.when(this && this.customerType && (this.transactionTotal > 10000) && (this.customerType == "guest"));
@@ -122,7 +122,7 @@ var rules = [
122122
"name" : "is customer guest?",
123123
"description" : "support rule written for blocking payment above 10000 from guests",
124124
"priority":7,
125-
"on":1,
125+
"on":true,
126126
"condition":
127127
function(R) {
128128
R.when(this && !this.userLoggedIn);
@@ -139,7 +139,7 @@ var rules = [
139139
"name" : "block payment from specific app",
140140
"description" : "turn on this rule to block the payment from a specific app",
141141
"priority":5,
142-
"on":1,
142+
"on":true,
143143
"condition":
144144
function(R) {
145145
R.when(this && this.appCode && (this.appCode == "MOBI4"));
@@ -156,7 +156,7 @@ var rules = [
156156
"name" : "event risk score",
157157
"description" : "if the event is top priority event, then do further checks else leave.",
158158
"priority":2,
159-
"on":1,
159+
"on":true,
160160
"condition":
161161
function(R) {
162162
R.when(this && this.eventRiskFactor && (this.eventRiskFactor < 5));
@@ -173,7 +173,7 @@ var rules = [
173173
"name" : "block ip range set",
174174
"description" : "if the ip fall in the given list of formats, then block the transaction.",
175175
"priority":3,
176-
"on":1,
176+
"on":true,
177177
"condition":
178178
function(R) {
179179
var allowedRegexp = new RegExp('^(?:' +
@@ -343,7 +343,7 @@ console.log("\n-------\nstart execution of rules\n------");
343343

344344
R.execute(user7,function(result){ if(result.result) console.log("\n-----Payment Accepted for----\n"); else console.log("\n-----Payment Rejected for----\n");console.log(result); });
345345

346-
R.execute(user1,function(result){ if(result.result) console.log("\n-----Payment Accepted for----\n"); else console.log("\n-----Payment Rejected for----\n"); console.log(result); });
346+
/*R.execute(user1,function(result){ if(result.result) console.log("\n-----Payment Accepted for----\n"); else console.log("\n-----Payment Rejected for----\n"); console.log(result); });
347347
348348
R.execute(user2,function(result){ if(result.result) console.log("\n-----Payment Accepted for----\n"); else console.log("\n-----Payment Rejected for----\n");console.log(result); });
349349
@@ -356,3 +356,4 @@ R.execute(user5,function(result){ if(result.result) console.log("\n-----Payment
356356
R.execute(user6,function(result){ if(result.result) console.log("\n-----Payment Accepted for----\n"); else console.log("\n-----Payment Rejected for----\n");console.log(result); });
357357
358358
R.execute(user8,function(result){ if(result.result) console.log("\n-----Payment Accepted for----\n"); else console.log("\n-----Payment Rejected for----\n");console.log(result); });
359+
*/

0 commit comments

Comments
 (0)