use of org.folio.circulation.domain.notice.NoticeConfiguration in project mod-circulation by folio-org.
the class TitleLevelRequestNoticeSender method applyTlrCancellationNotice.
private CompletableFuture<Result<Void>> applyTlrCancellationNotice(TlrSettingsConfiguration tlrSettings, PatronNoticeEvent patronNoticeEvent) {
UUID cancellationTemplateId = tlrSettings.getCancellationPatronNoticeTemplateId();
if (cancellationTemplateId != null) {
NoticeLogContext noticeLogContext = new NoticeLogContext().withTriggeringEvent(patronNoticeEvent.getEventType().getRepresentation()).withTemplateId(cancellationTemplateId.toString());
NoticeConfiguration noticeConfiguration = buildTlrNoticeConfiguration(patronNoticeEvent, cancellationTemplateId);
PatronNotice patronNotice = new PatronNotice(patronNoticeEvent.getUser().getId(), patronNoticeEvent.getNoticeContext(), noticeConfiguration);
return patronNoticeService.sendNotice(patronNotice, noticeLogContext);
}
return ofAsync(() -> null);
}
use of org.folio.circulation.domain.notice.NoticeConfiguration in project mod-circulation by folio-org.
the class TitleLevelRequestNoticeSender method applyTlrConfirmationNotice.
private CompletableFuture<Result<Void>> applyTlrConfirmationNotice(TlrSettingsConfiguration tlrSettings, PatronNoticeEvent patronNoticeEvent) {
UUID confirmationTemplateId = tlrSettings.getConfirmationPatronNoticeTemplateId();
if (confirmationTemplateId != null) {
NoticeLogContext noticeLogContext = new NoticeLogContext().withTriggeringEvent(patronNoticeEvent.getEventType().getRepresentation()).withTemplateId(confirmationTemplateId.toString());
NoticeConfiguration noticeConfiguration = buildTlrNoticeConfiguration(patronNoticeEvent, confirmationTemplateId);
PatronNotice patronNotice = new PatronNotice(patronNoticeEvent.getUser().getId(), patronNoticeEvent.getNoticeContext(), noticeConfiguration);
return patronNoticeService.sendNotice(patronNotice, noticeLogContext);
}
return ofAsync(() -> null);
}
use of org.folio.circulation.domain.notice.NoticeConfiguration in project mod-circulation by folio-org.
the class RequestScheduledNoticeService method scheduleRequestNoticesBasedOnTlrSettings.
private Result<TlrSettingsConfiguration> scheduleRequestNoticesBasedOnTlrSettings(Request request, TlrSettingsConfiguration tlrSettingsConfiguration) {
UUID expirationTemplateId = tlrSettingsConfiguration.getExpirationPatronNoticeTemplateId();
if (expirationTemplateId != null) {
NoticeConfiguration noticeConfiguration = new NoticeConfigurationBuilder().setTemplateId(expirationTemplateId.toString()).setNoticeFormat(NoticeFormat.EMAIL).setNoticeEventType(NoticeEventType.TITLE_LEVEL_REQUEST_EXPIRATION).setTiming(UPON_AT).setRecurring(false).setSendInRealTime(true).build();
createRequestExpirationScheduledNotice(request, noticeConfiguration, TITLE_LEVEL_REQUEST_EXPIRATION).map(scheduledNoticesRepository::create);
} else {
log.info("ExpirationPatronNoticeTemplateId is not present, scheduled notice will not be created");
}
return succeeded(tlrSettingsConfiguration);
}
Aggregations