This commit is contained in:
Zeeshaun
2026-03-24 15:26:03 -05:00
parent 1e5beb292a
commit 9cc87337b8
333 changed files with 17931 additions and 0 deletions
@@ -0,0 +1,351 @@
using LCU.Api.Internal.DispatcherSharedLib.Configurations;
using LCU.Api.Internal.FTPLib.Models;
using LCU.API.Internal.BlendApiWrapperModels.Models.Request;
using LCU.Library.Internal.ArchiverApiModel.Models;
using LCU.Library.Internal.DataCleanUpModel.Models;
using LCU.Library.Internal.DialerApiModels.Requests;
using LCU.Library.Internal.DialerApiModels.Requests.CreateVoAppsCampaign;
using LCU.Library.Internal.DialerApiModels.Requests.UploadVoAppsCampaignResults;
using LCU.Library.Internal.DispatcherModels.Enums;
using LCU.Library.Internal.DocumentIngestorModels.Models;
using LCU.Library.Internal.DocumentIngestorModels.Requests;
using LCU.Library.Internal.DocumentTypeCleanupModels.Models;
using LCU.Library.Internal.FileOperationsModels.Models;
using LCU.Library.Internal.FileOperationsModels.Models.Requests;
using LCU.Library.Internal.FileUpdaterModels.Models.Requests;
using LCU.Library.Internal.IncentiveApiModels.Requests;
using LCU.Library.Internal.MomBotModels.Models;
using LCU.Library.Internal.NoticeProcessorModel.Models;
using LCU.Library.Internal.NotificationsModels.Models;
using LCU.Library.Internal.RealTimeAlertsModels.Models.Requests;
using LCU.Library.Internal.RemoteDepositCaptureModel.Models;
using LCU.Library.Internal.RepoApiModels.Models.Requests;
using LCU.Library.Internal.TemenosNotificationApiModels.Requests;
using System;
namespace LCU.Api.Internal.DispatcherSharedLib.BuilderServices;
public class ActionBuilderService : IActionBuilderService
{
private readonly FileOperationsApiConfiguration _fileOperationsApiConfiguration;
private readonly FtpApiConfiguration _ftpApiConfiguration;
private readonly NotificationApiConfiguration _notificationApiConfiguration;
private readonly ArchiverApiConfiguration _archiverApiConfiguration;
private readonly DocumentIngestorApiConfiguration _documentIngestorApiConfiguration;
private readonly DocumentTypeCleanupApiConfiguration _documentTypeCleanupApiConfiguration;
private readonly HistoricalDocumentIngestorApiConfiguration _historicalDocumentIngestorApiConfiguration;
private readonly RemoteDepositCaptureApiConfiguration _remoteDepositCaptureApiConfiguration;
private readonly DataCleanUpApiConfiguration _dataCleanUpApiConfiguration;
private readonly NoticeProcessorApiConfiguration _noticeProcessorApiConfiguration;
private readonly MomBotApiConfiguration _momBotApiConfiguration;
private readonly BlendApiConfiguration _blendApiConfiguration;
private readonly DialerApiConfiguration _dialerApiConfiguration;
private readonly IncentiveManagerConfiguration _incentiveManagerApiConfiguration;
private readonly FileUpdaterApiConfiguration _fileUpdaterApiConfiguration;
private readonly TemenosNotificationApiConfiguration _temenosNotificationApiConfiguration;
private readonly RealTimeAlertsApiConfiguration _realTimeAlertsApiConfiguration;
private readonly RepoApiConfiguration _repoApiConfiguration;
public ActionBuilderService(FileOperationsApiConfiguration fileOperationsApiConfiguration,
FtpApiConfiguration ftpApiConfiguration,
NotificationApiConfiguration notificationApiConfiguration,
ArchiverApiConfiguration archiverApiConfiguration,
DocumentIngestorApiConfiguration documentIngestorApiConfiguration,
DocumentTypeCleanupApiConfiguration documentTypeCleanupApiConfiguration,
HistoricalDocumentIngestorApiConfiguration historicalDocumentIngestorApiConfiguration,
RemoteDepositCaptureApiConfiguration remoteDepositCaptureApiConfiguration,
DataCleanUpApiConfiguration dataCleanUpApiConfiguration,
NoticeProcessorApiConfiguration noticeProcessorApiConfiguration,
MomBotApiConfiguration momBotApiConfiguration,
BlendApiConfiguration blendApiConfiguration,
DialerApiConfiguration dialerApiConfiguration,
IncentiveManagerConfiguration incentiveManagerConfiguration,
FileUpdaterApiConfiguration fileUpdaterApiConfiguration,
TemenosNotificationApiConfiguration temenosNotificationApiConfiguration,
RealTimeAlertsApiConfiguration realTimeAlertsApiConfiguration,
RepoApiConfiguration repoApiConfiguration)
{
_fileOperationsApiConfiguration = fileOperationsApiConfiguration;
_ftpApiConfiguration = ftpApiConfiguration;
_notificationApiConfiguration = notificationApiConfiguration;
_archiverApiConfiguration = archiverApiConfiguration;
_documentIngestorApiConfiguration = documentIngestorApiConfiguration;
_documentTypeCleanupApiConfiguration = documentTypeCleanupApiConfiguration;
_historicalDocumentIngestorApiConfiguration = historicalDocumentIngestorApiConfiguration;
_remoteDepositCaptureApiConfiguration = remoteDepositCaptureApiConfiguration;
_dataCleanUpApiConfiguration = dataCleanUpApiConfiguration;
_noticeProcessorApiConfiguration = noticeProcessorApiConfiguration;
_momBotApiConfiguration = momBotApiConfiguration;
_blendApiConfiguration = blendApiConfiguration;
_dialerApiConfiguration = dialerApiConfiguration;
_incentiveManagerApiConfiguration = incentiveManagerConfiguration;
_fileUpdaterApiConfiguration = fileUpdaterApiConfiguration;
_temenosNotificationApiConfiguration = temenosNotificationApiConfiguration;
_realTimeAlertsApiConfiguration = realTimeAlertsApiConfiguration;
_repoApiConfiguration = repoApiConfiguration;
}
public IActionService BuildAction(ActionType actionType)
{
var actionTypeStringified = Enum.GetName(typeof(ActionType), actionType);
return BuildAction(actionTypeStringified);
}
public IActionService BuildAction(string actionType)
{
return actionType switch
{
#region FileOperationsApi
nameof(ActionType.MoveFile) => new ActionService<MoveFileRequest>(_fileOperationsApiConfiguration.MoveFileEndpointUrl,
HttpMethodType.Post,
ActionType.MoveFile),
nameof(ActionType.ModifyFile) => new ActionService<ModifyFileRequest>(_fileOperationsApiConfiguration.ModifyFileEndpointUrl,
HttpMethodType.Post,
ActionType.ModifyFile),
nameof(ActionType.CopyFile) => new ActionService<CopyFileRequest>(_fileOperationsApiConfiguration.CopyFileEndpointUrl,
HttpMethodType.Post,
ActionType.CopyFile),
nameof(ActionType.DeleteFile) => new ActionService<DeleteFileRequest>(_fileOperationsApiConfiguration.DeleteFileEndpointUrl,
HttpMethodType.Post,
ActionType.DeleteFile),
nameof(ActionType.RenameFile) => new ActionService<RenameFileRequest>(_fileOperationsApiConfiguration.RenameFileEndpointUrl,
HttpMethodType.Post,
ActionType.RenameFile),
nameof(ActionType.ZipDirectory) => new ActionService<ZipDirectoryRequest>(_fileOperationsApiConfiguration.ZipDirectoryEndpointUrl,
HttpMethodType.Post,
ActionType.ZipDirectory),
nameof(ActionType.CreateDirectory) => new ActionService<CreateDirectoryRequest>(_fileOperationsApiConfiguration.CreateDirectoryEndpointUrl,
HttpMethodType.Post,
ActionType.CreateDirectory),
nameof(ActionType.RenameDirectory) => new ActionService<RenameDirectoryRequest>(_fileOperationsApiConfiguration.RenameDirectoryEndpointUrl,
HttpMethodType.Post,
ActionType.RenameDirectory),
nameof(ActionType.UnzipFile) => new ActionService<UnzipFileRequest>(_fileOperationsApiConfiguration.UnzipFileEndpointUrl,
HttpMethodType.Post,
ActionType.UnzipFile),
nameof(ActionType.EncryptFileData) => new ActionService<EncryptFileDataRequest>(_fileOperationsApiConfiguration.EncryptFileDataEndpointUrl,
HttpMethodType.Post,
ActionType.EncryptFileData),
nameof(ActionType.DecryptFileData) => new ActionService<DecryptFileDataRequest>(_fileOperationsApiConfiguration.DecryptFileDataEndpointUrl,
HttpMethodType.Post,
ActionType.DecryptFileData),
nameof(ActionType.UnzipPasswordProtectedFile) => new ActionService<UnzipPasswordProtectedFileRequest>(_fileOperationsApiConfiguration.UnzipPasswordProtectedFileEndpointUrl,
HttpMethodType.Post,
ActionType.UnzipPasswordProtectedFile),
nameof(ActionType.DeleteDirectory) => new ActionService<DeleteDirectoryRequest>(_fileOperationsApiConfiguration.DeleteDirectoryEndpointUrl,
HttpMethodType.Post,
ActionType.DeleteDirectory),
nameof(ActionType.ExtractIndexFileData) => new ActionService<ExtractIndexFileDataRequest>(_fileOperationsApiConfiguration.ExtractIndexFileDataEndpointUrl,
HttpMethodType.Post,
ActionType.ExtractIndexFileData),
nameof(ActionType.ValidateFileRequest) => new ActionService<ValidateFileRequest>(_fileOperationsApiConfiguration.FileValidationEndpointUrl,
HttpMethodType.Post,
ActionType.ValidateFileRequest),
nameof(ActionType.ValidateFileSizeInRange) => new ActionService<ValidateFileSizeInRangeRequest>(_fileOperationsApiConfiguration.ValidateFileSizeInRangeUrl,
HttpMethodType.Post,
ActionType.ValidateFileSizeInRange),
nameof(ActionType.DeleteEmptyDirectoryRequest) => new ActionService<DeleteEmptyDirectoryRequest>(_fileOperationsApiConfiguration.DeleteEmptyDirectoryEndpointUrl,
HttpMethodType.Post,
ActionType.DeleteEmptyDirectoryRequest),
#endregion FileOperationsApi
#region FtpApi
nameof(ActionType.SftpDownloadFile) => new ActionService<SftpDownloadFileRequest>(_ftpApiConfiguration.QueueSftpDownloadFileEndpointUrl,
HttpMethodType.Post,
ActionType.SftpDownloadFile),
nameof(ActionType.SftpUploadFile) => new ActionService<SftpUploadFileRequest>(_ftpApiConfiguration.QueueSftpUploadFileEndpointUrl,
HttpMethodType.Post,
ActionType.SftpUploadFile),
#endregion FtpApi
#region NotificationsApi
nameof(ActionType.Email) => new ActionService<EmailRequest>(_notificationApiConfiguration.EmailEndpointUrl,
HttpMethodType.Post,
ActionType.Email),
#endregion NotificationsApi
#region ArchiverApi
nameof(ActionType.CoreArchiveRequest) => new ActionService<ArchiveRequest>(_archiverApiConfiguration.QueueArchiverEndpointUrl,
HttpMethodType.Post,
ActionType.CoreArchiveRequest),
#endregion ArchiverApi
#region DocumentIngestorApi
nameof(ActionType.DocumentIngestor) => new ActionService<IngestorRequest>(_documentIngestorApiConfiguration.QueueDocumentIngestorEndpointUrl,
HttpMethodType.Post,
ActionType.DocumentIngestor),
nameof(ActionType.DocumentBatchIngestion) => new ActionService<BatchIngestionRequest>(_documentIngestorApiConfiguration.QueueDocumentBatchIngestionEndpointUrl,
HttpMethodType.Post,
ActionType.DocumentBatchIngestion),
nameof(ActionType.IngestorPdfPartitioner) => new ActionService<PdfPartitionerRequest>(_documentIngestorApiConfiguration.QueueIngestorPdfPartitionerEndpointUrl,
HttpMethodType.Post,
ActionType.IngestorPdfPartitioner),
nameof(ActionType.MemberDocumentNotification) => new ActionService<MemberDocumentNotificationRequest>(_documentIngestorApiConfiguration.QueueMemberDocumentNotifierEndpointUrl,
HttpMethodType.Post,
ActionType.MemberDocumentNotification),
nameof(ActionType.IngestionFolderCleanUp) => new ActionService<IngestionFolderCleanUpRequest>(_documentIngestorApiConfiguration.QueueIngestionFolderCleanUpEndpointUrl,
HttpMethodType.Post,
ActionType.IngestionFolderCleanUp),
nameof(ActionType.DocumentIngestorProcessStatusEmail) => new ActionService<ProcessStatusTypeEmailRequest>(_documentIngestorApiConfiguration.QueueProcessStatusEmailRequestEndpointUrl,
HttpMethodType.Post,
ActionType.DocumentIngestorProcessStatusEmail),
#endregion DocumentIngestorApi
#region DocumentTypeCleanupApi
nameof(ActionType.DocumentRetentionCleanupRequest) => new ActionService<DocumentRetentionLookupRequest>(_documentTypeCleanupApiConfiguration.QueueDocumentRetentionCleanupEndpointUrl,
HttpMethodType.Post,
ActionType.DocumentRetentionCleanupRequest),
#endregion DocumentTypeCleanupApi
#region HistoricalDocumentIngestorApi
nameof(ActionType.HistoricalDocumentIngestor) => new ActionService<IngestorRequest>(_historicalDocumentIngestorApiConfiguration.QueueDocumentIngestorEndpointUrl,
HttpMethodType.Post,
ActionType.HistoricalDocumentIngestor),
nameof(ActionType.HistoricalDocumentBatchIngestion) => new ActionService<BatchIngestionRequest>(_historicalDocumentIngestorApiConfiguration.QueueDocumentBatchIngestionEndpointUrl,
HttpMethodType.Post,
ActionType.HistoricalDocumentBatchIngestion),
nameof(ActionType.HistoricalIngestorPdfPartitioner) => new ActionService<PdfPartitionerRequest>(_historicalDocumentIngestorApiConfiguration.QueueIngestorPdfPartitionerEndpointUrl,
HttpMethodType.Post,
ActionType.HistoricalIngestorPdfPartitioner),
#endregion HistoricalDocumentIngestorApi
#region RemoteDepositCaptureApi
nameof(ActionType.RemoteDepositCaptureXmlFile) => new ActionService<RemoteDepositCaptureXmlRequest>(_remoteDepositCaptureApiConfiguration.QueueRemoteDepositCaptureXmlEndpointUrl,
HttpMethodType.Post,
ActionType.RemoteDepositCaptureXmlFile),
#endregion RemoteDepositCaptureApi
#region DataCleanUpApi
nameof(ActionType.DataCleanUp) => new ActionService<DataCleanUpRequest>(_dataCleanUpApiConfiguration.QueueDataCleanUpEndpointUrl,
HttpMethodType.Post,
ActionType.DataCleanUp),
nameof(ActionType.AtmPersonCheckHolds) => new ActionService<UpdatePersonForCheckHoldRequest>(_dataCleanUpApiConfiguration.QueueUpdatePersonForCheckHoldsEndpointUrl,
HttpMethodType.Post,
ActionType.AtmPersonCheckHolds),
nameof(ActionType.DataCleanupNcoaUpdateRequest) => new ActionService<NcoaUpdateRequest>(_dataCleanUpApiConfiguration.QueueNcoaUpdateRequestEndpointUrl,
HttpMethodType.Post,
ActionType.DataCleanupNcoaUpdateRequest),
nameof(ActionType.DataCleanUpFannieMaeRequest) => new ActionService<FannieMaeMortgageRequest>(_dataCleanUpApiConfiguration.QueueUpdateFannieMaeMortgageRequestEndpointUrl,
HttpMethodType.Post,
ActionType.DataCleanUpFannieMaeRequest),
nameof(ActionType.DataCleanUpIndirectFundingRequest) => new ActionService<IndirectFundingRequest>(_dataCleanUpApiConfiguration.QueueIndirectFundingEndpointUrl,
HttpMethodType.Post,
ActionType.DataCleanUpIndirectFundingRequest),
#endregion DataCleanUpApi
#region NoticeProcessorApi
nameof(ActionType.NoticeProcessorExtractRequest) => new ActionService<ExtractRequest>(_noticeProcessorApiConfiguration.QueueExtractEndpointUrl,
HttpMethodType.Post,
ActionType.NoticeProcessorExtractRequest),
nameof(ActionType.NoticeProcessorSummaryEmailRequest) => new ActionService<ProcessingEmailRequest>(_noticeProcessorApiConfiguration.QueueProcessingEmailSummaryEndpointUrl,
HttpMethodType.Post,
ActionType.NoticeProcessorSummaryEmailRequest),
#endregion DataCleanUpApi
#region MomBotApi
nameof(ActionType.MomBotRequest) => new ActionService<MomBotRequest>(_momBotApiConfiguration.QueueMomBotEndpointUrl, HttpMethodType.Post, ActionType.MomBotRequest),
#endregion MomBotApi
#region BlendApi
nameof(ActionType.BlendDataRequest) => new ActionService<SyncDataFromBlendRequest>(_blendApiConfiguration.QueueDataImportEndpointUrl,
HttpMethodType.Post,
ActionType.BlendDataRequest),
#endregion BlendApi
#region DialerApi
nameof(ActionType.DialerUploadRequest) => new ActionService<DialerUploadRequest>(_dialerApiConfiguration.QueueDialerUploadEndpointUrl,
HttpMethodType.Post,
ActionType.DialerUploadRequest),
nameof(ActionType.UploadDoNotCallRequest) => new ActionService<UploadDoNotCallRequest>(_dialerApiConfiguration.QueueUploadDoNotCallEndpointUrl,
HttpMethodType.Post,
ActionType.UploadDoNotCallRequest),
nameof(ActionType.CreateVoAppsCampaignsRequest) => new ActionService<CreateVoAppsCampaignRequest>(_dialerApiConfiguration.QueueCreateVoAppsCampaignEndpointUrl,
HttpMethodType.Post,
ActionType.CreateVoAppsCampaignsRequest),
nameof(ActionType.UploadVoAppsCampaignResultsRequest) => new ActionService<UploadVoAppsCampaignResultsInitiateRequest>(_dialerApiConfiguration.QueueUploadVoAppsCampaignResultsEndpointUrl,
HttpMethodType.Post,
ActionType.UploadVoAppsCampaignResultsRequest),
nameof(ActionType.UploadVoAppsCampaignResultsErrorRequest) => new ActionService<UploadVoAppsCampaignResultsErrorRequest>(_dialerApiConfiguration.QueueUploadVoAppsCampaignErrorRequestEndpointUrl,
HttpMethodType.Post,
ActionType.UploadVoAppsCampaignResultsErrorRequest),
#endregion DialerApi
#region IncentiveManagerApi
nameof(ActionType.ImportCreditCardSalesRequest) => new ActionService<ImportCreditCardSalesRequest>(_incentiveManagerApiConfiguration.QueueCreditCardImportEndpointUrl,
HttpMethodType.Post,
ActionType.ImportCreditCardSalesRequest),
nameof(ActionType.ImportIndirectVehicleSalesRequest) => new ActionService<ImportIndirectVehicleSalesRequest>(_incentiveManagerApiConfiguration.QueueVehicleImportEndpointUrl,
HttpMethodType.Post,
ActionType.ImportIndirectVehicleSalesRequest),
nameof(ActionType.IncentiveProcessRequest) => new ActionService<IncentiveProcessRequest>(_incentiveManagerApiConfiguration.QueueIncentiveProcessEndpointUrl,
HttpMethodType.Post,
ActionType.IncentiveProcessRequest),
nameof(ActionType.NightlyIncentiveProcessRequest) => new ActionService<NightlyIncentiveProcessRequest>(_incentiveManagerApiConfiguration.QueueNightlyIncentiveProcessEndpointUrl,
HttpMethodType.Post,
ActionType.NightlyIncentiveProcessRequest),
nameof(ActionType.ActionCreditCardRequest) => new ActionService<ActionCreditCardRequest>(_incentiveManagerApiConfiguration.QueueActionCreditCardEndpointUrl,
HttpMethodType.Post,
ActionType.ActionCreditCardRequest),
nameof(ActionType.ActionVehicleRequest) => new ActionService<ActionVehicleRequest>(_incentiveManagerApiConfiguration.QueueActionVehicleEndpointUrl,
HttpMethodType.Post,
ActionType.ActionVehicleRequest),
nameof(ActionType.AlliedGapMbpRequest) => new ActionService<AlliedGapMbpRequest>(_incentiveManagerApiConfiguration.QueueAlliedGapMbpEndpointUrl,
HttpMethodType.Post,
ActionType.AlliedGapMbpRequest),
nameof(ActionType.DayforceProcessRequest) => new ActionService<DayforceProcessRequest>(_incentiveManagerApiConfiguration.QueueDayforceProcessEndpointUrl,
HttpMethodType.Post,
ActionType.DayforceProcessRequest),
nameof(ActionType.GoalDispersalRequest) => new ActionService<GoalDispersalRequest>(_incentiveManagerApiConfiguration.QueueGoalDispersalProcessEndpointUrl,
HttpMethodType.Post,
ActionType.GoalDispersalRequest),
nameof(ActionType.PayoutIncentiveRequest) => new ActionService<PayoutIncentiveRequest>(_incentiveManagerApiConfiguration.QueuePayoutProcessEndpointUrl,
HttpMethodType.Post,
ActionType.PayoutIncentiveRequest),
nameof(ActionType.ReportingRequest) => new ActionService<ReportingRequest>(_incentiveManagerApiConfiguration.QueueReportingProcessEndpointUrl,
HttpMethodType.Post,
ActionType.ReportingRequest),
#endregion IncentiveManagerApi
#region FileUpdaterApi
nameof(ActionType.IndexFieldMapperRequest) => new ActionService<IndexFieldMapperRequest>(_fileUpdaterApiConfiguration.QueueIndexFieldMapperUrl,
HttpMethodType.Post,
ActionType.IndexFieldMapperRequest),
#endregion
#region TemenosNotificationApi
nameof(ActionType.DealerAchNotificationRequest) => new ActionService<DealerAchNotificationRequest>(_temenosNotificationApiConfiguration.QueueDealerAchNotificationUrl,
HttpMethodType.Post,
ActionType.DealerAchNotificationRequest),
#endregion
#region RealTimeAlertsApi
nameof(ActionType.InitiateRealTimeAlertsRequest) => new ActionService<InitiateTransactionAlertsRequest>(_realTimeAlertsApiConfiguration.QueueInitiateRealTimeAlertsEndpointUrl,
HttpMethodType.Post,
ActionType.InitiateRealTimeAlertsRequest),
nameof(ActionType.InitiateRealTimeAlertsErroredProcessingRequest) => new ActionService<InitiateErroredTransactionCleanUpRequest>(_realTimeAlertsApiConfiguration.QueueErroredTransactionCleanUpEndpointUrl,
HttpMethodType.Post,
ActionType.InitiateRealTimeAlertsErroredProcessingRequest),
#endregion
#region RepoApi
nameof(ActionType.RepoBatchProcessRequest) => new ActionService<RepoBatchRequest>(_repoApiConfiguration.AccountBatchEndpointUrl,
HttpMethodType.Post,
ActionType.RepoBatchProcessRequest),
#endregion RepoApi
_ => throw new NotImplementedException(),
};
}
}
@@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using LCU.Library.Internal.ApiResponse.Models;
using LCU.Library.Internal.DispatcherModels.Enums;
using LCU.Library.Internal.DispatcherModels.Entities;
using LCU.Library.Internal.DispatcherModels.Models;
namespace LCU.Api.Internal.DispatcherSharedLib.BuilderServices;
public class ActionService<TRequest> : IActionService where TRequest : ReturnResponse
{
private readonly string Url;
private readonly HttpMethodType HttpMethodType;
private readonly ActionType ActionType;
public ActionService(string url, HttpMethodType httpMethodType, ActionType actionType)
{
Url = url;
HttpMethodType = httpMethodType;
ActionType = actionType;
}
/// <summary>
/// NOTE: This will only work if the proper configuration has been setup.
/// </summary>
/// <param name="workItem"></param>
/// <returns></returns>
public WorkItem AddUrlAndHttpMethod(WorkItem workItem)
{
if (Url is null)
{
throw new ArgumentNullException("Url has not been set by configuration.");
}
workItem.Url = Url;
workItem.HttpMethod = HttpMethodType;
return workItem;
}
public WorkItem CreateNewWorkitem(object request, WorkItemDetails workItemDetails)
{
var workItemRequest = (TRequest)request;
return new WorkItem
{
WorkItemId = workItemDetails.WorkItemId,
JobId = workItemDetails.JobId,
Name = workItemDetails.Name,
Description = workItemDetails.Description,
Order = workItemDetails.Order,
Url = "",
HttpMethod = HttpMethodType.Unknown,
SerializedPayload = JsonConvert.SerializeObject(workItemRequest),
ActionType = ActionType,
CancelJobOnFailure = workItemDetails.CancelJobOnFailure,
CancelJobLimit = workItemDetails.CancelJobLimit,
CanceledJobCounter = 0
};
}
public Type GetActionType()
{
return typeof(TRequest);
}
public WorkItem AddWorkItemReturnResponse(WorkItem workItem, ResponseItem responseItem)
{
var deserilizedObject = JsonConvert.DeserializeObject<TRequest>(workItem.SerializedPayload);
deserilizedObject.ResponseItems = RemoveDispatcherReturnResponse(deserilizedObject.ResponseItems);
deserilizedObject.ResponseItems.Add(responseItem);
workItem.SerializedPayload = JsonConvert.SerializeObject(deserilizedObject);
return workItem;
}
private List<ResponseItem> RemoveDispatcherReturnResponse(List<ResponseItem> responseItems)
{
var toRemove = new List<ResponseItem>();
if (responseItems == null)
{
return toRemove;
}
foreach (var responseItem in responseItems)
{
try
{
var existingReturnResponse = JsonConvert.DeserializeObject<DispatcherReturnResponse>(responseItem.ResponsePayload);
toRemove.Add(responseItem);
}
catch
{
continue;
}
}
foreach (var responseItem in toRemove)
{
responseItems.Remove(responseItem);
}
return responseItems;
}
}
@@ -0,0 +1,8 @@
using LCU.Library.Internal.DispatcherModels.Enums;
namespace LCU.Api.Internal.DispatcherSharedLib.BuilderServices;
public interface IActionBuilderService
{
IActionService BuildAction(ActionType type);
IActionService BuildAction(string type);
}
@@ -0,0 +1,13 @@
using System;
using LCU.Library.Internal.ApiResponse.Models;
using LCU.Library.Internal.DispatcherModels.Entities;
using LCU.Library.Internal.DispatcherModels.Models;
namespace LCU.Api.Internal.DispatcherSharedLib.BuilderServices;
public interface IActionService
{
WorkItem AddUrlAndHttpMethod(WorkItem workItem);
WorkItem CreateNewWorkitem(object request, WorkItemDetails workItemDetails);
Type GetActionType();
WorkItem AddWorkItemReturnResponse(WorkItem workItem, ResponseItem responseItem);
}
@@ -0,0 +1,16 @@
using System;
using LCU.Library.Internal.DispatcherModels.Models;
using LCU.Library.Internal.ApiResponse.Models;
using LCU.Library.Internal.DispatcherModels.Enums;
using System.Threading.Tasks;
namespace LCU.Api.Internal.DispatcherSharedLib.BuilderServices;
public interface IRequestBuilderService
{
void ClearJob();
void CreateJob(JobDetails jobDetails);
Task<bool> SendDispatcherRequest(ReturnResponse returnResponse = null);
Type GetDispatcherTypeByString(string type);
void AddWorkItem(object request, WorkItemDetails workItemDetails, ActionType actionType);
void AddWorkItem(object request, WorkItemDetails workItemDetails, string actionType);
}
@@ -0,0 +1,152 @@
using Serilog;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using LCU.Library.Internal.ApiResponse.Models;
using LCU.Library.Internal.DispatcherModels.Entities;
using LCU.Library.Internal.DispatcherModels.Models;
using LCU.Library.Internal.DispatcherModels.Enums;
using LCU.Api.Internal.DispatcherSharedLib.Utilities;
using LCU.Api.Internal.DispatcherSharedLib.Configurations;
using LCU.Library.Internal.LcuHttpClient.HttpRequest;
using System.Net.Http;
using System.Threading.Tasks;
namespace LCU.Api.Internal.DispatcherSharedLib.BuilderServices;
public class RequestBuilderService : IRequestBuilderService
{
private readonly IPostRequest _postRequest;
private readonly IActionBuilderService _actionBuilderService;
private readonly DispatcherRequestBuilderConfiguration _requestBuilderConfiguration;
private Job JobRequest;
public RequestBuilderService(IPostRequest postRequest,
IActionBuilderService actionBuilderService,
DispatcherRequestBuilderConfiguration requestBuilderConfiguration)
{
_postRequest = postRequest;
_actionBuilderService = actionBuilderService;
_requestBuilderConfiguration = requestBuilderConfiguration;
}
public void ClearJob()
{
JobRequest = null;
}
public void CreateJob(JobDetails jobDetails)
{
ClearJob();
JobRequest = new Job
{
JobId = jobDetails.JobId,
RequestingApplication = jobDetails.RequestingApplication,
Name = jobDetails.Name,
Description = jobDetails.Description,
CreatedBy = jobDetails.CreatedBy,
CreatedAt = jobDetails.CreatedAt,
ModifiedBy = jobDetails.ModifiedBy,
ModifiedDate = jobDetails.ModifiedDate,
CronSchedule = jobDetails.CronSchedule,
NextRunTime = jobDetails.NextRunTime,
SkipHolidays = jobDetails.SkipHolidays,
JobErrorRecipients = CreateJobErrorRecipients(jobDetails),
WorkItems = new List<WorkItem>(),
JobTags = jobDetails.JobTags,
JobStatus = jobDetails.JobStatus
};
CronHelpers.SetNextScheduledRunTime(ref JobRequest);
}
public List<JobErrorRecipient> CreateJobErrorRecipients(JobDetails jobDetails)
{
var jobErrorRecipients = new List<JobErrorRecipient>();
foreach (var recipient in jobDetails.ErrorRecipients)
{
if (string.IsNullOrEmpty(recipient))
{
continue;
}
var newJobErrorRecipient = new JobErrorRecipient()
{
JobId = jobDetails.JobId,
Recipient = recipient
};
jobErrorRecipients.Add(newJobErrorRecipient);
}
return jobErrorRecipients;
}
public async Task<bool> SendDispatcherRequest(ReturnResponse returnResponse = null)
{
try
{
if (JobRequest == null)
{
Log.Error("Cannot send null Job.");
return false;
}
JobRequest.ReturnResponse = returnResponse;
var serializedJobRequest = JsonConvert.SerializeObject(JobRequest);
var result = await _postRequest.AsyncWithNewtonSerializedNoThrow(new Uri(_requestBuilderConfiguration.Url), serializedJobRequest);
if (result.IsSuccessStatusCode)
{
ClearJob();
}
return result.IsSuccessStatusCode;
}
catch (Exception exception)
{
Log.Error(exception, "Failure to send job request");
return false;
}
}
public Type GetDispatcherTypeByString(string type)
{
var actionBuilder = _actionBuilderService.BuildAction(type);
return actionBuilder.GetActionType();
}
public void AddWorkItem(object request, WorkItemDetails workItemDetails, ActionType actionType)
{
var actionBuilder = _actionBuilderService.BuildAction(actionType);
AddWorkItemToJob(request, workItemDetails, actionBuilder);
}
public void AddWorkItem(object request, WorkItemDetails workItemDetails, string actionType)
{
var actionBuilder = _actionBuilderService.BuildAction(actionType);
AddWorkItemToJob(request, workItemDetails, actionBuilder);
}
private void AddWorkItemToJob(object request, WorkItemDetails workItemDetails, IActionService actionBuilder)
{
try
{
var newWorkitem = actionBuilder.CreateNewWorkitem(request, workItemDetails);
if (JobRequest == null)
{
Log.Error("Cannot add workitem to null Job.");
throw new InvalidOperationException("Cannot add workitem to null Job.");
}
JobRequest.WorkItems.Add(newWorkitem);
}
catch (Exception exception)
{
Log.Error(exception, "Error creating WorkItem.");
ClearJob();
throw;
}
}
}
@@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class ArchiverApiConfiguration
{
public string Url { get; set; }
public string QueueArchiverEndpoint { get; set; }
[NotMapped]
public string QueueArchiverEndpointUrl => Url + QueueArchiverEndpoint;
}
@@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class BlendApiConfiguration
{
public string Url { get; set; }
public string QueueDataImportEndpoint { get; set; }
[NotMapped]
public string QueueDataImportEndpointUrl => Url + QueueDataImportEndpoint;
}
@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class DataCleanUpApiConfiguration
{
public string Url { get; set; }
public string QueueDataCleanUpEndpoint { get; set; }
public string QueueUpdatePersonForCheckHoldsEndpoint { get; set; }
public string QueueNcoaUpdateEndpoint { get; set; }
public string QueueUpdateFannieMaeMortgageEndpoint { get; set; }
public string QueueIndirectFundingEndpoint { get; set; }
[NotMapped]
public string QueueDataCleanUpEndpointUrl => Url + QueueDataCleanUpEndpoint;
[NotMapped]
public string QueueUpdatePersonForCheckHoldsEndpointUrl => Url + QueueUpdatePersonForCheckHoldsEndpoint;
[NotMapped]
public string QueueNcoaUpdateRequestEndpointUrl => Url + QueueNcoaUpdateEndpoint;
[NotMapped]
public string QueueUpdateFannieMaeMortgageRequestEndpointUrl => Url + QueueUpdateFannieMaeMortgageEndpoint;
[NotMapped]
public string QueueIndirectFundingEndpointUrl => Url + QueueIndirectFundingEndpoint;
}
@@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class DialerApiConfiguration
{
public string Url { get; set; }
public string QueueDialerUploadEndpoint { get; set; }
public string QueueUploadDoNotCallEndpoint { get; set; }
public string QueueCreateVoAppsCampaignEndpoint { get; set; }
public string QueueUploadVoAppsCampaignResultsEndpoint { get; set; }
public string QueueUploadVoAppsCampaignErrorRequestEndpoint { get; set; }
[NotMapped]
public string QueueDialerUploadEndpointUrl => Url + QueueDialerUploadEndpoint;
[NotMapped]
public string QueueUploadDoNotCallEndpointUrl => Url + QueueUploadDoNotCallEndpoint;
[NotMapped]
public string QueueCreateVoAppsCampaignEndpointUrl => Url + QueueCreateVoAppsCampaignEndpoint;
[NotMapped]
public string QueueUploadVoAppsCampaignResultsEndpointUrl => Url + QueueUploadVoAppsCampaignResultsEndpoint;
[NotMapped]
public string QueueUploadVoAppsCampaignErrorRequestEndpointUrl => Url + QueueUploadVoAppsCampaignErrorRequestEndpoint;
}
@@ -0,0 +1,6 @@
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class DispatcherRequestBuilderConfiguration
{
public string Url { get; set; }
}
@@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class DocumentIngestorApiConfiguration
{
public string Url { get; set; }
public string QueueDocumentIngestorEndpoint { get; set; }
public string QueueDocumentBatchIngestionEndpoint { get; set; }
public string QueueIngestorPdfPartitionerEndpoint { get; set; }
public string QueueMemberDocumentNotifierEndpoint { get; set; }
public string QueueIngestionFolderCleanUpEndpoint { get; set; }
public string QueueProcessStatusTypeEmailRequestEndpoint { get; set; }
[NotMapped]
public string QueueDocumentIngestorEndpointUrl => Url + QueueDocumentIngestorEndpoint;
[NotMapped]
public string QueueDocumentBatchIngestionEndpointUrl => Url + QueueDocumentBatchIngestionEndpoint;
[NotMapped]
public string QueueIngestorPdfPartitionerEndpointUrl => Url + QueueIngestorPdfPartitionerEndpoint;
[NotMapped]
public string QueueMemberDocumentNotifierEndpointUrl => Url + QueueMemberDocumentNotifierEndpoint;
[NotMapped]
public string QueueIngestionFolderCleanUpEndpointUrl => Url + QueueIngestionFolderCleanUpEndpoint;
[NotMapped]
public string QueueProcessStatusEmailRequestEndpointUrl => Url + QueueProcessStatusTypeEmailRequestEndpoint;
}
@@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class DocumentTypeCleanupApiConfiguration
{
public string Url { get; set; }
public string QueueDocumentRetentionCleanupEndpoint { get; set; }
[NotMapped]
public string QueueDocumentRetentionCleanupEndpointUrl => Url + QueueDocumentRetentionCleanupEndpoint;
}
@@ -0,0 +1,75 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class FileOperationsApiConfiguration
{
public string Url { get; set; }
public string MoveFileEndpoint { get; set; }
public string CopyFileEndpoint { get; set; }
public string ModifyFileEndpoint { get; set; }
public string RenameFileEndpoint { get; set; }
public string DeleteFileEndpoint { get; set; }
public string ZipDirectoryEndpoint { get; set; }
public string CreateDirectoryEndpoint { get; set; }
public string RenameDirectoryEndpoint { get; set; }
public string UnzipFileEndpoint { get; set; }
public string EncryptFileDataEndpoint { get; set; }
public string DecryptFileDataEndpoint { get; set; }
public string UnzipPasswordProtectedFileEndpoint { get; set; }
public string DeleteDirectoryEndpoint { get; set; }
public string FileValidationEndpoint { get; set; }
public string ExtractIndexFileDataEndpoint { get; set; }
public string ValidateFileSizeInRange { get; set; }
public string DeleteEmptyDirectoryEndpoint { get; set; }
[NotMapped]
public string MoveFileEndpointUrl => Url + MoveFileEndpoint;
[NotMapped]
public string CopyFileEndpointUrl => Url + CopyFileEndpoint;
[NotMapped]
public string ModifyFileEndpointUrl => Url + ModifyFileEndpoint;
[NotMapped]
public string RenameFileEndpointUrl => Url + RenameFileEndpoint;
[NotMapped]
public string DeleteFileEndpointUrl => Url + DeleteFileEndpoint;
[NotMapped]
public string ZipDirectoryEndpointUrl => Url + ZipDirectoryEndpoint;
[NotMapped]
public string CreateDirectoryEndpointUrl => Url + CreateDirectoryEndpoint;
[NotMapped]
public string RenameDirectoryEndpointUrl => Url + RenameDirectoryEndpoint;
[NotMapped]
public string UnzipFileEndpointUrl => Url + UnzipFileEndpoint;
[NotMapped]
public string EncryptFileDataEndpointUrl => Url + EncryptFileDataEndpoint;
[NotMapped]
public string DecryptFileDataEndpointUrl => Url + DecryptFileDataEndpoint;
[NotMapped]
public string UnzipPasswordProtectedFileEndpointUrl => Url + UnzipPasswordProtectedFileEndpoint;
[NotMapped]
public string DeleteDirectoryEndpointUrl => Url + DeleteDirectoryEndpoint;
[NotMapped]
public string FileValidationEndpointUrl => Url + FileValidationEndpoint;
[NotMapped]
public string ExtractIndexFileDataEndpointUrl => Url + ExtractIndexFileDataEndpoint;
[NotMapped]
public string ValidateFileSizeInRangeUrl => Url + ValidateFileSizeInRange;
[NotMapped]
public string DeleteEmptyDirectoryEndpointUrl => Url + DeleteEmptyDirectoryEndpoint;
}
@@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations
{
public class FileUpdaterApiConfiguration
{
public string Url { get; set; }
public string QueueIndexFieldMapper { get; set; }
[NotMapped]
public string QueueIndexFieldMapperUrl => Url + QueueIndexFieldMapper;
}
}
@@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class FtpApiConfiguration
{
public string Url { get; set; }
public string SftpFileEndpoint { get; set; }
public string QueueSftpDynamicFileEndpoint { get; set; }
public string QueueSftpUploadFileEndpoint { get; set; }
public string QueueSftpDownloadFileEndpoint { get; set; }
[NotMapped]
public string SftpFileEndpointUrl => Url + SftpFileEndpoint;
[NotMapped]
public string QueueSftpDynamicFileEndpointUrl => Url + QueueSftpDynamicFileEndpoint;
[NotMapped]
public string QueueSftpUploadFileEndpointUrl => Url + QueueSftpUploadFileEndpoint;
[NotMapped]
public string QueueSftpDownloadFileEndpointUrl => Url + QueueSftpDownloadFileEndpoint;
}
@@ -0,0 +1,17 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class HistoricalDocumentIngestorApiConfiguration
{
public string Url { get; set; }
public string QueueDocumentIngestorEndpoint { get; set; }
public string QueueDocumentBatchIngestionEndpoint { get; set; }
public string QueueIngestorPdfPartitionerEndpoint { get; set; }
[NotMapped]
public string QueueDocumentIngestorEndpointUrl => Url + QueueDocumentIngestorEndpoint;
[NotMapped]
public string QueueDocumentBatchIngestionEndpointUrl => Url + QueueDocumentBatchIngestionEndpoint;
[NotMapped]
public string QueueIngestorPdfPartitionerEndpointUrl => Url + QueueIngestorPdfPartitionerEndpoint;
}
@@ -0,0 +1,42 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations
{
public class IncentiveManagerConfiguration
{
public string Url { get; set; }
public string QueueCreditCardImportEndpoint { get; set; }
public string QueueVehicleImportEndpoint { get; set; }
public string QueueIncentiveProcessEndpoint { get; set; }
public string QueueNightlyIncentiveProcessEndpoint { get; set; }
public string QueuePayoutProcessEndpoint { get; set; }
public string QueueActionCreditCardEndpoint { get; set; }
public string QueueActionVehicleEndpoint { get; set; }
public string QueueAlliedGapMbpEndpoint { get; set; }
public string QueueReportingProcessEndpoint { get; set; }
public string QueueGoalDispersalProcessEndpoint { get; set; }
public string QueueDayforceProcessEndpoint { get; set; }
[NotMapped]
public string QueueCreditCardImportEndpointUrl => Url + QueueCreditCardImportEndpoint;
[NotMapped]
public string QueueVehicleImportEndpointUrl => Url + QueueVehicleImportEndpoint;
[NotMapped]
public string QueueActionCreditCardEndpointUrl => Url + QueueActionCreditCardEndpoint;
[NotMapped]
public string QueueActionVehicleEndpointUrl => Url + QueueActionVehicleEndpoint;
[NotMapped]
public string QueueAlliedGapMbpEndpointUrl => Url + QueueAlliedGapMbpEndpoint;
[NotMapped]
public string QueueIncentiveProcessEndpointUrl => Url + QueueIncentiveProcessEndpoint;
[NotMapped]
public string QueueNightlyIncentiveProcessEndpointUrl => Url + QueueNightlyIncentiveProcessEndpoint;
[NotMapped]
public string QueuePayoutProcessEndpointUrl => Url + QueuePayoutProcessEndpoint;
[NotMapped]
public string QueueReportingProcessEndpointUrl => Url + QueueReportingProcessEndpoint;
[NotMapped]
public string QueueGoalDispersalProcessEndpointUrl => Url + QueueGoalDispersalProcessEndpoint;
[NotMapped]
public string QueueDayforceProcessEndpointUrl => Url + QueueDayforceProcessEndpoint;
}
}
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class MomBotApiConfiguration
{
public string Url { get; set; }
public string QueueMomBotEndpoint { get; set; }
[NotMapped]
public string QueueMomBotEndpointUrl => Url + QueueMomBotEndpoint;
}
@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class NoticeProcessorApiConfiguration
{
public string Url { get; set; }
public string QueueExtractEndpoint { get; set; }
public string QueueProcessingEmailSummaryEndpoint { get; set; }
[NotMapped]
public string QueueExtractEndpointUrl => Url + QueueExtractEndpoint;
[NotMapped]
public string QueueProcessingEmailSummaryEndpointUrl => Url + QueueProcessingEmailSummaryEndpoint;
}
@@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class NotificationApiConfiguration
{
public string Url { get; set; }
public string EmailEndpoint { get; set; }
[NotMapped]
public string EmailEndpointUrl => Url + EmailEndpoint;
}
@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class RealTimeAlertsApiConfiguration
{
public string Url { get; set; }
public string QueueInitiateRealTimeAlertsEndpoint { get; set; }
public string QueueErroredTransactionCleanUpEndpoint { get; set; }
[NotMapped]
public string QueueInitiateRealTimeAlertsEndpointUrl => Url + QueueInitiateRealTimeAlertsEndpoint;
[NotMapped]
public string QueueErroredTransactionCleanUpEndpointUrl => Url + QueueErroredTransactionCleanUpEndpoint;
}
@@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class RemoteDepositCaptureApiConfiguration
{
public string Url { get; set; }
public string QueueRemoteDepositCaptureXmlEndpoint { get; set; }
[NotMapped]
public string QueueRemoteDepositCaptureXmlEndpointUrl => Url + QueueRemoteDepositCaptureXmlEndpoint;
}
@@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class RepoApiConfiguration
{
public string Url { get; set; }
public string AccountBatchEndpoint { get; set; }
[NotMapped]
public string AccountBatchEndpointUrl => Url + AccountBatchEndpoint;
}
@@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Api.Internal.DispatcherSharedLib.Configurations;
public class TemenosNotificationApiConfiguration
{
public string Url { get; set; }
public string QueueDealerAchNotification { get; set; }
[NotMapped]
public string QueueDealerAchNotificationUrl => Url + QueueDealerAchNotification;
}
@@ -0,0 +1,38 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using LCU.Library.Internal.Configuration;
using LCU.Api.Internal.DispatcherSharedLib.Utilities;
using LCU.Api.Internal.DispatcherSharedLib.BuilderServices;
using LCU.Api.Internal.DispatcherSharedLib.Configurations;
namespace LCU.Api.Internal.DispatcherSharedLib;
public static class DependencyInjection
{
public static IServiceCollection AddDispatcherServices(this IServiceCollection services, IConfiguration configuration)
{
configuration.Bind<DispatcherRequestBuilderConfiguration>(services);
configuration.Bind<FileOperationsApiConfiguration>(services);
configuration.Bind<FtpApiConfiguration>(services);
configuration.Bind<NotificationApiConfiguration>(services);
configuration.Bind<ArchiverApiConfiguration>(services);
configuration.Bind<DocumentIngestorApiConfiguration>(services);
configuration.Bind<DocumentTypeCleanupApiConfiguration>(services);
configuration.Bind<HistoricalDocumentIngestorApiConfiguration>(services);
configuration.Bind<RemoteDepositCaptureApiConfiguration>(services);
configuration.Bind<DataCleanUpApiConfiguration>(services);
configuration.Bind<NoticeProcessorApiConfiguration>(services);
configuration.Bind<MomBotApiConfiguration>(services);
configuration.Bind<BlendApiConfiguration>(services);
configuration.Bind<DialerApiConfiguration>(services);
configuration.Bind<IncentiveManagerConfiguration>(services);
configuration.Bind<FileUpdaterApiConfiguration>(services);
configuration.Bind<TemenosNotificationApiConfiguration>(services);
configuration.Bind<RealTimeAlertsApiConfiguration>(services);
configuration.Bind<RepoApiConfiguration>(services);
services.AddScoped<IRequestBuilderService, RequestBuilderService>();
services.AddScoped<IActionBuilderService, ActionBuilderService>();
return services;
}
}
@@ -0,0 +1,297 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>5.7.21</Version>
<Description>
1.0.0 - Initial Creation
1.1.0 - FileOperationsLib and ApiResponse Version upgrade.
1.2.0 - ZipDirectoryRequest added.
1.3.0 - SftpRequest readded.
2.0.0 - Change so that all the librarys references are bundled with nuget.
2.1.0 - Upgrade FtpLib version
2.2.0 - Added DependencyInjection Class
3.0.0 - Change to Job and WorkItem model to now use WorkItemExecution, added Name, and description.
3.1.0 - Added Notification and refactored DispatcherRequestBuilder
3.2.0 - Update FileOperationsLib nuget
3.3.0 - Added FileOperations CreateDirectory and RenameDirectory
3.3.1 - Upgrade FileOperationsLib nuget to 3.3.0
3.3.2 - Add ability to add job error recipients.
3.4.0 - Adding SftpDynamicFileRequest.
3.5.0 - Add Dynamic Zip and UnzipFileRequest
3.6.0 - Add ArchiveRequest
3.6.1 - Updated AutomicApiWrapperModels Nuget
3.7.0 - Add Encrypt/Decrypt and SucceedOnError to Move/Copy/Rename/Delete File
3.8.0 - Upgrade to netstandard2.1
4.0.0 - Removing models and added helpers. Models are in new LCU.Library.Internal.DispatcherModels library.
4.1.0 - Update to use masstransit and change to use ArchiverApi rather than AutomicApiWrapper
4.2.0 - Update FTP Lib nuget
4.3.0 - Add Job Tags
4.4.0 - Add JobDetails with Job Tags
4.5.0 - Upgrade ApiResponse.Models nuget
4.6.0 - Upgrade FileOperations Nuget and Add ModifyFile Workitem
4.7.0 - Upgrade FTP Nuget and Update SftpUpload Request
4.8.0 - Upgrade FTP Nuget
4.9.0 - Upgrade FTP Nuget to 2.9.0
4.10.0 - Added DocumentIngestor IngestorRequest
4.11.0 - Missed model version upgraded.
4.12.0 - Upgrade FileOperationsLib, FtpLib, and DocumentIngestorModels lib
4.13.0 - Added BatchIngestionRequest and UnzipPasswordProtectedRequest
4.14.0 - Upgrade FileOperationsLib to 3.20.0
4.15.0 - Added IngestorPdfPartitioner WorkItem
4.16.0 - Added MemberDocumentNotificationRequest Workitem
4.17.0 - Added RemoteDepositCaptureXmlRequest Workitem and updated DocumentIngestor models
4.18.0 - Added DeleteDirectoryRequest Workitem and updated DocumentIngestor models
4.19.0 - Added UpdatePersonForCheckHoldRequest and DataCleanup Workitems
4.19.1 - Update DocumentIngestorModels Nuget
4.20.0 - Update FileOperations and FTP API Nuget for models
4.20.1 - Added HistoricalDocumentIngestor, HistoricalDocumentBatchIngestion, and HistoricalIngestorPdfPartitioner WorkItems
4.21.0 - Add ExtractRequest and ProcessingSummaryEmail request from NoticeProcessor API
4.21.1 - Update DocumentIngestorModels Nuget
4.22.0 - Added WorkItem properties for Cancel Job on Failure.
5.0.0 - Enhancments and refactors: Added ActionBuilderService and ActionService classes to handle the workitem action building. Other refactors.
5.0.1 - Add NcoaUpdate workItem
5.0.2 - Update FTP Nuget
5.0.3 - Update File Operatations Nuget
5.0.4 - Add IngestionFolderCleanUp WorkItem
5.0.5 - Correct IngestionFolderCleanUp in ActionBuilderService
5.0.6 - Use latest version of DocumentIngestorModels
5.0.7 - Update DataCleanUpNuget for NCOA Request
5.0.8 - Add MomBotRequest WorkItem
5.0.9 - Add BlendApi Data Sync Request WorkItem
5.0.10 - Update FTP Nuget for ResumeSupportState toggle on download
5.0.11 - Added DialerUploadRequest WorkItem.
5.0.12 - Added UploadDoNotCallRequest WorkItem.
5.0.13 - Update FileOperationsLib nuget
5.0.14 - Added FannieMaeMortgageRequest WorkItem.
5.0.15 - Added CreateVoAppsCampaignsRequest WorkItem.
5.1.0 - Updated CreateVoAppsCampaignsRequest WorkItem.
5.1.1 - Updated CreateVoAppsCampaignsRequest WorkItem.
5.1.2 - Updated CreateVoAppsCampaignsRequest WorkItem.
5.1.3 - Added UploadVoAppsCampaignRequest WorkItem
5.1.4 - Updated model validation on DialerApiModels
5.2.0 - Added new fields on DialerUpload model
5.3.0 - Updated CreateVoAppsCampaignRequest model with new fields.
5.4.0 - Updated CreateVoAppsCampaignRequest model.
5.5.0 - Added ImportCreditCardSalesRequest model.
5.5.1 - Added DataCleanUpIndirectFunding WorkItem.
5.6.0 - Alter BlendApi Data Sync Request WorkItem
5.6.1 - Update IndirectFundRequest
5.6.2 - Added ImportIndirectVehicleSalesRequest model.
5.6.3 - Updated BlendModels Nuget for ApplicationProcess
5.6.4 - Added SkipHolidays to Job model
5.6.5 - Updated Dialer API Nuget for the UploadVoAppsCampaignResultsRequest updates
5.6.6 - Updating the Document Ingestors Models
5.6.7 - Add ValidateFileRequest FileOperations WorkItem
5.6.8 - Added ExtractIndexFileData WorkItem
5.6.9 - Update NuGet packages
5.6.10 - Updated Incentive Manager import models.
5.6.11 - Added IndexFieldMapperRequest model.
5.6.12 - Added DealerAchNotification model.
5.6.13 - Updated ClientHelper.
5.6.14 - Update JSON handling in Client Helper.
5.6.15 - Update clienthelper to allow async
5.6.16 - Update clienthelper to add wait
5.6.17 - Remove retry from client helper
5.6.18 - Ensure respone is sent with error information for write-back
5.6.19 - Updated FileUpdaterModels version
5.6.20 - Add RealTimeAlerts WorkItem
5.6.21 - Update NuGet packages
5.6.22 - Update Nuget packages for Osg Tax
5.6.23 - Add RealTimeAlerts Errored Process WorkItem
5.7.0 - Upgrade to dotnet8
5.7.1 - Update NuGet packages
5.7.2 - Update NuGet packages
5.7.3 - Update nuget for Osg DNA Notices Split
5.7.4 - Add Incentive Mgr Work Items
5.7.5 - Update Nuget packages
5.7.6 - Update DocumentIngestorModels Nuget package
5.7.7 - Update DocumentIngestorModel Nuget
5.7.8 - Update NuGet packages
5.7.9 - Update FileOperations NuGet packages
5.7.10 - Added DeleteEmptyDirectoryRequest model
5.7.11 - Add JobStatus in RequestBuilder service
5.7.12 - Added DocumentRetentionCleanup WorkItem
5.7.13 - Update Incentive Mgr Nuget package
5.7.14 - Update Dialer Api Nuget package
5.7.15 - Update File Operations Api Nuget package
5.7.16 - Update CreateJob Method to handle JobStatus
5.7.17 - Update Dialer Api Nuget package Error Process
5.7.18 - Update for Repo API WorkItem
5.7.19 - Update DocumentIngestorModels Nuget Package
5.7.20 - Update Dialer Api Nuget package for campaigns
5.7.21 - Update DocumentIngestorModels Nuget package
</Description>
<PackageReleaseNotes>
1.0.0 - Initial Creation
1.1.0 - FileOperationsLib and ApiResponse Version upgrade.
1.2.0 - ZipDirectoryRequest added.
1.3.0 - SftpRequest readded.
2.0.0 - Change so that all the librarys references are bundled with nuget.
2.1.0 - Upgrade FtpLib version
2.2.0 - Added DependencyInjection Class
3.0.0 - Change to Job and WorkItem model to now use WorkItemExecution, added Name, and description.
3.1.0 - Added Notification and refactored DispatcherRequestBuilder
3.2.0 - Update FileOperationsLib nuget
3.3.0 - Added FileOperations CreateDirectory and RenameDirectory
3.3.1 - Upgrade FileOperationsLib nuget to 3.3.0
3.3.2 - Add ability to add job error recipients.
3.4.0 - Adding SftpDynamicFileRequest.
3.5.0 - Add Dynamic Zip and UnzipFileRequest
3.6.0 - Add ArchiveRequest
3.6.1 - Updated AutomicApiWrapperModels Nuget
3.7.0 - Add Encrypt/Decrypt and SucceedOnError to Move/Copy/Rename/Delete File
3.8.0 - Upgrade to netstandard2.1
4.0.0 - Removing models and added helpers. Models are in new LCU.Library.Internal.DispatcherModels library.
4.1.0 - Update to use masstransit and change to use ArchiverApi rather than AutomicApiWrapper
4.2.0 - Update FTP Lib nuget
4.3.0 - Add Job Tags
4.4.0 - Add JobDetails with Job Tags
4.5.0 - Upgrade ApiResponse.Models nuget
4.6.0 - Upgrade FileOperations Nuget and Add ModifyFile Workitem
4.7.0 - Upgrade FTP Nuget and Update SftpUpload Request
4.8.0 - Upgrade FTP Nuget
4.9.0 - Upgrade FTP Nuget to 2.9.0
4.10.0 - Added DocumentIngestor IngestorRequest
4.11.0 - Missed model version upgraded.
4.12.0 - Upgrade FileOperationsLib, FtpLib, and DocumentIngestorModels lib
4.13.0 - Added BatchIngestionRequest and UnzipPasswordProtectedRequest
4.14.0 - Upgrade FileOperationsLib to 3.20.0
4.15.0 - Added IngestorPdfPartitioner WorkItem
4.16.0 - Added MemberDocumentNotificationRequest Workitem
4.17.0 - Added RemoteDepositCaptureXmlRequest Workitem and updated DocumentIngestor models
4.18.0 - Added DeleteDirectoryRequest Workitem and updated DocumentIngestor models
4.19.0 - Added UpdatePersonForCheckHoldRequest and DataCleanup Workitems
4.19.1 - Update DocumentIngestorModels Nuget
4.20.0 - Update FileOperations and FTP API Nuget for models
4.20.1 - Added HistoricalDocumentIngestor, HistoricalDocumentBatchIngestion, and HistoricalIngestorPdfPartitioner WorkItems
4.21.0 - Add ExtractRequest and ProcessingSummaryEmail request from NoticeProcessor API
4.21.1 - Update DocumentIngestorModels Nuget
4.22.0 - Added WorkItem properties for Cancel Job on Failure.
5.0.0 - Enhancments and refactors: Added ActionBuilderService and ActionService classes to handle the workitem action building. Other refactors.
5.0.1 - Add NcoaUpdate workItem
5.0.2 - Update FTP Nuget
5.0.3 - Update File Operatations Nuget
5.0.4 - Add IngestionFolderCleanUp WorkItem
5.0.5 - Correct IngestionFolderCleanUp in ActionBuilderService
5.0.6 - Use latest version of DocumentIngestorModels
5.0.7 - Update DataCleanUpNuget for NCOA Request
5.0.8 - Add MomBotRequest WorkItem
5.0.9 - Add BlendApi Data Sync Request WorkItem
5.0.10 - Update FTP Nuget for ResumeSupportState toggle on download
5.0.11 - Added DialerUploadRequest WorkItem.
5.0.12 - Added UploadDoNotCallRequest WorkItem.
5.0.13 - Update FileOperationsLib nuget
5.0.14 - Added FannieMaeMortgageRequest WorkItem.
5.0.15 - Added CreateVoAppsCampaignsRequest WorkItem.
5.1.0 - Updated CreateVoAppsCampaignsRequest WorkItem.
5.1.1 - Updated CreateVoAppsCampaignsRequest WorkItem.
5.1.2 - Updated CreateVoAppsCampaignsRequest WorkItem.
5.1.3 - Added UploadVoAppsCampaignRequest WorkItem
5.1.4 - Updated model validation on DialerApiModels
5.2.0 - Added new fields on DialerUpload model
5.3.0 - Updated CreateVoAppsCampaignRequest model with new fields.
5.4.0 - Updated CreateVoAppsCampaignRequest model.
5.5.0 - Added ImportCreditCardSalesRequest model.
5.5.1 - Added DataCleanUpIndirectFunding WorkItem.
5.6.0 - Alter BlendApi Data Sync Request WorkItem
5.6.1 - Update IndirectFundRequest
5.6.2 - Added ImportIndirectVehicleSalesRequest model.
5.6.3 - Updated BlendModels Nuget for ApplicationProcess
5.6.4 - Added SkipHolidays to Job model
5.6.5 - Updated Dialer API Nuget for the UploadVoAppsCampaignResultsRequest updates
5.6.6 - Updating the Document Ingestors Models
5.6.7 - Add ValidateFileRequest FileOperations WorkItem
5.6.8 - Added ExtractIndexFileData WorkItem
5.6.9 - Update NuGet packages
5.6.10 - Updated Incentive Manager import models.
5.6.11 - Added IndexFieldMapperRequest model.
5.6.12 - Added DealerAchNotification model.
5.6.13 - Updated ClientHelper.
5.6.14 - Update JSON handling in Client Helper.
5.6.16 - Update clienthelper to add wait
5.6.17 - Remove retry from client helper
5.6.18 - Ensure respone is sent with error information for write-back
5.6.19 - Updated FileUpdaterModels version
5.6.20 - Add RealTimeAlerts WorkItem
5.6.21 - Update NuGet packages
5.6.22 - Update Nuget packages for Osg Tax
5.6.23 - Add RealTimeAlerts Errored Process WorkItem
5.7.0 - Upgrade to dotnet8
5.7.1 - Update NuGet packages
5.7.2 - Update NuGet packages
5.7.3 - Update nuget for Osg DNA Notices Split
5.7.4 - Add Incentive Mgr Work Items
5.7.5 - Update Nuget packages
5.7.6 - Update DocumentIngestorModels Nuget package
5.7.7 - Update DocumentIngestorModel Nuget
5.7.8 - Update NuGet packages
5.7.9 - Update FileOperations NuGet packages
5.7.10 - Added DeleteEmptyDirectoryRequest model
5.7.11 - Add JobStatus in RequestBuilder service
5.7.12 - Added DocumentRetentionCleanup WorkItem
5.7.13 - Update Incentive Mgr Nuget package
5.7.14 - Update Dialer Api Nuget package
5.7.15 - Update File Operations Api Nuget package
5.7.16 - Update CreateJob Method to handle JobStatus
5.7.17 - Update Dialer Api Nuget package Error Process
5.7.18 - Update for Repo API WorkItem
5.7.19 - Update DocumentIngestorModels Nuget Package
5.7.20 - Update Dialer Api Nuget package for campaigns
5.7.21 - Update DocumentIngestorModels Nuget package
</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="LCU.API.Internal.BlendApiWrapperModels" Version="1.0.15" />
<PackageReference Include="LCU.Api.Internal.FTPLib" Version="2.11.3" />
<PackageReference Include="LCU.Library.Internal.ApiResponse.Models" Version="3.3.2" />
<PackageReference Include="LCU.Library.Internal.ArchiverApiModel" Version="1.8.0" />
<PackageReference Include="LCU.Library.Internal.Configuration" Version="1.0.0" />
<PackageReference Include="LCU.Library.Internal.DataCleanUpModel" Version="1.0.9" />
<PackageReference Include="LCU.Library.Internal.DialerApiModels" Version="2.6.3" />
<PackageReference Include="LCU.Library.Internal.DocumentIngestorModels" Version="1.20.3" />
<PackageReference Include="LCU.Library.Internal.DocumentTypeCleanupModels" Version="1.0.0" />
<PackageReference Include="LCU.Library.Internal.FileOperationsModels" Version="4.1.4" />
<PackageReference Include="LCU.Library.Internal.FileUpdaterModels" Version="1.0.3" />
<PackageReference Include="LCU.Library.Internal.IncentiveApiModels" Version="1.1.4" />
<PackageReference Include="LCU.Library.Internal.LcuHttpClient" Version="2.0.1" />
<PackageReference Include="LCU.Library.Internal.MomBotModels" Version="1.0.1" />
<PackageReference Include="LCU.Library.Internal.NoticeProcessorModel" Version="1.0.8" />
<PackageReference Include="LCU.Library.Internal.NotificationsModels" Version="1.0.3" />
<PackageReference Include="LCU.Library.Internal.RealTimeAlertsModels" Version="1.0.2" />
<PackageReference Include="LCU.Library.Internal.RemoteDepositCaptureModel" Version="1.1.5" />
<PackageReference Include="LCU.Library.Internal.RepoApiModels" Version="1.0.0" />
<PackageReference Include="LCU.Library.Internal.RetryUtilities" Version="1.0.0" />
<PackageReference Include="LCU.Library.Internal.TemenosNotificationApiModels" Version="1.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="ncrontab" Version="3.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LCU.Library.Internal.DispatcherModels\LCU.Library.Internal.DispatcherModels.csproj" />
</ItemGroup>
<PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="BuildOnlySettings;ResolveReferences">
<ItemGroup>
<!-- Filter out unnecessary files -->
<_ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')-&gt;WithMetadataValue('PrivateAssets', 'All'))" />
</ItemGroup>
<!-- Print batches for debug purposes -->
<Message Text="Batch for .nupkg: ReferenceCopyLocalPaths = @(_ReferenceCopyLocalPaths), ReferenceCopyLocalPaths.DestinationSubDirectory = %(_ReferenceCopyLocalPaths.DestinationSubDirectory) Filename = %(_ReferenceCopyLocalPaths.Filename) Extension = %(_ReferenceCopyLocalPaths.Extension)" Importance="High" Condition="'@(_ReferenceCopyLocalPaths)' != ''" />
<ItemGroup>
<!-- Add file to package with consideration of sub folder. If empty, the root folder is chosen. -->
<BuildOutputInPackage Include="@(_ReferenceCopyLocalPaths)" TargetPath="%(_ReferenceCopyLocalPaths.DestinationSubDirectory)" />
</ItemGroup>
</Target>
</Project>
@@ -0,0 +1,38 @@
using System;
using NCrontab;
using Serilog;
using LCU.Library.Internal.DispatcherModels.Entities;
using LCU.Library.Internal.DispatcherModels.Enums;
namespace LCU.Api.Internal.DispatcherSharedLib.Utilities;
public static class CronHelpers
{
public static void SetNextScheduledRunTime(ref Job job)
{
var isCronSchedule = !string.IsNullOrEmpty(job.CronSchedule);
if (isCronSchedule)
{
CrontabSchedule schedule = CrontabSchedule.Parse(job.CronSchedule);
job.NextRunTime = schedule.GetNextOccurrence(DateTime.Now);
if (job.SkipHolidays)
{
job.NextRunTime = HolidayHelpers.HandleHolidays(job.NextRunTime);
}
job.JobStatus = JobStatus.ReadyToSchedule;
}
}
public static CrontabSchedule SetCronSchedule(string cron, string cronDefault)
{
try
{
return CrontabSchedule.Parse(cron);
}
catch (Exception exception)
{
Log.Error(exception, "Failure parsing cron-tab in appsettings.");
return CrontabSchedule.Parse(cronDefault);
}
}
}
@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace LCU.Api.Internal.DispatcherSharedLib.Utilities;
public static class HolidayHelpers
{
public static DateTime? HandleHolidays(DateTime? nextRunTime)
{
if (nextRunTime != null)
{
List<DateTime> holidays = GetHolidays(nextRunTime.Value.Year);
var today = Convert.ToDateTime(nextRunTime).Date;
var isHoliday = holidays.Where(x => today == x).Any();
if (isHoliday)
{
nextRunTime = nextRunTime.Value.AddDays(1);
}
}
return nextRunTime;
}
private static List<DateTime> GetHolidays(int year)
{
List<DateTime> holidays = new List<DateTime>
{
GetNewYearsDay(year),
GetMemorialDay(year),
GetIndependenceDay(year),
GetLaborDay(year),
GetThanksgivingDay(year),
GetChristmasDay(year)
};
return holidays;
}
///<summary> New Years Day - Jan 1st </summary>
public static DateTime GetNewYearsDay(int year)
{
return new DateTime(year, 1, 1).Date;
}
///<summary> Memorial Day - last Monday in May </summary>
public static DateTime GetMemorialDay(int year)
{
DateTime memorialDay = new DateTime(year, 5, 31);
var dayOfWeek = memorialDay.DayOfWeek;
while (dayOfWeek != DayOfWeek.Monday)
{
memorialDay = memorialDay.AddDays(-1);
dayOfWeek = memorialDay.DayOfWeek;
}
return memorialDay.Date;
}
///<summary> Independence Day - July 4th </summary>
public static DateTime GetIndependenceDay(int year)
{
return new DateTime(year, 7, 4).Date;
}
///<summary> Labor Day -- 1st Monday in September </summary>
public static DateTime GetLaborDay(int year)
{
DateTime laborDay = new DateTime(year, 9, 1);
var dayOfWeek = laborDay.DayOfWeek;
while (dayOfWeek != DayOfWeek.Monday)
{
laborDay = laborDay.AddDays(1);
dayOfWeek = laborDay.DayOfWeek;
}
return laborDay.Date;
}
///<summary> Thanksgiving Day - 4th Thursday in November </summary>
public static DateTime GetThanksgivingDay(int year)
{
var thanksgiving = (from day in Enumerable.Range(1, 30)
where new DateTime(year, 11, day).DayOfWeek == DayOfWeek.Thursday
select day).ElementAt(3);
return new DateTime(year, 11, thanksgiving).Date;
}
///<summary> Christmas Day - Dec 25th </summary>
public static DateTime GetChristmasDay(int year)
{
return new DateTime(year, 12, 25).Date;
}
}