This commit is contained in:
Zeeshaun
2026-04-27 15:26:58 +00:00
parent 5f6f132ea2
commit 6291ac76dd
15 changed files with 56 additions and 37 deletions
@@ -8,6 +8,7 @@ using LCU.Library.Internal.IncentiveApiModels.Entities;
using LCU.Library.Internal.IncentiveApiModels.Enums;
using LCU.API.Internal.Operations.IncentiveApi.Services.MicroApiServices;
using LCU.Library.Internal.IncentiveApiModels.Requests;
using LCU.API.Internal.Operations.IncentiveApi.Services;
using LCU.API.Internal.Operations.IncentiveApi.Services.Transformations;
using LCU.Library.Internal.ApiResponse.Services;
using LCU.Library.Internal.IncentiveApiModels.Results;
@@ -43,14 +44,14 @@ public class ActionCreditCardImportService : IActionCreditCardImportService
Log.Information($"Imported {importedBusiness.Count} credit cards - business.");
_actionCreditCardResult.MessageStack.Add($"Imported {importedPersonal.Count()} personal and {importedBusiness.Count()} business credit cards.");
await QueueReturnResponse.QueueResponse(request, _actionCreditCardResult.Success, _actionCreditCardResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _actionCreditCardResult.Success, _actionCreditCardResult.MessageStack, nameof(ActionCreditCardImportService));
}
catch (Exception exception)
{
var message = $"There was an issue with handling Import Action Credit Card Sales Exception Message: {exception.Message}.";
_actionCreditCardResult.MessageStack.Add(message);
_actionCreditCardResult.Success = false;
await QueueReturnResponse.QueueResponse(request, _actionCreditCardResult.Success, _actionCreditCardResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _actionCreditCardResult.Success, _actionCreditCardResult.MessageStack, nameof(ActionCreditCardImportService));
}
}
@@ -8,6 +8,7 @@ using LCU.Library.Internal.IncentiveApiModels.Entities;
using LCU.Library.Internal.IncentiveApiModels.Enums;
using LCU.API.Internal.Operations.IncentiveApi.Services.MicroApiServices;
using LCU.Library.Internal.IncentiveApiModels.Requests;
using LCU.API.Internal.Operations.IncentiveApi.Services;
using LCU.API.Internal.Operations.IncentiveApi.Services.Transformations;
using LCU.Library.Internal.IncentiveApiModels.Results;
using LCU.Library.Internal.ApiResponse.Services;
@@ -40,14 +41,14 @@ public class ActionVehicleImportService : IActionVehicleImportService
Log.Information($"Imported {importedVehicleSales.Count} Action Vehicle Sales.");
_actionVehicleProcessResult.MessageStack.Add($"Imported {importedVehicleSales.Count()} Action Vehicle Sales.");
await QueueReturnResponse.QueueResponse(request, _actionVehicleProcessResult.Success, _actionVehicleProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _actionVehicleProcessResult.Success, _actionVehicleProcessResult.MessageStack, nameof(ActionVehicleImportService));
}
catch (Exception exception)
{
var message = $"There was an issue with handling Import Action Vehicle Sales Exception Message: {exception.Message}.";
_actionVehicleProcessResult.MessageStack.Add(message);
_actionVehicleProcessResult.Success = false;
await QueueReturnResponse.QueueResponse(request, _actionVehicleProcessResult.Success, _actionVehicleProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _actionVehicleProcessResult.Success, _actionVehicleProcessResult.MessageStack, nameof(ActionVehicleImportService));
}
}
@@ -11,6 +11,7 @@ using LCU.API.Internal.Operations.IncentiveApi.Models.Allied;
using LCU.Library.Internal.IncentiveApiModels.Enums;
using LCU.Library.Internal.IncentiveApiModels.Entities;
using LCU.Library.Internal.IncentiveApiModels.Requests;
using LCU.API.Internal.Operations.IncentiveApi.Services;
using LCU.API.Internal.Operations.IncentiveApi.Services.MicroApiServices;
using LCU.API.Internal.Operations.IncentiveApi.Services.Transformations;
using LCU.Library.Internal.ApiResponse.Services;
@@ -60,14 +61,14 @@ public class AlliedGapMbpTransactionImportService : IAlliedGapMbpTransactionImpo
Log.Information($"Matched/Removed {matchedRemoved} Allied Gap/Mbp records.");
_alliedGapMbpProcessResult.MessageStack.Add($"Imported {importedAlliedSales.Count()} sales, Matched/Removed {matchedRemoved} records for Allied Gap/Mbp Sales processing.");
await QueueReturnResponse.QueueResponse(request, _alliedGapMbpProcessResult.Success, _alliedGapMbpProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _alliedGapMbpProcessResult.Success, _alliedGapMbpProcessResult.MessageStack, nameof(AlliedGapMbpTransactionImportService));
}
catch (Exception exception)
{
var message = $"There was an issue with handling Import Allied Gap/Mbp Sales Exception Message: {exception.Message}.";
_alliedGapMbpProcessResult.MessageStack.Add(message);
_alliedGapMbpProcessResult.Success = false;
await QueueReturnResponse.QueueResponse(request, _alliedGapMbpProcessResult.Success, _alliedGapMbpProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _alliedGapMbpProcessResult.Success, _alliedGapMbpProcessResult.MessageStack, nameof(AlliedGapMbpTransactionImportService));
}
}
@@ -1,5 +1,6 @@
using LCU.API.Internal.Operations.IncentiveApi.Exceptions;
using LCU.API.Internal.Operations.IncentiveApi.Extensions;
using LCU.API.Internal.Operations.IncentiveApi.Services;
using LCU.Library.Internal.IncentiveApiModels.Entities;
using LCU.Library.Internal.IncentiveApiModels.Enums;
using LCU.Library.Internal.IncentiveApiModels.Common;
@@ -60,14 +61,14 @@ public class ActivityDecisionService : IActivityDecisionService
Log.Information(dpEligibleDecisionResults);
_incentiveProcessResult.MessageStack.Add(dpEligibleDecisionResults);
await QueueReturnResponse.QueueResponse(request, _incentiveProcessResult.Success, _incentiveProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _incentiveProcessResult.Success, _incentiveProcessResult.MessageStack, nameof(ActivityDecisionService));
}
catch (Exception exception)
{
var message = $"There was an issue with handling the Daily Decision Process Exception Message: {exception.Message}.";
_incentiveProcessResult.MessageStack.Add(message);
_incentiveProcessResult.Success = false;
await QueueReturnResponse.QueueResponse(request, _incentiveProcessResult.Success, _incentiveProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _incentiveProcessResult.Success, _incentiveProcessResult.MessageStack, nameof(ActivityDecisionService));
}
}
@@ -4,6 +4,7 @@ using LCU.API.Internal.Operations.IncentiveApiLib.Services;
using LCU.API.Internal.Operations.IncentiveApiLib.Repositories;
using LCU.Library.Internal.IncentiveApiModels.Entities;
using LCU.Library.Internal.IncentiveApiModels.Results;
using LCU.API.Internal.Operations.IncentiveApi.Services;
using LCU.API.Internal.Operations.IncentiveApi.Services.MicroApiServices;
using LCU.API.Internal.Operations.IncentiveApi.Configuration;
using LCU.Library.Internal.IncentiveApiModels.Requests;
@@ -68,7 +69,7 @@ public class DayForceSyncService : IDayForceSyncService
Log.Information("Completed Dayforce Sync Process for Terminated Users.");
_dayforceSyncProcessResult.MessageStack.Add($"Dayforce Sync Process for Terminated Users complete with {terminatedUsersResult.Count()}");
await QueueReturnResponse.QueueResponse(request, _dayforceSyncProcessResult.Success, _dayforceSyncProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _dayforceSyncProcessResult.Success, _dayforceSyncProcessResult.MessageStack, nameof(DayForceSyncService));
}
catch ( Exception exception )
{
@@ -76,7 +77,7 @@ public class DayForceSyncService : IDayForceSyncService
var message = $"There was an issue with handling the Dayforce Sync Service Process Exception Message: {exception.Message}.";
_dayforceSyncProcessResult.MessageStack.Add(message);
_dayforceSyncProcessResult.Success = false;
await QueueReturnResponse.QueueResponse(request, _dayforceSyncProcessResult.Success, _dayforceSyncProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _dayforceSyncProcessResult.Success, _dayforceSyncProcessResult.MessageStack, nameof(DayForceSyncService));
}
}
@@ -31,7 +31,7 @@ public class DnaActivitySyncService : IDnaActivitySyncService
Log.Information(message);
_incentiveProcessResult = await _incentiveProcessesService.SyncLatestActivitiesFromDna(request);
await QueueReturnResponse.QueueResponse(request, _incentiveProcessResult.Success, _incentiveProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _incentiveProcessResult.Success, _incentiveProcessResult.MessageStack, nameof(DnaActivitySyncService));
}
catch (Exception exception)
{
@@ -39,7 +39,7 @@ public class DnaActivitySyncService : IDnaActivitySyncService
var message = $"There was an issue with {processType}. Exception Message: {exception.Message}.";
_incentiveProcessResult.MessageStack.Add(message);
_incentiveProcessResult.Success = false;
await QueueReturnResponse.QueueResponse(request, _incentiveProcessResult.Success, _incentiveProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _incentiveProcessResult.Success, _incentiveProcessResult.MessageStack, nameof(DnaActivitySyncService));
}
}
@@ -156,7 +156,7 @@ public class GoalDispersalService : IGoalDispersalService
_goalDispersalProcessResult.MessageStack.Add($"Goal Dispersal Service Processed for {request.StartDate.Month}{request.StartDate.Year} records.");
Log.Information("Successfully Sent Report Email.");
await QueueReturnResponse.QueueResponse(request, _goalDispersalProcessResult.Success, _goalDispersalProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _goalDispersalProcessResult.Success, _goalDispersalProcessResult.MessageStack, nameof(GoalDispersalService));
}
catch (Exception exception)
{
@@ -167,7 +167,7 @@ public class GoalDispersalService : IGoalDispersalService
var message = $"There was an issue with handling the Goal Dispersal Service Process {processLabel}. Exception Message: {exception.Message}.";
_goalDispersalProcessResult.MessageStack.Add(message);
_goalDispersalProcessResult.Success = false;
await QueueReturnResponse.QueueResponse(request, _goalDispersalProcessResult.Success, _goalDispersalProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _goalDispersalProcessResult.Success, _goalDispersalProcessResult.MessageStack, nameof(GoalDispersalService));
}
}
@@ -1,6 +1,7 @@
using LCU.Library.Internal.IncentiveApiModels.Requests;
using LCU.Library.Internal.IncentiveApiModels.Results;
using LCU.Library.Internal.LCUServiceFactory.Services;
using LCU.API.Internal.Operations.IncentiveApi.Services;
using LCU.API.Internal.Operations.IncentiveApi.Services.NightlyIncentiveProcesses;
using LCU.Library.Internal.ApiResponse.Services;
@@ -31,14 +32,14 @@ public class NightlyActivityDecisionService : INightlyActivityDecisionService
Log.Information(message);
_processResult = await _nightlyIncentiveProcessesService.RunProductDecisionProcess(request);
await QueueReturnResponse.QueueResponse(request, _processResult.Success, _processResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _processResult.Success, _processResult.MessageStack, nameof(NightlyActivityDecisionService));
}
catch (Exception exception)
{
var message = $"There was an issue with handling the Daily Decision Process Exception Message: {exception.Message}.";
_processResult.MessageStack.Add(message);
_processResult.Success = false;
await QueueReturnResponse.QueueResponse(request, _processResult.Success, _processResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _processResult.Success, _processResult.MessageStack, nameof(NightlyActivityDecisionService));
}
}
}
@@ -1,6 +1,7 @@
using LCU.API.Internal.Operations.IncentiveApi.Models.Dayforce;
using LCU.API.Internal.Operations.IncentiveApi.Models.Payout;
using LCU.API.Internal.Operations.IncentiveApiLib.Repositories;
using LCU.API.Internal.Operations.IncentiveApi.Services;
using LCU.Library.Internal.IncentiveApiModels.Entities;
using LCU.Library.Internal.IncentiveApiModels.Common;
using LCU.Library.Internal.IncentiveApiModels.Requests;
@@ -40,7 +41,7 @@ public class PayoutService : IPayoutService
var result = await CreateMonthlyIncentivePayouts(request);
Log.Information("Successfully Processed Monthly Incentive Payouts.");
await QueueReturnResponse.QueueResponse(request, _payoutIncentiveProcessResult.Success, _payoutIncentiveProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _payoutIncentiveProcessResult.Success, _payoutIncentiveProcessResult.MessageStack, nameof(PayoutService));
}
catch (Exception exception)
{
@@ -49,7 +50,7 @@ public class PayoutService : IPayoutService
var message = $"There was an Unhandled error with Monthly Incentive Payout Process from {monthsBack} months back from today's date. Exception Message: {exception.Message}.";
_payoutIncentiveProcessResult.MessageStack.Add(message);
_payoutIncentiveProcessResult.Success = false;
await QueueReturnResponse.QueueResponse(request, _payoutIncentiveProcessResult.Success, _payoutIncentiveProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _payoutIncentiveProcessResult.Success, _payoutIncentiveProcessResult.MessageStack, nameof(PayoutService));
}
}
@@ -1,4 +1,5 @@
using LCU.API.Internal.Operations.IncentiveApiLib.Repositories;
using LCU.API.Internal.Operations.IncentiveApi.Services;
using LCU.API.Internal.Operations.IncentiveApi.Services.Payout;
using LCU.Library.Internal.IncentiveApiModels.Common;
using LCU.Library.Internal.IncentiveApiModels.Requests;
@@ -31,14 +32,14 @@ public class ReportingService : IReportingService
_payoutService.CreateMonthlyAccountingPayouts(range).GetAwaiter().GetResult();
Log.Information($"Reporting Service processed");
_reportingProcessResult.MessageStack.Add($"Reporting Service Processed Month Starting {range.ToMonth}.");
await QueueReturnResponse.QueueResponse(request, _reportingProcessResult.Success, _reportingProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _reportingProcessResult.Success, _reportingProcessResult.MessageStack, nameof(ReportingService));
}
catch (Exception exception)
{
var message = $"There was an issue with handling the Reporting Service Process Exception Message: {exception.Message}.";
_reportingProcessResult.MessageStack.Add(message);
_reportingProcessResult.Success = false;
await QueueReturnResponse.QueueResponse(request, _reportingProcessResult.Success, _reportingProcessResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _reportingProcessResult.Success, _reportingProcessResult.MessageStack, nameof(ReportingService));
}
}
}
@@ -4,6 +4,7 @@ using System.Globalization;
using System.IO;
using LCU.API.Internal.Operations.IncentiveApi.Services.MicroApiServices;
using LCU.API.Internal.Operations.IncentiveApi.Models.Temenos;
using LCU.API.Internal.Operations.IncentiveApi.Services;
using LCU.Library.Internal.ApiResponse.Services;
using LCU.Library.Internal.Exceptions;
using LCU.Library.Internal.IncentiveApiModels.Requests;
@@ -51,14 +52,14 @@ public class ImportCreditCardSalesService : IImportCreditCardSalesService
}
_importCreditCardResult.MessageStack.Add( $"Imported {personalCardCount} personal and {businesCardCount} business credit cards.");
await QueueReturnResponse.QueueResponse(request, _importCreditCardResult.Success, _importCreditCardResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _importCreditCardResult.Success, _importCreditCardResult.MessageStack, nameof(ImportCreditCardSalesService));
}
catch (Exception exception)
{
var message = $"There was an issue with handling Import Credit Card Sales Exception Message: {exception.Message}.";
_importCreditCardResult.MessageStack.Add(message);
_importCreditCardResult.Success = false;
await QueueReturnResponse.QueueResponse(request, _importCreditCardResult.Success, _importCreditCardResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _importCreditCardResult.Success, _importCreditCardResult.MessageStack, nameof(ImportCreditCardSalesService));
}
}
@@ -4,6 +4,7 @@ using System.Globalization;
using System.IO;
using LCU.API.Internal.Operations.IncentiveApi.Services.MicroApiServices;
using LCU.API.Internal.Operations.IncentiveApi.Models.Temenos;
using LCU.API.Internal.Operations.IncentiveApi.Services;
using LCU.Library.Internal.ApiResponse.Services;
using LCU.Library.Internal.Exceptions;
using LCU.Library.Internal.IncentiveApiModels.Requests;
@@ -40,14 +41,14 @@ public class ImportIndirectVehicleSalesService : IImportIndirectVehicleSalesServ
{
var records = await GetIndirectVehicleRecordsForImport(request);
await CreateAndSaveActivities(records);
await QueueReturnResponse.QueueResponse(request, _importIndirectVehicleSalesResult.Success, _importIndirectVehicleSalesResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _importIndirectVehicleSalesResult.Success, _importIndirectVehicleSalesResult.MessageStack, nameof(ImportIndirectVehicleSalesService));
}
catch (Exception exception)
{
var message = $"There was an issue with handling Import Indirect Vehicle Sales. Exception Message: {exception.Message}.";
_importIndirectVehicleSalesResult.MessageStack.Add(message);
_importIndirectVehicleSalesResult.Success = false;
await QueueReturnResponse.QueueResponse(request, _importIndirectVehicleSalesResult.Success, _importIndirectVehicleSalesResult.MessageStack);
await SafeQueueReturnResponse.TryQueueResponse(request, _importIndirectVehicleSalesResult.Success, _importIndirectVehicleSalesResult.MessageStack, nameof(ImportIndirectVehicleSalesService));
}
}
@@ -214,12 +214,19 @@
return;
}
await JSRuntime.InvokeVoidAsync(
"synthesizeSpeech",
spitConfiguration.SpeechApiKey,
spitConfiguration.Region,
spitConfiguration.ResolveSpeechSdkEndpointUri()?.ToString(),
_textToSpeech.Ssml);
try
{
await JSRuntime.InvokeVoidAsync(
"synthesizeSpeech",
spitConfiguration.SpeechApiKey,
spitConfiguration.Region,
spitConfiguration.ResolveSpeechSdkEndpointUri()?.ToString(),
_textToSpeech.Ssml);
}
catch (Microsoft.JSInterop.JSException)
{
toastService.ShowError("Unable to load the speech playback SDK in the browser. Disable content blocking for this site or reload and try again.");
}
}
public void OpenDirectory(string fileDestination)
@@ -22,6 +22,7 @@ namespace LCU.Webapps.Marketing.SPIT.Services
try
{
var speechConfig = BuildSpeechConfig();
speechConfig.SetSpeechSynthesisOutputFormat(SpeechSynthesisOutputFormat.Riff16Khz16BitMonoPcm);
speechConfig.SpeechSynthesisVoiceName = textToSpeech.SelectedVoiceShortName;
var finalDestination = (_spitConfiguration.FileDestination ?? string.Empty).Trim();
if (string.IsNullOrWhiteSpace(finalDestination))
@@ -1,14 +1,15 @@
function synthesizeSpeech(subscriptionKey, region, endpoint, ssml) {
var SpeechSDK;
if (!!window.SpeechSDK) {
SpeechSDK = window.SpeechSDK;
const speechSdk = window.SpeechSDK;
if (!speechSdk) {
throw new Error("Speech SDK is unavailable. The browser likely blocked the SDK script.");
}
const speechConfig = endpoint
? SpeechSDK.SpeechConfig.fromEndpoint(new URL(endpoint), subscriptionKey)
: SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey, region);
const audioConfig = SpeechSDK.AudioConfig.fromDefaultSpeakerOutput();
let synthesizer = new SpeechSDK.SpeechSynthesizer(speechConfig, audioConfig);
? speechSdk.SpeechConfig.fromEndpoint(new URL(endpoint), subscriptionKey)
: speechSdk.SpeechConfig.fromSubscription(subscriptionKey, region);
const audioConfig = speechSdk.AudioConfig.fromDefaultSpeakerOutput();
let synthesizer = new speechSdk.SpeechSynthesizer(speechConfig, audioConfig);
synthesizer.speakSsmlAsync(
ssml,