Skip to content

Commit

Permalink
SDK-2493: Add new helper methods for session notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBurtyyy committed Sep 24, 2024
1 parent 1538ee0 commit bddc4a5
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ private DocScanConstants() { }
public static final String CHECK_COMPLETION = "CHECK_COMPLETION";
public static final String SESSION_COMPLETION = "SESSION_COMPLETION";
public static final String CLIENT_SESSION_TOKEN_DELETED = "CLIENT_SESSION_TOKEN_DELETED";
public static final String NEW_PDF_SUPPLIED = "NEW_PDF_SUPPLIED";
public static final String INSTRUCTIONS_EMAIL_REQUESTED = "INSTRUCTIONS_EMAIL_REQUESTED";
public static final String THANK_YOU_EMAIL_REQUESTED = "THANK_YOU_EMAIL_REQUESTED";
public static final String FIRST_BRANCH_VISIT = "FIRST_BRANCH_VISIT";

public static final String ALWAYS = "ALWAYS";
public static final String FALLBACK = "FALLBACK";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,42 @@ public Builder forClientSessionCompletion() {
return withTopic(DocScanConstants.CLIENT_SESSION_TOKEN_DELETED);
}

/**
* Adds NEW_PDF_SUPPLIED to the list of topics that trigger notification messages
*
* @return the builder
*/
public Builder forNewPdfSupplied() {
return withTopic(DocScanConstants.NEW_PDF_SUPPLIED);
}

/**
* Adds INSTRUCTIONS_EMAIL_REQUESTED to the list of topics that trigger notification messages
*
* @return the builder
*/
public Builder forInstructionsEmailRequested() {
return withTopic(DocScanConstants.INSTRUCTIONS_EMAIL_REQUESTED);
}

/**
* Adds THANK_YOU_EMAIL_REQUESTED to the list of topics that trigger notification messages
*
* @return the builder
*/
public Builder forThankYouEmailRequested() {
return withTopic(DocScanConstants.THANK_YOU_EMAIL_REQUESTED);
}

/**
* Adds FIRST_BRANCH_VISIT to the list of topics that trigger notification messages
*
* @return the builder
*/
public Builder forFirstBranchVisit() {
return withTopic(DocScanConstants.FIRST_BRANCH_VISIT);
}

/**
* Adds a topic to the list of topics that trigger notification messages
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,46 @@ public void shouldCreateSimpleNotificationConfigWithTaskCompletion() {
assertThat(result.getTopics(), hasItem("RESOURCE_UPDATE"));
}

@Test
public void shouldCreateSimpleNotificationConfigWithNewPdfSupplied() {
NotificationConfig result = NotificationConfig.builder()
.withEndpoint(SOME_ENDPOINT)
.forNewPdfSupplied()
.build();

assertThat(result.getTopics(), hasItem("NEW_PDF_SUPPLIED"));
}

@Test
public void shouldCreateSimpleNotificationConfigWithInstructionsEmailRequested() {
NotificationConfig result = NotificationConfig.builder()
.withEndpoint(SOME_ENDPOINT)
.forInstructionsEmailRequested()
.build();

assertThat(result.getTopics(), hasItem("INSTRUCTIONS_EMAIL_REQUESTED"));
}

@Test
public void shouldCreateSimpleNotificationConfigWithThankYouEmailRequested() {
NotificationConfig result = NotificationConfig.builder()
.withEndpoint(SOME_ENDPOINT)
.forThankYouEmailRequested()
.build();

assertThat(result.getTopics(), hasItem("THANK_YOU_EMAIL_REQUESTED"));
}

@Test
public void shouldCreateSimpleNotificationConfigWithFirstBranchVisit() {
NotificationConfig result = NotificationConfig.builder()
.withEndpoint(SOME_ENDPOINT)
.forFirstBranchVisit()
.build();

assertThat(result.getTopics(), hasItem("FIRST_BRANCH_VISIT"));
}

@Test
public void shouldCreateSimpleNotificationConfigWithAllNotificationOptions() {
NotificationConfig result = NotificationConfig.builder()
Expand Down

0 comments on commit bddc4a5

Please sign in to comment.