diff --git a/pom.xml b/pom.xml index ff2e664..91fc104 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ fraudo - 0.0.21 + 0.0.22 Fraudo Language for describing antifraud patterns diff --git a/src/main/antlr4/com.rbkmoney.fraudo/FraudoPayment.g4 b/src/main/antlr4/com.rbkmoney.fraudo/FraudoPayment.g4 index fcae809..6fdfce9 100644 --- a/src/main/antlr4/com.rbkmoney.fraudo/FraudoPayment.g4 +++ b/src/main/antlr4/com.rbkmoney.fraudo/FraudoPayment.g4 @@ -38,6 +38,7 @@ relationalExpression | like | is_mobile | is_recurrent + | is_trusted ; unaryExpression @@ -110,5 +111,5 @@ is_recurrent ; is_trusted - : 'is_trusted' LPAREN RPAREN + : 'isTrusted' LPAREN RPAREN ; diff --git a/src/test/java/com/rbkmoney/fraudo/CustomTest.java b/src/test/java/com/rbkmoney/fraudo/CustomTest.java index 7dee2ae..ed83427 100644 --- a/src/test/java/com/rbkmoney/fraudo/CustomTest.java +++ b/src/test/java/com/rbkmoney/fraudo/CustomTest.java @@ -134,6 +134,17 @@ public class CustomTest extends AbstractPaymentTest { assertEquals(ResultStatus.ACCEPT, ResultUtils.findFirstNotNotifyStatus(result).get().getResultStatus()); } + @Test + public void trustedTest() throws Exception { + InputStream resourceAsStream = CustomTest.class.getResourceAsStream("/rules/is_trusted.frd"); + when(customerTypeResolver.isTrusted(any())).thenReturn(true); + + ParseContext parseContext = getParseContext(resourceAsStream); + PaymentModel model = new PaymentModel(); + ResultModel result = invoke(parseContext, model); + assertEquals(ResultStatus.ACCEPT, ResultUtils.findFirstNotNotifyStatus(result).get().getResultStatus()); + } + @Test public void payerTypeTest() throws Exception { InputStream resourceAsStream = CustomTest.class.getResourceAsStream("/rules/is_recurrent.frd"); diff --git a/src/test/resources/rules/is_trusted.frd b/src/test/resources/rules/is_trusted.frd new file mode 100644 index 0000000..705b357 --- /dev/null +++ b/src/test/resources/rules/is_trusted.frd @@ -0,0 +1 @@ +rule: isTrusted() -> accept;