Skip to content

Commit bddc4a5

Browse files
committed
SDK-2493: Add new helper methods for session notifications
1 parent 1538ee0 commit bddc4a5

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

yoti-sdk-api/src/main/java/com/yoti/api/client/docs/DocScanConstants.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ private DocScanConstants() { }
5353
public static final String CHECK_COMPLETION = "CHECK_COMPLETION";
5454
public static final String SESSION_COMPLETION = "SESSION_COMPLETION";
5555
public static final String CLIENT_SESSION_TOKEN_DELETED = "CLIENT_SESSION_TOKEN_DELETED";
56+
public static final String NEW_PDF_SUPPLIED = "NEW_PDF_SUPPLIED";
57+
public static final String INSTRUCTIONS_EMAIL_REQUESTED = "INSTRUCTIONS_EMAIL_REQUESTED";
58+
public static final String THANK_YOU_EMAIL_REQUESTED = "THANK_YOU_EMAIL_REQUESTED";
59+
public static final String FIRST_BRANCH_VISIT = "FIRST_BRANCH_VISIT";
5660

5761
public static final String ALWAYS = "ALWAYS";
5862
public static final String FALLBACK = "FALLBACK";

yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/NotificationConfig.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,42 @@ public Builder forClientSessionCompletion() {
175175
return withTopic(DocScanConstants.CLIENT_SESSION_TOKEN_DELETED);
176176
}
177177

178+
/**
179+
* Adds NEW_PDF_SUPPLIED to the list of topics that trigger notification messages
180+
*
181+
* @return the builder
182+
*/
183+
public Builder forNewPdfSupplied() {
184+
return withTopic(DocScanConstants.NEW_PDF_SUPPLIED);
185+
}
186+
187+
/**
188+
* Adds INSTRUCTIONS_EMAIL_REQUESTED to the list of topics that trigger notification messages
189+
*
190+
* @return the builder
191+
*/
192+
public Builder forInstructionsEmailRequested() {
193+
return withTopic(DocScanConstants.INSTRUCTIONS_EMAIL_REQUESTED);
194+
}
195+
196+
/**
197+
* Adds THANK_YOU_EMAIL_REQUESTED to the list of topics that trigger notification messages
198+
*
199+
* @return the builder
200+
*/
201+
public Builder forThankYouEmailRequested() {
202+
return withTopic(DocScanConstants.THANK_YOU_EMAIL_REQUESTED);
203+
}
204+
205+
/**
206+
* Adds FIRST_BRANCH_VISIT to the list of topics that trigger notification messages
207+
*
208+
* @return the builder
209+
*/
210+
public Builder forFirstBranchVisit() {
211+
return withTopic(DocScanConstants.FIRST_BRANCH_VISIT);
212+
}
213+
178214
/**
179215
* Adds a topic to the list of topics that trigger notification messages
180216
*

yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/NotificationConfigTest.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,46 @@ public void shouldCreateSimpleNotificationConfigWithTaskCompletion() {
6969
assertThat(result.getTopics(), hasItem("RESOURCE_UPDATE"));
7070
}
7171

72+
@Test
73+
public void shouldCreateSimpleNotificationConfigWithNewPdfSupplied() {
74+
NotificationConfig result = NotificationConfig.builder()
75+
.withEndpoint(SOME_ENDPOINT)
76+
.forNewPdfSupplied()
77+
.build();
78+
79+
assertThat(result.getTopics(), hasItem("NEW_PDF_SUPPLIED"));
80+
}
81+
82+
@Test
83+
public void shouldCreateSimpleNotificationConfigWithInstructionsEmailRequested() {
84+
NotificationConfig result = NotificationConfig.builder()
85+
.withEndpoint(SOME_ENDPOINT)
86+
.forInstructionsEmailRequested()
87+
.build();
88+
89+
assertThat(result.getTopics(), hasItem("INSTRUCTIONS_EMAIL_REQUESTED"));
90+
}
91+
92+
@Test
93+
public void shouldCreateSimpleNotificationConfigWithThankYouEmailRequested() {
94+
NotificationConfig result = NotificationConfig.builder()
95+
.withEndpoint(SOME_ENDPOINT)
96+
.forThankYouEmailRequested()
97+
.build();
98+
99+
assertThat(result.getTopics(), hasItem("THANK_YOU_EMAIL_REQUESTED"));
100+
}
101+
102+
@Test
103+
public void shouldCreateSimpleNotificationConfigWithFirstBranchVisit() {
104+
NotificationConfig result = NotificationConfig.builder()
105+
.withEndpoint(SOME_ENDPOINT)
106+
.forFirstBranchVisit()
107+
.build();
108+
109+
assertThat(result.getTopics(), hasItem("FIRST_BRANCH_VISIT"));
110+
}
111+
72112
@Test
73113
public void shouldCreateSimpleNotificationConfigWithAllNotificationOptions() {
74114
NotificationConfig result = NotificationConfig.builder()

0 commit comments

Comments
 (0)