Adding
This commit is contained in:
+86
@@ -0,0 +1,86 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Action;
|
||||
|
||||
public class ActionCreditCardBusinessRow : IActionFileObject
|
||||
{
|
||||
public string BookedDate { get; set; }
|
||||
public string BusinessTradeName { get; set; }
|
||||
public string BusinessLegalName { get; set; }
|
||||
public string AppID { get; set; }
|
||||
public string Principal { get; set; }
|
||||
public string ProdDetailFirstName { get; set; }
|
||||
public string ProdDetailLastName { get; set; }
|
||||
public string ProdDetailEmail { get; set; }
|
||||
public string ProdDetailEmployeeNum { get; set; }
|
||||
public string IncentiveEarnedEmail { get; set; }
|
||||
public string ProductShortName { get; set; }
|
||||
|
||||
public Activity CreateActivity(AppUser appUser)
|
||||
{
|
||||
var homeDept = appUser.FindHomeDepartment();
|
||||
return new Activity()
|
||||
{
|
||||
Product = Product.CreditCard,
|
||||
Type = ActivityType.Sale,
|
||||
State = ActivityState.Accepted,
|
||||
SourceSystem = SystemType.Action,
|
||||
SourceCreated = DateTime.Parse(BookedDate),
|
||||
Accepted = DateTime.Parse(BookedDate).Date.AddHours(12),
|
||||
SourceId = AppID,
|
||||
Detail = new ActivityDetail()
|
||||
{
|
||||
MemberName = BusinessLegalName,
|
||||
AccountBalance = IActionFileObject.ParseMoneyDouble(Principal),
|
||||
AccountStatus = ProductShortName
|
||||
},
|
||||
AppUserId = appUser.Id,
|
||||
EmployeeEmail = appUser.AdEmail,
|
||||
EmployeeId = appUser.EmployeeId,
|
||||
DepartmentId = homeDept.DepartmentId
|
||||
};
|
||||
}
|
||||
|
||||
public DeadActivity CreateDeadActivity(DeadActivityReason reasonCode, string note, string employeeEmail = null, string employeeId = null)
|
||||
{
|
||||
return new DeadActivity(AppID, SystemType.Action, reasonCode, note)
|
||||
{
|
||||
Product = Product.CreditCard,
|
||||
Type = ActivityType.Sale,
|
||||
State = ActivityState.Accepted,
|
||||
SourceSystem = SystemType.Action,
|
||||
SourceCreated = DateTime.Parse(BookedDate),
|
||||
Accepted = DateTime.Parse(BookedDate).Date.AddHours(12),
|
||||
SourceId = AppID,
|
||||
DeadDetail = new DeadActivityDetail()
|
||||
{
|
||||
MemberName = BusinessLegalName,
|
||||
AccountBalance = IActionFileObject.ParseMoneyDouble(Principal),
|
||||
AccountStatus = ProductShortName
|
||||
},
|
||||
EmployeeEmail = employeeEmail,
|
||||
EmployeeId = employeeId,
|
||||
};
|
||||
}
|
||||
|
||||
public string GetEmployeeEmail()
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(IncentiveEarnedEmail) ? null : IncentiveEarnedEmail.Trim();
|
||||
}
|
||||
|
||||
public string GetLoanOfficerEmail()
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(ProdDetailEmail) ? null : ProdDetailEmail.Trim();
|
||||
}
|
||||
|
||||
public string GetLoanOfficerEmailByName()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ProdDetailFirstName) || string.IsNullOrWhiteSpace(ProdDetailLastName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return $"{ProdDetailFirstName.Trim()}{ProdDetailLastName.Trim()}@landmarkcu.com";
|
||||
}
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Action;
|
||||
|
||||
public class ActionCreditCardPersonalRow : IActionFileObject
|
||||
{
|
||||
public string BookedDate { get; set; }
|
||||
public string MemberFirstName { get; set; }
|
||||
public string MemberLastName { get; set; }
|
||||
public string AppID { get; set; }
|
||||
public string Principal { get; set; }
|
||||
public string ProdDetailFirstName { get; set; }
|
||||
public string ProdDetailLastName { get; set; }
|
||||
public string ProdDetailEmail { get; set; }
|
||||
public string ProdDetailEmployeeNum { get; set; }
|
||||
public string IncentiveEarnedEmail { get; set; }
|
||||
public string ProductShortName { get; set; }
|
||||
|
||||
public Activity CreateActivity(AppUser appUser)
|
||||
{
|
||||
var homeDept = appUser.FindHomeDepartment();
|
||||
return new Activity()
|
||||
{
|
||||
Product = Product.CreditCard,
|
||||
Type = ActivityType.Sale,
|
||||
State = ActivityState.Accepted,
|
||||
SourceSystem = SystemType.Action,
|
||||
SourceCreated = DateTime.Parse(BookedDate),
|
||||
Accepted = DateTime.Parse(BookedDate).Date.AddHours(12),
|
||||
SourceId = AppID,
|
||||
Detail = new ActivityDetail()
|
||||
{
|
||||
MemberName = MemberFirstName + " " + MemberLastName,
|
||||
AccountBalance = IActionFileObject.ParseMoneyDouble(Principal),
|
||||
AccountStatus = ProductShortName
|
||||
},
|
||||
AppUserId = appUser.Id,
|
||||
EmployeeEmail = appUser.AdEmail,
|
||||
EmployeeId = appUser.EmployeeId,
|
||||
DepartmentId = homeDept.DepartmentId
|
||||
};
|
||||
}
|
||||
|
||||
public DeadActivity CreateDeadActivity(DeadActivityReason reasonCode, string note, string employeeEmail = null, string employeeId = null)
|
||||
{
|
||||
return new DeadActivity(AppID, SystemType.Action, reasonCode, note)
|
||||
{
|
||||
Product = Product.CreditCard,
|
||||
Type = ActivityType.Sale,
|
||||
State = ActivityState.Accepted,
|
||||
SourceSystem = SystemType.Action,
|
||||
SourceCreated = DateTime.Parse(BookedDate),
|
||||
Accepted = DateTime.Parse(BookedDate).Date.AddHours(12),
|
||||
SourceId = AppID,
|
||||
DeadDetail = new DeadActivityDetail()
|
||||
{
|
||||
MemberName = MemberFirstName + " " + MemberLastName,
|
||||
AccountBalance = IActionFileObject.ParseMoneyDouble(Principal),
|
||||
AccountStatus = ProductShortName
|
||||
},
|
||||
EmployeeEmail = employeeEmail,
|
||||
EmployeeId = employeeId,
|
||||
};
|
||||
}
|
||||
|
||||
public string GetEmployeeEmail()
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(IncentiveEarnedEmail) ? null : IncentiveEarnedEmail.Trim();
|
||||
}
|
||||
|
||||
public string GetLoanOfficerEmail()
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(ProdDetailEmail) ? null : ProdDetailEmail.Trim();
|
||||
}
|
||||
|
||||
public string GetLoanOfficerEmailByName()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ProdDetailFirstName) || string.IsNullOrWhiteSpace(ProdDetailLastName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return $"{ProdDetailFirstName.Trim()}{ProdDetailLastName.Trim()}@landmarkcu.com";
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Action;
|
||||
|
||||
public class ActionSaleRow
|
||||
{
|
||||
public string EmailAddress { get; set; }
|
||||
public string Member_Number { get; set; }
|
||||
public string Account_Number { get; set; }
|
||||
public string Borrower_Name { get; set; }
|
||||
public string APP_START_DATE { get; set; }
|
||||
public string OPEN_DATE { get; set; }
|
||||
public string PBorrowerSSN_Ind { get; set; }
|
||||
public string CBorrowerName_Ind { get; set; }
|
||||
public string CBorrowerSSN_Ind { get; set; }
|
||||
public string SBorrowerName_Ind { get; set; }
|
||||
public string SBorrowerSSN_Ind { get; set; }
|
||||
public string IndAppID { get; set; }
|
||||
public string IndProduct { get; set; }
|
||||
public string IndAmtFinanced { get; set; }
|
||||
public string IndCreationDate { get; set; }
|
||||
public string IndAccountNumber { get; set; }
|
||||
public string PBorrowerName_Veh { get; set; }
|
||||
public string PBorrowerSSN_Veh { get; set; }
|
||||
public string CBorrowerName_Veh { get; set; }
|
||||
public string CBorrowerSSN_Veh { get; set; }
|
||||
public string SBorrowerName_Veh { get; set; }
|
||||
public string SBorrowerSSN_Veh { get; set; }
|
||||
public string VehAppID { get; set; }
|
||||
public string VehProduct { get; set; }
|
||||
public string VehAmtFinanced { get; set; }
|
||||
public string DistributionChannel { get; set; }
|
||||
public string DistributionChannelCode { get; set; }
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using System.Globalization;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Action;
|
||||
|
||||
public interface IActionFileObject
|
||||
{
|
||||
static readonly CultureInfo USEnglish = new CultureInfo("en-US");
|
||||
public Activity CreateActivity(AppUser appUser);
|
||||
public string GetEmployeeEmail();
|
||||
public string GetLoanOfficerEmail();
|
||||
public string GetLoanOfficerEmailByName();
|
||||
public DeadActivity CreateDeadActivity(DeadActivityReason reasonCode, string note, string employeeEmail = null, string employeeId = null);
|
||||
public static double? ParseMoneyDouble(string indAmtFinanced)
|
||||
{
|
||||
var parsed = decimal.Parse(indAmtFinanced, NumberStyles.Currency, USEnglish);
|
||||
return (double)parsed;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class ActivityDetailUpdateOrder
|
||||
{
|
||||
public Activity ExistingActivity { get; set; }
|
||||
public List<ActivityAccountDetails> DetailUpdates { get; set; }
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class ActivityProcessingOrder
|
||||
{
|
||||
public Activity ExistingActivity { get; set; }
|
||||
public List<Activity> ActivityUpdateItems { get; set; }
|
||||
public bool ProcessingComplete { get; set; }
|
||||
public int UpdateCount { get; set; }
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
using CsvHelper.Configuration.Attributes;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Allied;
|
||||
|
||||
public class AlliedSaleRow
|
||||
{
|
||||
[Name("Quoter")]
|
||||
public string Quoter { get; set; }
|
||||
[Name("Issuer")]
|
||||
public string Issuer { get; set; }
|
||||
[Name("Origin")]
|
||||
public string Origin { get; set; }
|
||||
[Name("Product_Type")]
|
||||
public string ProductType { get; set; }
|
||||
[Name("Status")]
|
||||
public string Status { get; set; }
|
||||
[Name("Sale_Date")]
|
||||
public string SaleDate { get; set; }
|
||||
[Name("Sale_Effective_Date")]
|
||||
public string SaleEffectiveDate { get; set; }
|
||||
[Name("Cancellation_Date")]
|
||||
public string CancellationDate { get; set; }
|
||||
[Name("Cancellation_Reason")]
|
||||
public string CancellationReason { get; set; }
|
||||
[Name("Cancelled_By")]
|
||||
public string CancelledBy { get; set; }
|
||||
[Name("Sales_Contract_Number")]
|
||||
public string SalesContractNumber { get; set; }
|
||||
[Name("Buyer")]
|
||||
public string Buyer { get; set; }
|
||||
[Name("Account_Number")]
|
||||
public string AccountNumber { get; set; }
|
||||
[Name("LOS_LOAN_APP_ID_TX")]
|
||||
public string LosLoanAppIdTx { get; set; }
|
||||
[Name("Program_Type")]
|
||||
public string ProgramType { get; set; }
|
||||
[Name("Buyer_Cost")]
|
||||
public string BuyerCost { get; set; }
|
||||
[Name("Flagged_Reasons")]
|
||||
public string FlaggedReasons { get; set; }
|
||||
|
||||
public string DetermineAccountNumber()
|
||||
{
|
||||
var accountNumber = "";
|
||||
if (!string.IsNullOrEmpty(AccountNumber))
|
||||
{
|
||||
accountNumber = AccountNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
accountNumber = SalesContractNumber ?? "";
|
||||
}
|
||||
|
||||
if (accountNumber.Contains("-"))
|
||||
{
|
||||
var transform = accountNumber.Split("-");
|
||||
if (transform?.Length == 2)
|
||||
{
|
||||
return transform[0].Trim();
|
||||
}
|
||||
}
|
||||
|
||||
return accountNumber;
|
||||
}
|
||||
|
||||
public Product DetermineAlliedProduct()
|
||||
{
|
||||
if (string.Equals(ProductType.Trim(), "mbp", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
return Product.MechanicalBreakdownProtection;
|
||||
}
|
||||
|
||||
if (string.Equals(ProductType.Trim(), "gap", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
return Product.GAPInsurance;
|
||||
}
|
||||
|
||||
throw new Exception($"Allied should only pass MBP or GAP for product, but received {ProductType}");
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class AuthorizedActivityCommands
|
||||
{
|
||||
public AuthorizedActivityCommands(ActivityState[] allowedChanges,
|
||||
bool canApproveTransferFrom = false, bool canApproveTransferTo = false)
|
||||
{
|
||||
AllowedChanges = allowedChanges;
|
||||
CanApproveTransferFrom = canApproveTransferFrom;
|
||||
CanApproveTransferTo = canApproveTransferTo;
|
||||
}
|
||||
public ActivityState[] AllowedChanges { get; }
|
||||
public bool CanApproveTransferFrom { get; }
|
||||
public bool CanApproveTransferTo { get; }
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Common;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class BusinessLineProgress: IViewTransformable<BusinessLineProgress>
|
||||
{
|
||||
public BusinessLineProgress(BusinessLine businessLine, MonthRange monthRange)
|
||||
{
|
||||
BusinessLine = businessLine;
|
||||
MonthRange = monthRange;
|
||||
Departments = new List<DepartmentProgress>();
|
||||
}
|
||||
|
||||
public BusinessLine BusinessLine { get; }
|
||||
public MonthRange MonthRange{ get; }
|
||||
public IList<DepartmentProgress> Departments { get; }
|
||||
|
||||
public BusinessLineProgress TransformForView()
|
||||
{
|
||||
foreach(var department in Departments)
|
||||
{
|
||||
department?.TransformForView();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Constants;
|
||||
|
||||
public static class SystemAppUserConstants
|
||||
{
|
||||
public const string DigitalBankingEmail = "[email protected]";
|
||||
public const string FirstMortgageEmail = "[email protected]";
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Constants;
|
||||
|
||||
public static class TemenosImportConstants
|
||||
{
|
||||
public const string PersonalCardSubProduct = "Credit Card";
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Core;
|
||||
|
||||
public class CoreResponse<T>
|
||||
{
|
||||
public List<T> Result {get; set;}
|
||||
public int Id {get; set;}
|
||||
public string Exception {get; set;}
|
||||
public string Status {get; set;}
|
||||
public bool IsCanceled {get; set;}
|
||||
public bool IsCompleted {get; set;}
|
||||
public bool IsCompletedSuccessfully {get; set;}
|
||||
public string CreationOptions {get; set;}
|
||||
public string AsyncState {get; set;}
|
||||
public bool IsFaulted {get; set;}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.DataTransfer;
|
||||
|
||||
public class ActivityTransferApprovalRequest
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public ActivityTransferState ApprovalState { get; set; }
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.DataTransfer;
|
||||
|
||||
public class ActivityTransferRequest
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public ActivityState ActivityStateBeforeTransfer { get; set; }
|
||||
public int RequestedActivityId { get; set; }
|
||||
public int NewDepartmentId { get; set; }
|
||||
public string NewEmployeeId { get; set; }
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.DataTransfer;
|
||||
|
||||
public class AdditionalPermissionRequest
|
||||
{
|
||||
public List<string> AddPermCodes { get; set; }
|
||||
public List<string> RemovePermCodes { get; set; }
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.DataTransfer;
|
||||
|
||||
public class DepartmentAssignmentRequest
|
||||
{
|
||||
[Required]
|
||||
public int[] DepartmentId { get; set; }
|
||||
[Required]
|
||||
public DateTime StartDate { get; set; }
|
||||
public DateTime? EndDate { get; set; }
|
||||
[StringLength(255)]
|
||||
public string? Note { get; set; }
|
||||
|
||||
[Required]
|
||||
[Range(0,100)]
|
||||
public decimal SlidingPayout { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Role { get; set; }
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.DataTransfer;
|
||||
|
||||
public class ExtrapolateGoalDispersalRequest
|
||||
{
|
||||
[Range(1,12)]
|
||||
public int Month { get; set; }
|
||||
public int Year { get; set; }
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.DataTransfer;
|
||||
|
||||
public class RoleMappingUpdateRequest
|
||||
{
|
||||
[Required]
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string ApplicationRole { get; set; }
|
||||
[Required]
|
||||
public string BusinessRole { get; set; }
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.DataTransfer;
|
||||
|
||||
public class UserAssignmentRequest
|
||||
{
|
||||
[Required]
|
||||
public string EmployeeId { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public AssignmentType? Type { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Key { get; set; }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.DataTransfer;
|
||||
|
||||
public class UserNameSearchRequest
|
||||
{
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string MiddleInit { get; set; }
|
||||
public string DnaOrgNbr { get; set; }
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Results;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Dayforce;
|
||||
|
||||
public class ActiveEmployeeReceipt
|
||||
{
|
||||
public ActiveEmployeeReceipt(IDictionary<string,string> reportRow)
|
||||
{
|
||||
ReportRow = reportRow;
|
||||
Status = ActiveEmployeeReceiptStatus.NOT_PROCESSED;
|
||||
}
|
||||
|
||||
public AppUser AppUser { get; set; }
|
||||
public IDictionary<string,string> ReportRow { get; }
|
||||
public ActiveEmployeeResult EmployeeRow { get; set; }
|
||||
public ActiveEmployeeReceiptStatus Status { get; set; }
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Dayforce;
|
||||
|
||||
public enum ActiveEmployeeReceiptStatus
|
||||
{
|
||||
NOT_PROCESSED,
|
||||
SUCCESS,
|
||||
MISSING_ROLE,
|
||||
MISSING_DATA,
|
||||
EXCEPTION
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Dayforce;
|
||||
|
||||
public class EmployeeDetailsUpdate
|
||||
{
|
||||
public string OldEmail { get; set; }
|
||||
public string OldEmployeeId { get; set; }
|
||||
public string OldFullName { get; set; }
|
||||
public string NewEmail { get; set; }
|
||||
public string NewEmployeeId { get; set; }
|
||||
public string NewFullName { get; set; }
|
||||
|
||||
public bool NewDetailsMatchOld()
|
||||
{
|
||||
return OldEmail.Equals(NewEmail, StringComparison.InvariantCultureIgnoreCase)
|
||||
&& OldEmployeeId.Equals(NewEmployeeId, StringComparison.InvariantCultureIgnoreCase)
|
||||
&& OldFullName.Equals(NewFullName, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
public string InvalidUpdateData()
|
||||
{
|
||||
if (NewDetailsMatchOld())
|
||||
{
|
||||
return $"Invalid Update Data: Old Details Match Updated Details";
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(NewEmail))
|
||||
{
|
||||
return $"Invalid Update Data: NewEmail: {NewEmail}";
|
||||
}
|
||||
|
||||
if (!new EmailAddressAttribute().IsValid(NewEmail))
|
||||
{
|
||||
return $"Invalid Update Data: NewEmail Is Not A Valid Email: {NewEmail}";
|
||||
}
|
||||
|
||||
if (!NewEmail.Contains("@landmarkcu.com", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return $"Invalid Update Data: NewEmail Is Not A Valid Internal Email: {NewEmail}";
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(NewEmployeeId))
|
||||
{
|
||||
return $"Invalid Update Data: NewEmployeeId: {NewEmployeeId}";
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(NewFullName))
|
||||
{
|
||||
return $"Invalid Update Data: NewFullName: {NewFullName}";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Dayforce;
|
||||
|
||||
public class EmployeeDetailsUpdateResult
|
||||
{
|
||||
public AppUser AppUser { get; set; }
|
||||
public string UpdateMessage { get; set; }
|
||||
public bool UpdatedSuccessfully { get; set; }
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Dayforce;
|
||||
|
||||
[DataContract]
|
||||
public class Paging
|
||||
{
|
||||
[DataMember(Name = "Next", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "Next")]
|
||||
public string Next { get; set; }
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Paging {\n");
|
||||
sb.Append(" Next: ").Append(Next).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
public string ToJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Dayforce;
|
||||
|
||||
public class Payload
|
||||
{
|
||||
public string RequestId { get; set; }
|
||||
public List<ProcessResult> ProcessResults { get; set; }
|
||||
}
|
||||
|
||||
public class Payload<T> : Payload
|
||||
{
|
||||
public T Data { get; set; }
|
||||
public Paging Paging { get; set; }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Dayforce;
|
||||
|
||||
public class PayoutEntry
|
||||
{
|
||||
public string Code { get; set; }
|
||||
public string EmployeeName { get; set; }
|
||||
public string EmployeeId { get; set; }
|
||||
public decimal PayoutTotal { get; set; }
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Dayforce;
|
||||
|
||||
[DataContract]
|
||||
public class ProcessResult
|
||||
{
|
||||
[DataMember(Name = "Code", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "Code")]
|
||||
public string Code { get; set; }
|
||||
|
||||
[DataMember(Name = "Context", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "Context")]
|
||||
public string Context { get; set; }
|
||||
|
||||
[DataMember(Name = "Level", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "Level")]
|
||||
public string Level { get; set; }
|
||||
|
||||
[DataMember(Name = "Message", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "Message")]
|
||||
public string Message { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class ProcessResult {\n");
|
||||
sb.Append(" Code: ").Append(Code).Append("\n");
|
||||
sb.Append(" Context: ").Append(Context).Append("\n");
|
||||
sb.Append(" Level: ").Append(Level).Append("\n");
|
||||
sb.Append(" Message: ").Append(Message).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public string ToJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Dayforce;
|
||||
|
||||
[DataContract]
|
||||
public class Report
|
||||
{
|
||||
|
||||
[DataMember(Name = "XRefCode", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "XRefCode")]
|
||||
public string XRefCode { get; set; }
|
||||
|
||||
[DataMember(Name = "Rows", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "Rows")]
|
||||
public List<Dictionary<String, string>> Rows { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Report {\n");
|
||||
sb.Append(" XRefCode: ").Append(XRefCode).Append("\n");
|
||||
sb.Append(" Rows: ").Append(Rows).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public string ToJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Dayforce;
|
||||
|
||||
public class TerminatedEmployeeReceipt
|
||||
{
|
||||
public TerminatedEmployeeReceipt(AppUser terminated, PayoutEntry lastMonthPayout, PayoutEntry thisMonthPayout, AppUser manager)
|
||||
{
|
||||
Terminated = terminated;
|
||||
LastMonthPayout = lastMonthPayout;
|
||||
ThisMonthPayout = thisMonthPayout;
|
||||
Manager = manager;
|
||||
}
|
||||
|
||||
public AppUser Terminated { get; }
|
||||
public AppUser Manager { get; }
|
||||
public PayoutEntry LastMonthPayout { get; }
|
||||
public PayoutEntry ThisMonthPayout { get; }
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Dayforce;
|
||||
|
||||
public class TerminatedEmployeeResult
|
||||
{
|
||||
public TerminatedEmployeeResult(IReadOnlyDictionary<string, string> row)
|
||||
{
|
||||
DisplayName = row["Employee_DisplayName"];
|
||||
EmployeeNumber = row["EmployeeEmploymentStatus_EmployeeNumber"];
|
||||
LoginName = row["IdLibrary_LoginName"];
|
||||
|
||||
if (row.ContainsKey("EmployeeManager_ManagerEmployeeNumber"))
|
||||
{
|
||||
ManagerKey = row["EmployeeManager_ManagerEmployeeNumber"];
|
||||
}
|
||||
|
||||
var termDate = row["Employee_TerminationDate"];
|
||||
TerminationDate = string.IsNullOrWhiteSpace(termDate) ? DateTime.Now : DateTime.Parse(termDate);
|
||||
}
|
||||
|
||||
public string DisplayName { get; }
|
||||
public string EmployeeNumber { get; }
|
||||
public string LoginName { get; }
|
||||
public string ManagerKey { get; }
|
||||
public DateTime TerminationDate { get; }
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class DepartmentDetails
|
||||
{
|
||||
public Department Department { get; set; }
|
||||
public IReadOnlyCollection<UserDepartment> Assignments { get; set; }
|
||||
public AppUser RegionalManager { get; set; }
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class DepartmentGoals
|
||||
{
|
||||
public DepartmentGoals(int departmentId, int year)
|
||||
{
|
||||
DepartmentId = departmentId;
|
||||
Year = year;
|
||||
|
||||
MonthlyGoals = new PerProductGoal[12];
|
||||
for (var month = 0; month < 12; month++)
|
||||
{
|
||||
MonthlyGoals[month] = new PerProductGoal();
|
||||
}
|
||||
}
|
||||
|
||||
public int DepartmentId { get; }
|
||||
public int Year { get; }
|
||||
public PerProductGoal[] MonthlyGoals { get; }
|
||||
|
||||
public void ApplyAll(ICollection<Goal> findDepartmentGoals)
|
||||
{
|
||||
foreach (var goal in findDepartmentGoals)
|
||||
{
|
||||
MonthlyGoals[goal.StartDate.Month-1].ProductGoals[goal.Product] = goal.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Common;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class DepartmentGoalsForRange
|
||||
{
|
||||
public DepartmentGoalsForRange(int departmentId, MonthRange monthRange)
|
||||
{
|
||||
DepartmentId = departmentId;
|
||||
MonthRange = monthRange;
|
||||
Goals = new PerProductGoal();
|
||||
GoalAudit = new List<Goal>();
|
||||
}
|
||||
|
||||
public int DepartmentId { get; set; }
|
||||
public MonthRange MonthRange { get; set; }
|
||||
public PerProductGoal Goals { get; }
|
||||
public IEnumerable<Goal> GoalAudit { get; set; }
|
||||
|
||||
public void ApplyAll(ICollection<Goal> goals)
|
||||
{
|
||||
GoalAudit = GoalAudit.Concat(goals);
|
||||
foreach (var goal in goals)
|
||||
{
|
||||
Goals.ProductGoals[goal.Product] += goal.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Common;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class DepartmentProgress : IViewTransformable<DepartmentProgress>
|
||||
{
|
||||
private IReadOnlyCollection<IPayoutRule> DepartmentRules { get; }
|
||||
private IReadOnlyCollection<IPayoutRule> PersonalRules { get; }
|
||||
|
||||
public DepartmentProgress(int departmentId, MonthRange monthRange)
|
||||
{
|
||||
DepartmentId = departmentId;
|
||||
MonthRange = monthRange;
|
||||
DepartmentRules = new List<IPayoutRule>();
|
||||
PersonalRules = new List<IPayoutRule>();
|
||||
Progress = new PerProductActivity();
|
||||
ActivityAudit = new List<Activity>();
|
||||
GoalAudit = new List<Goal>();
|
||||
Goals = new PerProductGoal();
|
||||
EmployeeProgress = new Dictionary<string, PerProductActivity>();
|
||||
EmployeeGoals = new Dictionary<string, PerProductGoal>();
|
||||
}
|
||||
|
||||
public DepartmentProgress(
|
||||
int deptDepartmentId,
|
||||
MonthRange monthRangeOfAssignment,
|
||||
List<string> employeeList,
|
||||
IReadOnlyCollection<IPayoutRule> departmentRules,
|
||||
IReadOnlyCollection<IPayoutRule> personalRules
|
||||
) : this(deptDepartmentId, monthRangeOfAssignment)
|
||||
{
|
||||
EmployeeList = employeeList;
|
||||
DepartmentRules = departmentRules;
|
||||
PersonalRules = personalRules;
|
||||
foreach (var employeeId in employeeList)
|
||||
{
|
||||
EmployeeGoals[employeeId] = new PerProductGoal();
|
||||
EmployeeProgress[employeeId] = new PerProductActivity();
|
||||
}
|
||||
}
|
||||
|
||||
public int DepartmentId { get; set; }
|
||||
public MonthRange MonthRange { get; }
|
||||
public PerProductActivity Progress { get; }
|
||||
public PerProductGoal Goals { get; }
|
||||
public IEnumerable<Activity> ActivityAudit { get; set; }
|
||||
public IEnumerable<Goal> GoalAudit { get; set; }
|
||||
public IReadOnlyCollection<string> EmployeeList { get; }
|
||||
public IDictionary<string, PerProductActivity> EmployeeProgress { get; }
|
||||
public IDictionary<string, PerProductGoal> EmployeeGoals { get; }
|
||||
public int GapInsuranceEligibleActivityCount { get; private set; }
|
||||
|
||||
public void ApplyActivity(ICollection<Activity> activities)
|
||||
{
|
||||
ActivityAudit = ActivityAudit.Concat(activities);
|
||||
|
||||
foreach (var product in ProductDetail.ProductDetails.Select(productDetail => productDetail.Product))
|
||||
{
|
||||
foreach (var activity in activities)
|
||||
{
|
||||
var employeeId = activity.EmployeeId;
|
||||
|
||||
if (product == Product.Vehicle && activity.Product == Product.Vehicle)
|
||||
{
|
||||
GapInsuranceEligibleActivityCount += activity.CalculatedValueTowardsGapInsurance();
|
||||
if (!EmployeeGoals.ContainsKey(employeeId))
|
||||
{
|
||||
EmployeeGoals[activity.EmployeeId] = new PerProductGoal();
|
||||
};
|
||||
EmployeeGoals[activity.EmployeeId].ProductGoals[Product.GAPInsurance] += activity.CalculatedValueTowardsGapInsurance();
|
||||
};
|
||||
|
||||
if (!EmployeeProgress.ContainsKey(employeeId))
|
||||
{
|
||||
EmployeeProgress[employeeId] = new PerProductActivity();
|
||||
}
|
||||
|
||||
var calculatedValueTowardsOther = activity.CalculatedValueTowardsOther(product);
|
||||
EmployeeProgress[employeeId].ProductOther[product] += calculatedValueTowardsOther;
|
||||
Progress.ProductOther[product] += calculatedValueTowardsOther;
|
||||
var isEmployeeRestrictedByPayoutRule = PersonalRules.Any(payoutRule => payoutRule.RestrictedByPayoutRule(activity, product));
|
||||
var isDepartmentRestrictedByPayoutRule = DepartmentRules.Any(payoutRule => payoutRule.RestrictedByPayoutRule(activity, product));
|
||||
|
||||
if (isEmployeeRestrictedByPayoutRule && isDepartmentRestrictedByPayoutRule)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var calculatedValueTowardsGoal = activity.CalculatedValueTowardsGoal(product);
|
||||
|
||||
if (!isEmployeeRestrictedByPayoutRule)
|
||||
{
|
||||
EmployeeProgress[employeeId].ProductActivity[product] += calculatedValueTowardsGoal;
|
||||
}
|
||||
|
||||
if (!isDepartmentRestrictedByPayoutRule)
|
||||
{
|
||||
Progress.ProductActivity[product] += calculatedValueTowardsGoal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyGoals(ICollection<Goal> goals)
|
||||
{
|
||||
GoalAudit = GoalAudit.Concat(goals);
|
||||
|
||||
foreach (var goal in goals)
|
||||
{
|
||||
var product = goal.Product;
|
||||
var employeeId = goal.EmployeeId;
|
||||
var value = goal.Value;
|
||||
|
||||
if (employeeId is null)
|
||||
{
|
||||
Goals.ProductGoals[product] += value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!EmployeeGoals.ContainsKey(employeeId))
|
||||
{
|
||||
EmployeeGoals[employeeId] = new PerProductGoal();
|
||||
}
|
||||
|
||||
EmployeeGoals[employeeId].ProductGoals[product] += value;
|
||||
}
|
||||
|
||||
if (GapInsuranceEligibleActivityCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var gapInsurance = Product.GAPInsurance;
|
||||
|
||||
if (!Goals.ProductGoals.ContainsKey(gapInsurance))
|
||||
{
|
||||
Goals.ProductGoals.Add(gapInsurance, GapInsuranceEligibleActivityCount);
|
||||
return;
|
||||
}
|
||||
|
||||
Goals.ProductGoals[gapInsurance] = GapInsuranceEligibleActivityCount;
|
||||
}
|
||||
|
||||
public DepartmentProgress TransformForView()
|
||||
{
|
||||
foreach (var activity in ActivityAudit)
|
||||
{
|
||||
activity?.TransformForView();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Common;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class EmployeeGoals
|
||||
{
|
||||
public EmployeeGoals(AppUser employee, MonthRange monthRange)
|
||||
{
|
||||
Employee = employee;
|
||||
MonthRange = monthRange;
|
||||
Goals = new Dictionary<int, PerProductGoal>();
|
||||
Departments = employee.Departments.Where(dept => dept.StartDate.Date < monthRange.EndTime.Date &&
|
||||
(dept.EndDate == null || monthRange.StartTime.Date < dept.EndDate.Value.Date)).ToList();
|
||||
foreach (var department in Departments)
|
||||
{
|
||||
Goals[department.DepartmentId] = new PerProductGoal();
|
||||
}
|
||||
|
||||
GoalAudit = new List<Goal>();
|
||||
}
|
||||
|
||||
public AppUser Employee { get; }
|
||||
public MonthRange MonthRange { get; }
|
||||
public ICollection<UserDepartment> Departments { get; }
|
||||
public IDictionary<int, PerProductGoal> Goals { get; }
|
||||
public IEnumerable<Goal> GoalAudit { get; set; }
|
||||
|
||||
public void ApplyAll(ICollection<Goal> goals)
|
||||
{
|
||||
GoalAudit = GoalAudit.Concat(goals);
|
||||
foreach (var goal in goals)
|
||||
{
|
||||
if (Goals.Keys.Contains(goal.DepartmentId))
|
||||
{
|
||||
Goals[goal.DepartmentId].ProductGoals[goal.Product] += goal.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Common;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class EmployeeProgress : IViewTransformable<EmployeeProgress>
|
||||
{
|
||||
public EmployeeProgress(AppUser employee, MonthRange monthRange, IReadOnlyCollection<IPayoutRule> personalRules)
|
||||
{
|
||||
Employee = employee;
|
||||
MonthRange = monthRange;
|
||||
PersonalRules = personalRules;
|
||||
Progress = new Dictionary<int, PerProductActivity>();
|
||||
Goals = new Dictionary<int, PerProductGoal>();
|
||||
Departments = employee.Departments.Where(dept => dept.StartDate.Date < monthRange.EndTime.Date &&
|
||||
(dept.EndDate == null || monthRange.StartTime.Date <
|
||||
dept.EndDate.Value.Date)).ToList();
|
||||
foreach (var department in Departments)
|
||||
{
|
||||
Progress[department.DepartmentId] = new PerProductActivity();
|
||||
Goals[department.DepartmentId] = new PerProductGoal();
|
||||
}
|
||||
|
||||
ActivityAudit = new List<Activity>();
|
||||
GoalAudit = new List<Goal>();
|
||||
}
|
||||
|
||||
public AppUser Employee { get; }
|
||||
public MonthRange MonthRange { get; }
|
||||
public ICollection<UserDepartment> Departments { get; }
|
||||
public IDictionary<int, PerProductActivity> Progress { get; }
|
||||
public IDictionary<int, PerProductGoal> Goals { get; }
|
||||
public IEnumerable<Activity> ActivityAudit { get; set; }
|
||||
public IEnumerable<Goal> GoalAudit { get; set; }
|
||||
private IReadOnlyCollection<IPayoutRule> PersonalRules { get; }
|
||||
|
||||
public void ApplyAll(ICollection<Activity> activities)
|
||||
{
|
||||
ActivityAudit = ActivityAudit.Concat(activities);
|
||||
foreach (var product in ProductDetail.ProductDetails)
|
||||
{
|
||||
foreach (var activity in activities)
|
||||
{
|
||||
if (Progress.Keys.Contains(activity.DepartmentId) == false)
|
||||
{
|
||||
Progress[activity.DepartmentId] = new PerProductActivity();
|
||||
}
|
||||
|
||||
if (!PersonalRules.Any(x => x.RestrictedByPayoutRule(activity, product.Product)))
|
||||
{
|
||||
Progress[activity.DepartmentId].ProductActivity[product.Product] +=
|
||||
activity.CalculatedValueTowardsGoal(product.Product);
|
||||
}
|
||||
|
||||
Progress[activity.DepartmentId].ProductOther[product.Product] +=
|
||||
activity.CalculatedValueTowardsOther(product.Product);
|
||||
|
||||
if (product.Product == Product.Vehicle && activity.Product == Product.Vehicle)
|
||||
{
|
||||
if (!Goals.ContainsKey(activity.DepartmentId))
|
||||
{
|
||||
Goals[activity.DepartmentId] = new PerProductGoal();
|
||||
}
|
||||
|
||||
Goals[activity.DepartmentId].ProductGoals[Product.GAPInsurance] += activity.CalculatedValueTowardsGapInsurance();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyGoals(ICollection<Goal> findDepartmentGoals)
|
||||
{
|
||||
GoalAudit = GoalAudit.Concat(findDepartmentGoals);
|
||||
foreach (var goal in findDepartmentGoals)
|
||||
{
|
||||
if (Goals.Keys.Contains(goal.DepartmentId) == false)
|
||||
{
|
||||
Goals[goal.DepartmentId] = new PerProductGoal();
|
||||
}
|
||||
|
||||
Goals[goal.DepartmentId].ProductGoals[goal.Product] += goal.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public EmployeeProgress TransformForView()
|
||||
{
|
||||
foreach (var activity in ActivityAudit)
|
||||
{
|
||||
activity?.TransformForView();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.ExternalActivities;
|
||||
|
||||
public interface IExternalActivity
|
||||
{
|
||||
public ActivityType GetActivityType();
|
||||
public Product GetProductType();
|
||||
public string GetSourceId();
|
||||
public SystemType GetSystemType();
|
||||
public Activity MapToActivity();
|
||||
}
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using LCU.API.Internal.Operations.IncentiveApiLib.Services;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.ExternalActivities;
|
||||
|
||||
public class NewActivityManagerReferral : IExternalActivity
|
||||
{
|
||||
public long ActivityId { get; set; }
|
||||
public string OriginatorUserId { get; set; }
|
||||
public long OriginatorPersNbr { get; set; }
|
||||
public string OriginatorFirstName { get; set; }
|
||||
public string OriginatorLastName { get; set; }
|
||||
public string OriginatorMiddleInitial { get; set; }
|
||||
public long? LandmarkCreditCardNumber { get; set; }
|
||||
public long? DirectDepositAccountNumber { get; set; }
|
||||
public string EmployeeEmail { get; set; }
|
||||
public DateTime LastUpdatedDateTime { get; set; }
|
||||
public string Campaign { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string ReferralStation { get; set; }
|
||||
public int IsInitialStation { get; set; }
|
||||
public int IsFinalStation { get; set; }
|
||||
public DateTime OriginationDateTime { get; set; }
|
||||
public DateTime StationDateTime { get; set; }
|
||||
public string OriginatingBranchName { get; set; }
|
||||
public string ReferredPersonNbr { get; set; }
|
||||
public string ReferredOrgNbr { get; set; }
|
||||
public string ReferredPersOrgNbr { get; set; }
|
||||
public string ReferredPersonName { get; set; }
|
||||
public string ReferredOrgName { get; set; }
|
||||
public string PreferredPhone { get; set; }
|
||||
public string Comm1 { get; set; }
|
||||
public string Comm2 { get; set; }
|
||||
public string Comm3 { get; set; }
|
||||
public string Comm4 { get; set; }
|
||||
public string Comm5 { get; set; }
|
||||
public string Comm6 { get; set; }
|
||||
public string Comm7 { get; set; }
|
||||
|
||||
private static readonly TimeZoneInfo AssumedSourceTimezone = TimeZoneConverter.TZConvert.GetTimeZoneInfo("America/Chicago");
|
||||
private readonly int IsInFinalStation = 1;
|
||||
|
||||
public Activity MapToActivity()
|
||||
{
|
||||
return new Activity()
|
||||
{
|
||||
SourceId = GetSourceId(),
|
||||
Product = GetProductType(),
|
||||
Accepted = GetActivityDate(),
|
||||
Type = ActivityType.Referral,
|
||||
SourceSystem = GetSystemType(),
|
||||
SourceCreated = TimeZoneInfo.ConvertTime(OriginationDateTime, AssumedSourceTimezone, TimeZoneInfo.Utc),
|
||||
Detail = new ActivityDetail()
|
||||
{
|
||||
MemberName = ReferredOrgName ?? ReferredPersonName,
|
||||
DnaPersonNbr = OriginatorPersNbr.ToString(),
|
||||
SubjectPersonNbr = ReferredPersonNbr,
|
||||
SubjectOrgNbr = ReferredOrgNbr,
|
||||
StationName = ReferralStation,
|
||||
BranchOrgName = OriginatingBranchName,
|
||||
AccountNumber = GetAccountNumber()
|
||||
},
|
||||
MetaData = DataParsingService.MapActivityMetaData(new List<string> { PreferredPhone, Comm1, Comm2, Comm3, Comm4, Comm5, Comm6, Comm7 }),
|
||||
DepartmentId = -1,
|
||||
EmployeeId = null,
|
||||
State = ActivityState.Created,
|
||||
EmployeeEmail = EmployeeEmail
|
||||
};
|
||||
}
|
||||
|
||||
private DateTime GetActivityDate()
|
||||
{
|
||||
var isLicReferral = Campaign.Equals("LIC Referral", StringComparison.InvariantCultureIgnoreCase);
|
||||
if (IsFinalStation == IsInFinalStation && isLicReferral)
|
||||
{
|
||||
return StationDateTime = StationDateTime.Date.AddHours(12);
|
||||
}
|
||||
|
||||
return DateTime.UtcNow.Date.AddHours(12);
|
||||
}
|
||||
|
||||
public ActivityType GetActivityType()
|
||||
{
|
||||
return ActivityType.Referral;
|
||||
}
|
||||
|
||||
public string GetSourceId()
|
||||
{
|
||||
return ActivityId.ToString();
|
||||
}
|
||||
|
||||
public Product GetProductType()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(Campaign))
|
||||
{
|
||||
if (Campaign.Equals("ATM Card", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return Product.ATMCard;
|
||||
}
|
||||
|
||||
if (Campaign.Equals("Check Card Referral", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return Product.CheckCard;
|
||||
}
|
||||
|
||||
if (Campaign.Equals("Checking Referral", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return Product.NewChecking;
|
||||
}
|
||||
|
||||
if (Campaign.Equals("Mortgage Referral", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return Product.Mortgage;
|
||||
}
|
||||
|
||||
if (Campaign.Equals("Direct Deposit", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return Product.DirectDeposit;
|
||||
}
|
||||
|
||||
if (Campaign.Equals("CC Balance Transfer", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return Product.CreditCardBalanceTransfer;
|
||||
}
|
||||
|
||||
if (Campaign.Equals("LIC Referral", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return Product.LIC;
|
||||
}
|
||||
|
||||
if (Campaign.Equals("First Mortgage Referral", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return Product.FirstMortgageReferral;
|
||||
}
|
||||
|
||||
if (Campaign.Equals("eStatement Referral", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return Product.eStatement;
|
||||
}
|
||||
}
|
||||
|
||||
Log.Error($"Could not parse product type: {Campaign}for an incoming referral with id:{ActivityId} originating from person :{OriginatorPersNbr}");
|
||||
throw new Exception("Could not parse product type for incoming referral. See logs.");
|
||||
}
|
||||
|
||||
private string GetAccountNumber()
|
||||
{
|
||||
var accountNumber = (DirectDepositAccountNumber ?? LandmarkCreditCardNumber);
|
||||
return accountNumber != null ? accountNumber.ToString() : null;
|
||||
}
|
||||
|
||||
public SystemType GetSystemType()
|
||||
{
|
||||
return SystemType.ActivityManager;
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using LCU.API.Internal.Operations.IncentiveApiLib.Services;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.ExternalActivities;
|
||||
|
||||
public class NewAtmCheckCardActivity : IExternalActivity
|
||||
{
|
||||
public long ActivityNbr { get; set; }
|
||||
public DateTime ActivityDateTime { get; set; }
|
||||
public long ResponsiblePersonNbr { get; set; }
|
||||
public string ActivityTypeCde { get; set; }
|
||||
public long AgreementNbr { get; set; }
|
||||
public string CardState { get; set; }
|
||||
public string CardType { get; set; }
|
||||
public long AccountNbr { get; set; }
|
||||
public string OwnerPersonNbr { get; set; }
|
||||
public string OwnerOrgNbr { get; set; }
|
||||
public string AcctStateAtActivity { get; set; }
|
||||
public string AcctStatAtQueryTime { get; set; }
|
||||
public DateTime AcctStateEffDateTime { get; set; }
|
||||
public string AssociateFirst { get; set; }
|
||||
public string AssociateMiddleInit { get; set; }
|
||||
public string AssociateLast { get; set; }
|
||||
public string EmployeeEmail { get; set; }
|
||||
public string TaxOrgName { get; set; }
|
||||
public string TaxPersonName { get; set; }
|
||||
public string TaxPersonPhoneNumbers { get; set; }
|
||||
public string TaxPersonEmailAddresses { get; set; }
|
||||
|
||||
static readonly TimeZoneInfo AssumedSourceTimezone = TimeZoneConverter.TZConvert.GetTimeZoneInfo("America/Chicago");
|
||||
|
||||
public Activity MapToActivity()
|
||||
{
|
||||
return new Activity()
|
||||
{
|
||||
Product = GetProductType(),
|
||||
Type = GetActivityType(),
|
||||
SourceSystem = GetSystemType(),
|
||||
SourceId = ActivityNbr.ToString(),
|
||||
SourceCreated = TimeZoneInfo.ConvertTime(ActivityDateTime, AssumedSourceTimezone, TimeZoneInfo.Utc),
|
||||
Detail = new ActivityDetail()
|
||||
{
|
||||
MemberName = TaxOrgName ?? TaxPersonName,
|
||||
DnaPersonNbr = ResponsiblePersonNbr.ToString(),
|
||||
SubjectPersonNbr = OwnerPersonNbr,
|
||||
SubjectOrgNbr = OwnerOrgNbr,
|
||||
AccountNumber = AccountNbr.ToString(),
|
||||
AccountStatus = AcctStatAtQueryTime,
|
||||
AgreementNumber = AgreementNbr.ToString()
|
||||
},
|
||||
MetaData = DataParsingService.MapActivityMetaData(new List<string> { TaxPersonPhoneNumbers, TaxPersonEmailAddresses }),
|
||||
DepartmentId = -1,
|
||||
EmployeeId = null,
|
||||
EmployeeEmail = EmployeeEmail,
|
||||
Accepted = ActivityDateTime.Date.AddHours(12),
|
||||
State = ActivityState.Created
|
||||
};
|
||||
}
|
||||
|
||||
public ActivityType GetActivityType()
|
||||
{
|
||||
return ActivityType.Other;
|
||||
}
|
||||
|
||||
public Product GetProductType()
|
||||
{
|
||||
return CardType.Equals("ATM", StringComparison.InvariantCultureIgnoreCase) ? Product.ATMCard : Product.CheckCard;
|
||||
}
|
||||
|
||||
public string GetSourceId()
|
||||
{
|
||||
return ActivityNbr.ToString();
|
||||
}
|
||||
|
||||
public List<ActivityMetaData> MapActivityMetaData()
|
||||
{
|
||||
var parsedMetaData = new List<ActivityMetaData>();
|
||||
if (!string.IsNullOrWhiteSpace(TaxPersonEmailAddresses))
|
||||
{
|
||||
foreach (var item in TaxPersonEmailAddresses.Split(",", StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
parsedMetaData.Add(DataParsingService.DetermineActivityMetaData(item));
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(TaxPersonPhoneNumbers))
|
||||
{
|
||||
foreach (var item in TaxPersonPhoneNumbers.Split(",", StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
parsedMetaData.Add(DataParsingService.DetermineActivityMetaData(item));
|
||||
}
|
||||
}
|
||||
|
||||
return parsedMetaData;
|
||||
}
|
||||
|
||||
public SystemType GetSystemType()
|
||||
{
|
||||
return SystemType.Dna;
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using LCU.API.Internal.Operations.IncentiveApiLib.Services;
|
||||
using LCU.API.Internal.Operations.IncentiveApi.Models.Constants;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.ExternalActivities;
|
||||
|
||||
public class NewCheckingAccountActivity : IExternalActivity
|
||||
{
|
||||
public long ActivityNbr { get; set; }
|
||||
public DateTime ActivityDateTime { get; set; }
|
||||
public long ResponsiblePersonNbr { get; set; }
|
||||
public string ActivityTypeCode { get; set; }
|
||||
public long SubjectAccountNbr { get; set; }
|
||||
public string MinorAccountType { get; set; }
|
||||
public string AssociateFirst { get; set; }
|
||||
public string AssociateMiddleInit { get; set; }
|
||||
public string AssociateLast { get; set; }
|
||||
public string TaxPersonNbr { get; set; }
|
||||
public string TaxOrgNbr { get; set; }
|
||||
public string CurrentAccountStatus { get; set; }
|
||||
public long BranchOrgNbr { get; set; }
|
||||
public string BranchOrgName { get; set; }
|
||||
public string EmployeeEmail { get; set; }
|
||||
public DateTime AccountContractDate { get; set; }
|
||||
public string TaxOrgName { get; set; }
|
||||
public string TaxPersonName { get; set; }
|
||||
public double? OriginalBalance { get; set; }
|
||||
public string TaxPersonPhoneNumbers { get; set; }
|
||||
public string TaxPersonEmailAddresses { get; set; }
|
||||
|
||||
public Activity MapToActivity()
|
||||
{
|
||||
return new Activity()
|
||||
{
|
||||
Product = GetProductType(),
|
||||
Type = ActivityType.Sale,
|
||||
SourceSystem = GetSystemType(),
|
||||
SourceId = GetSourceId(),
|
||||
SourceCreated = AccountContractDate,
|
||||
Detail = new ActivityDetail()
|
||||
{
|
||||
MemberName = TaxOrgName ?? TaxPersonName,
|
||||
DnaPersonNbr = ResponsiblePersonNbr.ToString(),
|
||||
BranchOrgNbr = BranchOrgNbr.ToString(),
|
||||
BranchOrgName = BranchOrgName,
|
||||
SubjectPersonNbr = TaxPersonNbr,
|
||||
SubjectOrgNbr = TaxOrgNbr,
|
||||
AccountNumber = SubjectAccountNbr.ToString(),
|
||||
AccountStatus = CurrentAccountStatus,
|
||||
AccountBalance = OriginalBalance
|
||||
},
|
||||
MetaData = DataParsingService.MapActivityMetaData(new List<string> { TaxPersonPhoneNumbers, TaxPersonEmailAddresses }),
|
||||
DepartmentId = -1,
|
||||
EmployeeId = null,
|
||||
EmployeeEmail = StandardizedEmail(),
|
||||
Accepted = ActivityDateTime.Date.AddHours(12),
|
||||
State = ActivityState.Created
|
||||
};
|
||||
}
|
||||
|
||||
public ActivityType GetActivityType()
|
||||
{
|
||||
return ActivityType.Sale;
|
||||
}
|
||||
|
||||
public string GetSourceId()
|
||||
{
|
||||
return ActivityNbr.ToString();
|
||||
}
|
||||
|
||||
public Product GetProductType()
|
||||
{
|
||||
return Product.NewChecking;
|
||||
}
|
||||
|
||||
public SystemType GetSystemType()
|
||||
{
|
||||
if (
|
||||
!string.IsNullOrWhiteSpace(EmployeeEmail)
|
||||
&& string.Equals(EmployeeEmail, SystemAppUserConstants.DigitalBankingEmail, StringComparison.CurrentCultureIgnoreCase)
|
||||
)
|
||||
{
|
||||
return SystemType.DigitalBanking;
|
||||
}
|
||||
|
||||
return SystemType.Dna;
|
||||
}
|
||||
|
||||
public string StandardizedEmail()
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(EmployeeEmail) ? EmployeeEmail.ToUpper() : EmployeeEmail;
|
||||
}
|
||||
}
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using LCU.API.Internal.Operations.IncentiveApiLib.Services;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.ExternalActivities;
|
||||
|
||||
public class NewLoanSaleActivity : IExternalActivity
|
||||
{
|
||||
public long ActivityNbr { get; set; }
|
||||
public DateTime ActivityDateTime { get; set; }
|
||||
public long SubjectAccountNbr { get; set; }
|
||||
public long OriginatingPersonNbr { get; set; }
|
||||
public string ActivityTypeCode { get; set; }
|
||||
public string MajorAccountType { get; set; }
|
||||
public string MinorAccountType { get; set; }
|
||||
public string AssociateFirst { get; set; }
|
||||
public string AssociateMiddleInit { get; set; }
|
||||
public string AssociateLast { get; set; }
|
||||
public string TaxPersonNbr { get; set; }
|
||||
public string TaxOrgNbr { get; set; }
|
||||
public string TaxOrgName { get; set; }
|
||||
public string TaxPersonName { get; set; }
|
||||
public DateTime AccountContractDate { get; set; }
|
||||
public string CurrentAccountStatus { get; set; }
|
||||
public long BranchOrgNbr { get; set; }
|
||||
public string BranchOrgName { get; set; }
|
||||
public string EmployeeEmail { get; set; }
|
||||
public string LoanSourceCode { get; set; }
|
||||
public decimal? LoanAmount { get; set; }
|
||||
public DateTime? DebtProtectionEffectiveDate { get; set; }
|
||||
public DateTime? DebtProtectionInactiveDate { get; set; }
|
||||
public string DebtProtectionCategory { get; set; }
|
||||
public DateTime? YoungestBirthdateOnLoan { get; set; }
|
||||
public int HasOrgRoles { get; set; }
|
||||
public string TaxPersonPhoneNumbers { get; set; }
|
||||
public string TaxPersonEmailAddresses { get; set; }
|
||||
|
||||
public bool IsGapInsuranceEligible()
|
||||
{
|
||||
var isEligible = false;
|
||||
if (!MinorAccountType.Equals("BE21", StringComparison.InvariantCultureIgnoreCase) && LoanAmount.HasValue && LoanAmount.Value <= 100000 && GetProductType() == Product.Vehicle)
|
||||
{
|
||||
isEligible = true;
|
||||
}
|
||||
Log.Information($"New Loan Sale ActivityNbr {ActivityNbr} - {GetProductType()} - {MinorAccountType} - {LoanAmount} GapEligible set: {isEligible} {DateTime.UtcNow} ");
|
||||
return isEligible;
|
||||
}
|
||||
|
||||
public DateTime? GapInsuranceEffectiveDate { get; set; }
|
||||
public DateTime? GapInsuranceInactiveDate { get; set; }
|
||||
|
||||
|
||||
static readonly List<string> DebtProtectionEligibleLoanTypes = new List<string>()
|
||||
{ "DV01", "DV02", "DV03", "DV04", "DV05", "DV06", "DV07", "DV08", "SC01", "SC02", "SG01" };
|
||||
|
||||
static readonly List<string> FirstMortgageEligibleLoanTypes = new List<string>()
|
||||
{ "FNMA", "FRML", "FRMH","MPFR","MJ30","HM01","HM02","MF10","HM03","HM04","DEF3","ML01","ML03",
|
||||
"MJ03","MJ05","MJ07","MF15","MF20","MF30","MC93","MA55","MS30","MS10","MS15","MS20","MS40","MC09",
|
||||
"ML02","MA01","MP05","MA05","MC01","MI05","MC03","MJ55","MC91","MF40","MS05","MS07","MI03","MA03",
|
||||
"MA07","MA27","ML23","ML21","MP25","MC21","MA21","MJ27","HM05","MA23","MA25","MI25","MJ23","MJ25" };
|
||||
|
||||
static readonly TimeZoneInfo AssumedSourceTimezone = TimeZoneConverter.TZConvert.GetTimeZoneInfo("America/Chicago");
|
||||
|
||||
public Product GetProductType()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(MinorAccountType))
|
||||
{
|
||||
Log.Error($"Null Loan Account Type: {MinorAccountType} for Activity with ActivityNbr: {ActivityNbr}");
|
||||
throw new Exception("Could Not Determine Loan Account Type");
|
||||
}
|
||||
|
||||
if (MinorAccountType.Equals("HE01", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
MinorAccountType.Equals("FE01", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
MinorAccountType.Equals("MF01", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
MinorAccountType.Equals("FE02", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
MinorAccountType.Equals("FLML", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return Product.Mortgage;
|
||||
}
|
||||
|
||||
if (MinorAccountType.Equals("SC01", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
MinorAccountType.Equals("SC02", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
MinorAccountType.Equals("SG01", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return Product.DebtProtectionEligibleLoan;
|
||||
}
|
||||
|
||||
if (IsFirstMortgageLoan(MinorAccountType))
|
||||
{
|
||||
return Product.FirstMortgageReferral;
|
||||
}
|
||||
|
||||
return Product.Vehicle;
|
||||
}
|
||||
|
||||
public bool IsFirstMortgageLoan(string minorAccountType)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(minorAccountType) && FirstMortgageEligibleLoanTypes.Contains(minorAccountType.ToUpperInvariant()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ActivityType GetActivityType()
|
||||
{
|
||||
return ActivityType.Sale;
|
||||
}
|
||||
|
||||
public Activity MapToActivity()
|
||||
{
|
||||
const int addHours = 12;
|
||||
|
||||
return new Activity()
|
||||
{
|
||||
Product = GetProductType(),
|
||||
Type = GetActivityType(),
|
||||
SourceSystem = GetSystemType(),
|
||||
SourceId = ActivityNbr.ToString(),
|
||||
SourceCreated = AccountContractDate,
|
||||
Detail = new ActivityDetail()
|
||||
{
|
||||
MemberName = TaxOrgName ?? TaxPersonName,
|
||||
DnaPersonNbr = OriginatingPersonNbr.ToString(),
|
||||
BranchOrgName = BranchOrgName,
|
||||
BranchOrgNbr = BranchOrgNbr.ToString(),
|
||||
SubjectPersonNbr = TaxPersonNbr,
|
||||
SubjectOrgNbr = TaxOrgNbr,
|
||||
AccountNumber = SubjectAccountNbr.ToString(),
|
||||
AccountStatus = CurrentAccountStatus,
|
||||
AccountBalance = (double?)LoanAmount,
|
||||
DebtProtectionAddDate = DebtProtectionEffectiveDate?.Date.AddHours(addHours),
|
||||
DebtProtectionRemoveDate = DebtProtectionInactiveDate?.Date.AddHours(addHours),
|
||||
IsDebtProtectionEligible = IsEligibleForDebtProtection(),
|
||||
IsGapInsuranceEligible = IsGapInsuranceEligible(),
|
||||
GapInsuranceAddDate = GapInsuranceEffectiveDate?.Date.AddHours(addHours),
|
||||
GapInsuranceRemoveDate = GapInsuranceInactiveDate?.Date.AddHours(addHours)
|
||||
},
|
||||
MetaData = DataParsingService.MapActivityMetaData(new List<string> { TaxPersonPhoneNumbers, TaxPersonEmailAddresses }),
|
||||
DepartmentId = -1,
|
||||
EmployeeId = null,
|
||||
EmployeeEmail = EmployeeEmail,
|
||||
Accepted = AccountContractDate.Date.AddHours(addHours),
|
||||
State = ActivityState.Created
|
||||
};
|
||||
}
|
||||
|
||||
public string GetSourceId()
|
||||
{
|
||||
return ActivityNbr.ToString();
|
||||
}
|
||||
|
||||
public bool IsEligibleForDebtProtection()
|
||||
{
|
||||
var age = AgeOfYoungestBorrower();
|
||||
if (age == null || !DebtProtectionEligibleLoanTypes.Contains(MinorAccountType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return age < 69 && HasOrgRoles == 0 && TaxOrgNbr == null;
|
||||
}
|
||||
|
||||
public int? AgeOfYoungestBorrower()
|
||||
{
|
||||
if (YoungestBirthdateOnLoan == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var now = TimeZoneInfo.ConvertTime(DateTime.UtcNow, AssumedSourceTimezone);
|
||||
var age = now.Year - YoungestBirthdateOnLoan.Value.Year;
|
||||
if (now.DayOfYear > YoungestBirthdateOnLoan.Value.DayOfYear)
|
||||
{
|
||||
age--;
|
||||
}
|
||||
|
||||
return age;
|
||||
}
|
||||
|
||||
public SystemType GetSystemType()
|
||||
{
|
||||
return SystemType.Dna;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.GoalDispersal;
|
||||
|
||||
public class CustomWeightedDispersalRequest
|
||||
{
|
||||
public int DepartmentId { get; set; }
|
||||
public Product DispersalProduct { get; set; }
|
||||
public Dictionary<string,double> DispersalWeightByRole { get; set; }
|
||||
public int month { get; set; }
|
||||
public int year { get; set; }
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.GoalDispersal;
|
||||
|
||||
public class DefaultWeightedGoalDispersalData
|
||||
{
|
||||
public int DepartmentId { get; set; }
|
||||
public DateTime DispersalMonthStartDate { get; set; }
|
||||
public List<AppUser> DispersalMonthPersonnel { get; set; }
|
||||
public PerProductGoal DispersalMonthDepartmentGoals { get; set; }
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.GoalDispersal;
|
||||
|
||||
public class DepartmentGoalExtrapolationRequest
|
||||
{
|
||||
public DateTime DepartmentGoalStartDate { get; set; }
|
||||
public DateTime DepartmentGoalEndDate { get; set; }
|
||||
public int OriginalDepartmentGoal { get; set; }
|
||||
public int NewDepartmentGoal { get; set; }
|
||||
public int DepartmentId { get; set; }
|
||||
public Product Product;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.GoalDispersal;
|
||||
|
||||
public class ExtrapolationGoalDispersalData
|
||||
{
|
||||
public int DepartmentId { get; set; }
|
||||
public DateTime DispersalMonthStartDate { get; set; }
|
||||
public PersonnelGoals DispersalMonthPersonnelGoals { get; set; }
|
||||
public PerProductGoal DispersalMonthDepartmentGoals { get; set; }
|
||||
public PerProductGoal ModelDepartmentGoals { get; set; }
|
||||
public PersonnelGoals ModelPersonnelGoals { get; set; }
|
||||
public List<AppUser> DispersalMonthPersonnel { get; set; }
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.GoalDispersal;
|
||||
|
||||
public class GoalDispersalReceipt
|
||||
{
|
||||
public GoalDispersalReceipt(int deptId, GoalDispersalStrategy strategy)
|
||||
{
|
||||
GoalChanges = new List<GoalChange>();
|
||||
GoalDispersalErrors = new List<GoalDispersalReceiptItem>();
|
||||
DepartmentId = deptId;
|
||||
Strategy = strategy;
|
||||
}
|
||||
public int DepartmentId { get; set; }
|
||||
[JsonIgnore]
|
||||
public List<GoalChange> GoalChanges { get; set; }
|
||||
public List<GoalDispersalReceiptItem> GoalDispersalErrors { get; set; }
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public GoalDispersalStrategy Strategy { get; set; }
|
||||
public void AddNewDispersalError(GoalDispersalError errorType, string employeeId, string message, string employeeName = null)
|
||||
{
|
||||
var newError = new GoalDispersalReceiptItem(errorType, employeeId, message);
|
||||
if (!String.IsNullOrEmpty(employeeName))
|
||||
{
|
||||
newError.EmployeeName = employeeName;
|
||||
}
|
||||
GoalDispersalErrors.Add(newError);
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.GoalDispersal;
|
||||
|
||||
public class GoalDispersalReceiptItem
|
||||
{
|
||||
public GoalDispersalReceiptItem(GoalDispersalError errorType, string employeeId, string message)
|
||||
{
|
||||
ErrorType = errorType;
|
||||
EmployeeId = employeeId;
|
||||
Message = message;
|
||||
}
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public GoalDispersalError ErrorType { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string EmployeeId { get; set; }
|
||||
public string EmployeeName { get; set; }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public interface IPayoutRule
|
||||
{
|
||||
public bool RestrictedByPayoutRule(Activity activity, Product countsForProduct);
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Common;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Payout;
|
||||
|
||||
public class DepartmentPayout: IViewTransformable<DepartmentPayout>
|
||||
{
|
||||
public DepartmentPayout(AppUser employee, UserDepartment assignment, MonthRange monthRange, IReadOnlyCollection<IPayoutRule> departmentRules, IReadOnlyCollection<IPayoutRule> personalRules)
|
||||
{
|
||||
Employee = employee;
|
||||
MonthRange = monthRange;
|
||||
DepartmentRules = departmentRules;
|
||||
PersonalRules = personalRules;
|
||||
Department = assignment;
|
||||
|
||||
EligibleCommissions = new List<Commission>();
|
||||
EligiblePayouts = PayoutProfile.FindForRole(assignment.Role);
|
||||
PersonalActivity = new List<Activity>();
|
||||
PersonalGoals = new List<Goal>();
|
||||
DepartmentActivity = new List<Activity>();
|
||||
DepartmentGoals = new List<Goal>();
|
||||
CommissionPayouts = new List<PayoutLineItem>();
|
||||
GoalPayouts = new List<PayoutLineItem>();
|
||||
}
|
||||
|
||||
public AppUser Employee { get; }
|
||||
public MonthRange MonthRange { get; }
|
||||
public UserDepartment Department { get; }
|
||||
public IEnumerable<Commission> EligibleCommissions { get; set; }
|
||||
public IEnumerable<PayoutProfile> EligiblePayouts { get; }
|
||||
public IEnumerable<Activity> PersonalActivity { get; set; }
|
||||
public IEnumerable<Goal> PersonalGoals { get; set; }
|
||||
public IEnumerable<Activity> DepartmentActivity { get; set; }
|
||||
public IEnumerable<Goal> DepartmentGoals { get; set; }
|
||||
public IEnumerable<PayoutLineItem> CommissionPayouts { get; set; }
|
||||
public IEnumerable<PayoutLineItem> GoalPayouts { get; set; }
|
||||
public IReadOnlyCollection<IPayoutRule> DepartmentRules { get; }
|
||||
public IReadOnlyCollection<IPayoutRule> PersonalRules { get; }
|
||||
|
||||
public bool HasEligibleIncentives()
|
||||
{
|
||||
return HasEligibleCommissions() || HasEligibleGoalPayouts();
|
||||
}
|
||||
|
||||
public DepartmentPayout TransformForView()
|
||||
{
|
||||
foreach(var activity in DepartmentActivity)
|
||||
{
|
||||
activity?.TransformForView();
|
||||
}
|
||||
foreach(var activity in PersonalActivity)
|
||||
{
|
||||
activity?.TransformForView();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasEligibleActivity()
|
||||
{
|
||||
return PersonalActivity != null && PersonalActivity.Any() ||
|
||||
DepartmentActivity != null && DepartmentActivity.Any();
|
||||
}
|
||||
|
||||
public bool HasEligibleCommissions()
|
||||
{
|
||||
return EligibleCommissions != null && EligibleCommissions.Any();
|
||||
}
|
||||
|
||||
public bool HasEligibleGoalPayouts()
|
||||
{
|
||||
return EligiblePayouts != null && EligiblePayouts.Any();
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Payout;
|
||||
|
||||
public enum PayoutStyle
|
||||
{
|
||||
Commission,
|
||||
Goal
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class PerProductActivity
|
||||
{
|
||||
public PerProductActivity()
|
||||
{
|
||||
ProductActivity = new Dictionary<Product, double>();
|
||||
ProductOther = new Dictionary<Product, int>();
|
||||
foreach (Product product in Enum.GetValues(typeof(Product)))
|
||||
{
|
||||
ProductActivity[product] = 0;
|
||||
ProductOther[product] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public IDictionary<Product, double> ProductActivity { get; }
|
||||
public IDictionary<Product, int> ProductOther { get; }
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class PerProductGoal
|
||||
{
|
||||
public PerProductGoal()
|
||||
{
|
||||
ProductGoals = new Dictionary<Product, int>();
|
||||
foreach (Product product in Enum.GetValues(typeof(Product)))
|
||||
{
|
||||
ProductGoals[product] = 0;
|
||||
}
|
||||
}
|
||||
public IDictionary<Product, int> ProductGoals { get; set; }
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class PersonnelGoals
|
||||
{
|
||||
public PersonnelGoals(int departmentId, int year, int month, ICollection<AppUser> personnel)
|
||||
{
|
||||
DepartmentId = departmentId;
|
||||
Year = year;
|
||||
Month = month;
|
||||
Personnel = personnel;
|
||||
Goals = new Dictionary<string, PerProductGoal>();
|
||||
foreach (var person in personnel)
|
||||
{
|
||||
Goals[person.EmployeeId] = new PerProductGoal();
|
||||
}
|
||||
}
|
||||
|
||||
public int DepartmentId { get; }
|
||||
public int Year { get; }
|
||||
public int Month { get; }
|
||||
public ICollection<AppUser> Personnel { get; }
|
||||
public ICollection<Goal> GoalAudit { get; set; }
|
||||
public IDictionary<string, PerProductGoal> Goals { get; }
|
||||
|
||||
public void ApplyAll(ICollection<Goal> findDepartmentGoals)
|
||||
{
|
||||
GoalAudit = findDepartmentGoals;
|
||||
foreach (var goal in findDepartmentGoals)
|
||||
{
|
||||
if (Goals.Keys.Contains(goal.EmployeeId))
|
||||
{
|
||||
Goals[goal.EmployeeId].ProductGoals[goal.Product] = goal.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.ProgressView;
|
||||
|
||||
public interface IProgressView
|
||||
{
|
||||
void ApplyActivity(ICollection<Activity> activities);
|
||||
void ApplyGoals(ICollection<Goal> findDepartmentGoals);
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.ProgressView;
|
||||
|
||||
public enum ProgressType
|
||||
{
|
||||
Employee,
|
||||
Department
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Common;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class RegionProgress: IViewTransformable<RegionProgress>
|
||||
{
|
||||
public RegionProgress(Region region, MonthRange monthRange)
|
||||
{
|
||||
Region = region;
|
||||
MonthRange = monthRange;
|
||||
Departments = new List<DepartmentProgress>();
|
||||
}
|
||||
|
||||
public Region Region { get; }
|
||||
public MonthRange MonthRange{ get; }
|
||||
public IList<DepartmentProgress> Departments { get; }
|
||||
|
||||
public RegionProgress TransformForView()
|
||||
{
|
||||
foreach(var department in Departments)
|
||||
{
|
||||
department?.TransformForView();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class ReportSettings
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string RequiredPermissionCode { get; set; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
using System.Reflection;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
public class Settings
|
||||
{
|
||||
public Dictionary<string, string> ActivityStateSet { get; set; }
|
||||
public Dictionary<string, string> ActivityTypeSet { get; set; }
|
||||
public List<Role> AppRoles { get; set; }
|
||||
public IReadOnlyCollection<ReportSettings> AuthorizedReports { get; set; }
|
||||
public List<BusinessLine> BusinessLines { get; set; }
|
||||
public Dictionary<string, string> DepartmentStateSet { get; set; }
|
||||
public Dictionary<string, string> OrganizationSet { get; set; }
|
||||
public List<PayoutProfile> PayoutProfiles { get; set; }
|
||||
public List<Permission> Permissions { get; set; }
|
||||
public List<ProductDetail> ProductDetails { get; }
|
||||
public Product[] ProductSet { get; set; }
|
||||
public List<Region> Regions { get; set; }
|
||||
public Dictionary<string, string> SystemTypeSet { get; set; }
|
||||
public Dictionary<string, string> UserTypeSet { get; set; }
|
||||
public IReadOnlyCollection<Department> Departments { get; set; }
|
||||
public IReadOnlyCollection<UserSummary> Employees { get; set; }
|
||||
|
||||
public DateTime NextBonusPeriod { get; set; }
|
||||
|
||||
public Settings()
|
||||
{
|
||||
ActivityStateSet = new Dictionary<string, string>();
|
||||
ActivityTypeSet = new Dictionary<string, string>();
|
||||
ProductSet = (Product[]) Enum.GetValues(typeof(Product));
|
||||
ProductDetails = ProductDetail.ProductDetails;
|
||||
SystemTypeSet = new Dictionary<string, string>();
|
||||
UserTypeSet = new Dictionary<string, string>();
|
||||
OrganizationSet = new Dictionary<string, string>();
|
||||
BusinessLines = new List<BusinessLine>();
|
||||
DepartmentStateSet = new Dictionary<string, string>();
|
||||
Permissions = new List<Permission>();
|
||||
Regions = Region.Regions;
|
||||
PayoutProfiles = PayoutProfile.ActivePayoutProfiles;
|
||||
|
||||
foreach (int key in Enum.GetValues(typeof(ActivityState)))
|
||||
{
|
||||
ActivityStateSet[key.ToString()] = Enum.GetName(typeof(ActivityState), key);
|
||||
}
|
||||
|
||||
foreach (int key in Enum.GetValues(typeof(ActivityType)))
|
||||
{
|
||||
ActivityTypeSet[key.ToString()] = Enum.GetName(typeof(ActivityType), key);
|
||||
}
|
||||
|
||||
foreach (int key in Enum.GetValues(typeof(SystemType)))
|
||||
{
|
||||
SystemTypeSet[key.ToString()] = Enum.GetName(typeof(SystemType), key);
|
||||
}
|
||||
|
||||
foreach (int key in Enum.GetValues(typeof(UserType)))
|
||||
{
|
||||
UserTypeSet[key.ToString()] = Enum.GetName(typeof(UserType), key);
|
||||
}
|
||||
|
||||
foreach (int key in Enum.GetValues(typeof(DepartmentState)))
|
||||
{
|
||||
DepartmentStateSet[key.ToString()] = Enum.GetName(typeof(DepartmentState), key);
|
||||
}
|
||||
|
||||
foreach (var field in typeof(Organization).GetFields(BindingFlags.Static | BindingFlags.Public))
|
||||
{
|
||||
if (field.FieldType != typeof(Organization))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var org = field.GetValue(field.Name) as Organization;
|
||||
if (org == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
OrganizationSet[org.OrgCode] = org.Name;
|
||||
}
|
||||
|
||||
foreach (var field in typeof(BusinessLine).GetFields(BindingFlags.Static | BindingFlags.Public))
|
||||
{
|
||||
if (field.FieldType != typeof(BusinessLine))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var bl = field.GetValue(field.Name) as BusinessLine;
|
||||
if (bl != null)
|
||||
{
|
||||
BusinessLines.Add(bl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
AppRoles = Role.GetRolesList();
|
||||
|
||||
Permissions = EnumInstances<Permission>();
|
||||
}
|
||||
|
||||
private List<T> EnumInstances<T>() where T : class
|
||||
{
|
||||
var foundInstances = new List<T>();
|
||||
|
||||
foreach (var field in typeof(T).GetFields(BindingFlags.Static | BindingFlags.Public))
|
||||
{
|
||||
if (field.FieldType != typeof(T))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (field.GetValue(field.Name) is T instance)
|
||||
{
|
||||
foundInstances.Add(instance);
|
||||
}
|
||||
}
|
||||
return foundInstances;
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Temenos;
|
||||
|
||||
public class DirectVehicleSaleRecord
|
||||
{
|
||||
public string ApplicantSSN { get; set; }
|
||||
public string ApplicationID { get; set; }
|
||||
public string CreatedDate { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
public string ApplicantName { get; set; }
|
||||
public string ReferringEmployeeEmail { get; set; }
|
||||
public string AmountFinanced { get; set; }
|
||||
public string SubProduct { get; set; }
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using CsvHelper.Configuration.Attributes;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Temenos;
|
||||
|
||||
public class IndirectVehicleSaleRecord
|
||||
{
|
||||
public string ApplicantSSN { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
public string ApplicantName { get; set; }
|
||||
public string CreatedDate { get; set; }
|
||||
public string DisbursedDate { get; set; }
|
||||
public string ApplicationID { get; set; }
|
||||
public string SubProduct { get; set; }
|
||||
public string AmountFinanced { get; set; }
|
||||
[Ignore]
|
||||
public string ReferringEmployeeEmail { get; set; }
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
using CsvHelper.Configuration.Attributes;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using LCU.API.Internal.Operations.IncentiveApi.Models.Action;
|
||||
using LCU.API.Internal.Operations.IncentiveApi.Models.Constants;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Temenos;
|
||||
|
||||
public class TemenosCreditCardSale
|
||||
{
|
||||
public string ApplicationID { get; set; }
|
||||
public string SubProduct { get; set; }
|
||||
public string FinalLoanAmount { get; set; }
|
||||
public string DisbursedDate { get; set; }
|
||||
public string ApplicantFirstName { get; set; }
|
||||
public string ApplicantLastName { get; set; }
|
||||
public string OrganizationName { get; set; }
|
||||
public string LOResponsibleEmployeeEmail { get; set; }
|
||||
public string LODirectLoanOfficer { get; set; }
|
||||
public string ReferringEmployeeEmail { get; set; }
|
||||
[Ignore]
|
||||
public bool IsPersonal { get => SubProduct.StartsWith(TemenosImportConstants.PersonalCardSubProduct); }
|
||||
[Ignore]
|
||||
public string MemberName { get => IsPersonal ? $"{ApplicantFirstName} {ApplicantLastName}" : OrganizationName; }
|
||||
|
||||
public Activity CreateActivity(AppUser appUser)
|
||||
{
|
||||
var homeDept = appUser.FindHomeDepartment();
|
||||
return new Activity()
|
||||
{
|
||||
Product = Product.CreditCard,
|
||||
Type = ActivityType.Sale,
|
||||
State = ActivityState.Accepted,
|
||||
SourceSystem = SystemType.Temenos,
|
||||
SourceCreated = DateTime.Parse(DisbursedDate),
|
||||
Accepted = DateTime.Parse(DisbursedDate).Date.AddHours(12),
|
||||
SourceId = ApplicationID,
|
||||
Detail = new ActivityDetail()
|
||||
{
|
||||
MemberName = MemberName,
|
||||
AccountBalance = IActionFileObject.ParseMoneyDouble(FinalLoanAmount),
|
||||
AccountStatus = SubProduct
|
||||
},
|
||||
AppUserId = appUser.Id,
|
||||
EmployeeEmail = appUser.AdEmail,
|
||||
EmployeeId = appUser.EmployeeId,
|
||||
DepartmentId = homeDept.DepartmentId
|
||||
};
|
||||
}
|
||||
|
||||
public DeadActivity CreateDeadActivity(DeadActivityReason reasonCode, string note, string employeeEmail = null, string employeeId = null)
|
||||
{
|
||||
return new DeadActivity(ApplicationID, SystemType.Action, reasonCode, note)
|
||||
{
|
||||
Product = Product.CreditCard,
|
||||
Type = ActivityType.Sale,
|
||||
State = ActivityState.Accepted,
|
||||
SourceSystem = SystemType.Temenos,
|
||||
SourceCreated = DateTime.Parse(DisbursedDate),
|
||||
Accepted = DateTime.Parse(DisbursedDate).Date.AddHours(12),
|
||||
SourceId = ApplicationID,
|
||||
DeadDetail = new DeadActivityDetail()
|
||||
{
|
||||
MemberName = MemberName,
|
||||
AccountBalance = IActionFileObject.ParseMoneyDouble(FinalLoanAmount),
|
||||
AccountStatus = SubProduct
|
||||
},
|
||||
EmployeeEmail = employeeEmail,
|
||||
EmployeeId = employeeId,
|
||||
};
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Temenos;
|
||||
|
||||
public class VehicleSaleRecord
|
||||
{
|
||||
public string ApplicantSSN { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
public string ApplicantName { get; set; }
|
||||
public string CreatedDate { get; set; }
|
||||
public string ApplicationID { get; set; }
|
||||
public string SubProduct { get; set; }
|
||||
public string AmountFinanced { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user