68 lines
2.5 KiB
C#
68 lines
2.5 KiB
C#
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
|
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
|
|
|
namespace LCU.API.Internal.Operations.IncentiveApi.Services.AutoDecision;
|
|
|
|
public class NewCheckingDecisionStrategy : IDecisionStrategy
|
|
{
|
|
public bool CanDecideActivity(Activity activity)
|
|
{
|
|
return activity.Product == Product.NewChecking && activity.Type == ActivityType.Sale;
|
|
}
|
|
|
|
public async Task<ActivityStateChange> DecideActivity(Activity activity)
|
|
{
|
|
if (activity.Detail.AccountStatus == null)
|
|
{
|
|
return await Task.FromResult(new ActivityStateChange()
|
|
{
|
|
AcceptedDate = activity.Accepted.Date.AddHours(12),
|
|
ActivityId = activity.Id,
|
|
Note = "Could Not Determine Account Status",
|
|
State = ActivityState.Rejected
|
|
});
|
|
}
|
|
|
|
if (activity.Detail.AccountStatus != null && activity.SourceSystem == SystemType.DigitalBanking)
|
|
{
|
|
return await Task.FromResult(new ActivityStateChange()
|
|
{
|
|
AcceptedDate = activity.Accepted.Date.AddHours(12),
|
|
ActivityId = activity.Id,
|
|
Note = "Digital Banking Sourced Sale",
|
|
State = ActivityState.Accepted
|
|
});
|
|
}
|
|
|
|
if (activity.Detail.AccountStatus.Equals("ACT", StringComparison.InvariantCultureIgnoreCase))
|
|
{
|
|
return await Task.FromResult(new ActivityStateChange
|
|
{
|
|
AcceptedDate = activity.Accepted.Date.AddHours(12),
|
|
ActivityId = activity.Id,
|
|
Note = "Checking account is Active",
|
|
State = ActivityState.Accepted
|
|
});
|
|
}
|
|
|
|
if (activity.Detail.AccountStatus.Equals("CLS", StringComparison.InvariantCultureIgnoreCase))
|
|
{
|
|
return await Task.FromResult(new ActivityStateChange
|
|
{
|
|
AcceptedDate = activity.Accepted.Date.AddHours(12),
|
|
ActivityId = activity.Id,
|
|
Note = "Checking account is Closed",
|
|
State = ActivityState.Rejected
|
|
});
|
|
}
|
|
|
|
return await Task.FromResult(new ActivityStateChange
|
|
{
|
|
AcceptedDate = activity.Accepted.Date.AddHours(12),
|
|
ActivityId = activity.Id,
|
|
Note = "Checking Account is not Active or Closed. Waiting for Manual Review or Status Update",
|
|
State = ActivityState.ManualReview
|
|
});
|
|
}
|
|
}
|