Add TRUST ResultStatus (#45)

This commit is contained in:
Baikov Dmitrii 2024-10-17 17:07:37 +03:00 committed by GitHub
parent df4ac1de4d
commit 3f5aa6c9b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 2 deletions

View File

@ -93,7 +93,8 @@ country_by
; ;
result result
: 'accept' : 'trust'
| 'accept'
| '3ds' | '3ds'
| 'highRisk' | 'highRisk'
| 'decline' | 'decline'
@ -103,7 +104,8 @@ result
; ;
catch_result catch_result
: 'accept' : 'trust'
| 'accept'
| '3ds' | '3ds'
| 'highRisk' | 'highRisk'
| 'notify' | 'notify'

View File

@ -5,6 +5,7 @@ import java.util.Map;
public enum ResultStatus { public enum ResultStatus {
TRUST("trust"),
ACCEPT("accept"), ACCEPT("accept"),
ACCEPT_AND_NOTIFY("acceptAndNotify"), ACCEPT_AND_NOTIFY("acceptAndNotify"),
THREE_DS("3ds"), THREE_DS("3ds"),

View File

@ -27,6 +27,13 @@ public class CustomTest extends AbstractPaymentTest {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
} }
@Test
void trustTest() throws Exception {
InputStream resourceAsStream = CustomTest.class.getResourceAsStream("/rules/trust.frd");
ResultModel result = parseAndVisit(resourceAsStream);
assertEquals(ResultStatus.TRUST, ResultUtils.findFirstNotNotifyStatus(result).get().getResultStatus());
}
@Test @Test
void threeDsTest() throws Exception { void threeDsTest() throws Exception {
InputStream resourceAsStream = CustomTest.class.getResourceAsStream("/rules/three_ds.frd"); InputStream resourceAsStream = CustomTest.class.getResourceAsStream("/rules/three_ds.frd");

View File

@ -0,0 +1,2 @@
rule: rand(2) < 3
-> trust;