Adding
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Services.Rules;
|
||||
|
||||
public class BusinessRuleService : IBusinessRuleService
|
||||
{
|
||||
private readonly IDepartmentService _departmentService;
|
||||
|
||||
public BusinessRuleService(IDepartmentService departmentService)
|
||||
{
|
||||
_departmentService = departmentService;
|
||||
}
|
||||
|
||||
public IReadOnlyCollection<IPayoutRule> GetRules(PayoutType type)
|
||||
{
|
||||
var dept = _departmentService
|
||||
.GetDepartmentsByDayforceGlCodeAsync(NewCheckingReferralRule.MemberServicesGlCode).GetAwaiter()
|
||||
.GetResult();
|
||||
|
||||
return type switch
|
||||
{
|
||||
PayoutType.Department => new List<IPayoutRule>()
|
||||
{
|
||||
new NewCheckingReferralRule(dept.Id.Value)
|
||||
},
|
||||
PayoutType.Personal => new List<IPayoutRule>()
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Services.Rules
|
||||
{
|
||||
public interface IBusinessRuleService
|
||||
{
|
||||
IReadOnlyCollection<IPayoutRule> GetRules(PayoutType type);
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
using LCU.API.Internal.Operations.IncentiveApi.Models;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Services.Rules;
|
||||
|
||||
public class NewCheckingReferralRule : IPayoutRule
|
||||
{
|
||||
public static readonly int MemberServicesGlCode = 200;
|
||||
|
||||
public NewCheckingReferralRule(int memberServicesDepartmentId)
|
||||
{
|
||||
MemberServiceDeptId = memberServicesDepartmentId;
|
||||
}
|
||||
|
||||
private int MemberServiceDeptId { get; }
|
||||
|
||||
public bool RestrictedByPayoutRule(Activity activity, Product countsForProduct)
|
||||
{
|
||||
var result = countsForProduct == activity.Product
|
||||
&& activity.Product == Product.NewChecking
|
||||
&& activity.Type == ActivityType.Referral
|
||||
&& activity.DepartmentId != MemberServiceDeptId;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user