Skip to content

Commit

Permalink
Propagate Notify errors back to request for information.
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-saunders-cts committed Jan 10, 2025
1 parent f4ff3cb commit d611763
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ public ResponseEntity<CallbackResponse> sendDocumentReceivedNotification(
}

@PostMapping(path = "/stopped-information-request")
public ResponseEntity<CallbackResponse> informationRequest(@RequestBody CallbackRequest callbackRequest) {
public ResponseEntity<CallbackResponse> informationRequest(
@RequestBody final CallbackRequest callbackRequest) throws NotificationClientException {
Optional<UserInfo> caseworkerInfo = userInfoService.getCaseworkerInfo();
return ResponseEntity.ok(informationRequestService.handleInformationRequest(callbackRequest, caseworkerInfo));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class InformationRequestCorrespondenceService {

private final NotificationService notificationService;

public List<Document> emailInformationRequest(CaseDetails caseDetails) {
public List<Document> emailInformationRequest(CaseDetails caseDetails) throws NotificationClientException {
try {
final Document notification = notificationService.sendEmail(CASE_STOPPED_REQUEST_INFORMATION, caseDetails);
log.info("Successful response for request for information email for case id {} ", caseDetails.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ public class InformationRequestService {
private final CallbackResponseTransformer callbackResponseTransformer;
private final EmailAddressNotifyApplicantValidationRule emailAddressNotifyApplicantValidationRule;

public CallbackResponse handleInformationRequest(CallbackRequest callbackRequest,
Optional<UserInfo> caseworkerInfo) {
public CallbackResponse handleInformationRequest(
final CallbackRequest callbackRequest,
final Optional<UserInfo> caseworkerInfo) throws NotificationClientException {
CaseData caseData = callbackRequest.getCaseDetails().getData();
CCDData dataForEmailAddress = CCDData.builder()
.applicationType(caseData.getApplicationType().name())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void setup() {
}

@Test
void testEmailRequestReturnsSentEmailDocumentSuccessfully() {
void testEmailRequestReturnsSentEmailDocumentSuccessfully() throws NotificationClientException {
CollectionMember<Document> documentCollectionMember =
new CollectionMember<>(Document.builder().documentType(DocumentType.SENT_EMAIL).build());
documentList = new ArrayList<>();
Expand Down Expand Up @@ -102,7 +102,7 @@ void testEmailRequestReturnsSentEmailDocumentSuccessfully() {
}

@Test
void testEmailRequestReturnsErrorWhenNoEmailProvided() {
void testEmailRequestReturnsErrorWhenNoEmailProvided() throws NotificationClientException {
caseData = CaseData.builder()
.applicationType(ApplicationType.PERSONAL)
.build();
Expand Down

0 comments on commit d611763

Please sign in to comment.