Adding
This commit is contained in:
+363
@@ -0,0 +1,363 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
||||
|
||||
namespace LCU.Library.Internal.IncentiveApiModels.Entities
|
||||
{
|
||||
public class PayoutProfile
|
||||
{
|
||||
public int Id { get; }
|
||||
public Product Product { get; }
|
||||
public Role[] Roles { get; }
|
||||
public Dictionary<DateTime, PayoutRange[]> Payouts { get; }
|
||||
public PayoutType Type { get; }
|
||||
public bool PayEach { get; }
|
||||
public bool IsEnabled { get; }
|
||||
private const bool PayForEach = true;
|
||||
|
||||
private PayoutProfile(
|
||||
int id,
|
||||
Product product,
|
||||
Role[] roles,
|
||||
PayoutRange[] defaultPayout,
|
||||
PayoutType type = PayoutType.Personal,
|
||||
bool payEach = false,
|
||||
bool isEnabled = true
|
||||
)
|
||||
{
|
||||
Id = id;
|
||||
Product = product;
|
||||
Roles = roles;
|
||||
Payouts = new Dictionary<DateTime, PayoutRange[]>
|
||||
{
|
||||
{ DateTime.MinValue, defaultPayout }
|
||||
};
|
||||
Type = type;
|
||||
PayEach = payEach;
|
||||
IsEnabled = isEnabled;
|
||||
}
|
||||
|
||||
private PayoutProfile(
|
||||
int id,
|
||||
Product product,
|
||||
Role[] roles,
|
||||
Dictionary<DateTime, PayoutRange[]> payouts,
|
||||
PayoutType type = PayoutType.Personal,
|
||||
bool payEach = false,
|
||||
bool isEnabled = true
|
||||
)
|
||||
{
|
||||
Id = id;
|
||||
Product = product;
|
||||
Roles = roles;
|
||||
Payouts = payouts;
|
||||
Type = type;
|
||||
PayEach = payEach;
|
||||
IsEnabled = isEnabled;
|
||||
}
|
||||
|
||||
public static readonly PayoutProfile BMMortgage = new PayoutProfile(1,
|
||||
Product.Mortgage, new[] { Role.BM },
|
||||
new Dictionary<DateTime, PayoutRange[]>
|
||||
{
|
||||
{
|
||||
DateTime.MinValue, new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 200),
|
||||
new PayoutRange(1.25, 1.49, 250),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 325)
|
||||
}
|
||||
},
|
||||
{
|
||||
DateTime.ParseExact("2021-11-01", "yyyy-MM-dd", CultureInfo.InvariantCulture), new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 250),
|
||||
new PayoutRange(1.25, 1.49, 325),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 425)
|
||||
}
|
||||
}
|
||||
},
|
||||
PayoutType.Department
|
||||
);
|
||||
|
||||
public static readonly PayoutProfile ABMMortgage = new PayoutProfile(2,
|
||||
Product.Mortgage, new[] { Role.ABM, Role.ManagementTrainee },
|
||||
new Dictionary<DateTime, PayoutRange[]>
|
||||
{
|
||||
{
|
||||
DateTime.MinValue, new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 125),
|
||||
new PayoutRange(1.25, 1.49, 175),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 250)
|
||||
}
|
||||
},
|
||||
{
|
||||
DateTime.ParseExact("2021-11-01", "yyyy-MM-dd", CultureInfo.InvariantCulture), new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 175),
|
||||
new PayoutRange(1.25, 1.49, 250),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 350)
|
||||
}
|
||||
}
|
||||
},
|
||||
PayoutType.Department
|
||||
);
|
||||
|
||||
public static readonly PayoutProfile PFOMSLOMortgage = new PayoutProfile(3,
|
||||
Product.Mortgage, new[] { Role.PFO, Role.MSLO },
|
||||
new Dictionary<DateTime, PayoutRange[]>
|
||||
{
|
||||
{
|
||||
DateTime.MinValue, new[]
|
||||
{
|
||||
new PayoutRange(0.74, 0.99, 50),
|
||||
new PayoutRange(1.0, 1.24, 100),
|
||||
new PayoutRange(1.25, 1.49, 150),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 200)
|
||||
}
|
||||
},
|
||||
{
|
||||
DateTime.ParseExact("2021-11-01", "yyyy-MM-dd", CultureInfo.InvariantCulture), new[]
|
||||
{
|
||||
new PayoutRange(0.74, 0.99, 75),
|
||||
new PayoutRange(1.0, 1.24, 150),
|
||||
new PayoutRange(1.25, 1.49, 225),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 300)
|
||||
}
|
||||
}
|
||||
},
|
||||
PayoutType.Personal
|
||||
);
|
||||
|
||||
public static readonly PayoutProfile MSCPersonalMortgage = new PayoutProfile(4,
|
||||
Product.Mortgage, new[] { Role.MSCTeamLead },
|
||||
new Dictionary<DateTime, PayoutRange[]>
|
||||
{
|
||||
{
|
||||
DateTime.MinValue, new[]
|
||||
{
|
||||
new PayoutRange(0.74, 0.99, 50),
|
||||
new PayoutRange(1.0, 1.24, 100),
|
||||
new PayoutRange(1.25, 1.49, 150),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 200)
|
||||
}
|
||||
},
|
||||
{
|
||||
DateTime.ParseExact("2021-11-01", "yyyy-MM-dd", CultureInfo.InvariantCulture), new[]
|
||||
{
|
||||
new PayoutRange(0.74, 0.99, 75),
|
||||
new PayoutRange(1.0, 1.24, 150),
|
||||
new PayoutRange(1.25, 1.49, 225),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 300)
|
||||
}
|
||||
}
|
||||
},
|
||||
PayoutType.Personal
|
||||
);
|
||||
|
||||
public static readonly PayoutProfile MSCMortgage = new PayoutProfile(5,
|
||||
Product.Mortgage, new[] { Role.MSCTeamLead },
|
||||
new Dictionary<DateTime, PayoutRange[]>
|
||||
{
|
||||
{
|
||||
DateTime.MinValue, new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 50),
|
||||
new PayoutRange(1.25, 1.49, 75),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 100)
|
||||
}
|
||||
},
|
||||
{
|
||||
DateTime.ParseExact("2021-11-01", "yyyy-MM-dd", CultureInfo.InvariantCulture), new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 100),
|
||||
new PayoutRange(1.25, 1.49, 150),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 200)
|
||||
}
|
||||
}
|
||||
},
|
||||
PayoutType.Department
|
||||
);
|
||||
|
||||
public static readonly PayoutProfile BMVehicle = new PayoutProfile(6,
|
||||
Product.Vehicle, new[] { Role.BM },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 125),
|
||||
new PayoutRange(1.25, 1.49, 175),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 225)
|
||||
},
|
||||
PayoutType.Department);
|
||||
|
||||
public static readonly PayoutProfile ABMVehicle = new PayoutProfile(7,
|
||||
Product.Vehicle, new[] { Role.ABM, Role.ManagementTrainee },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 50),
|
||||
new PayoutRange(1.25, 1.49, 100),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 125)
|
||||
},
|
||||
PayoutType.Department);
|
||||
|
||||
public static readonly PayoutProfile PFOMSLOVehicle = new PayoutProfile(8,
|
||||
Product.Vehicle, new[] { Role.PFO, Role.MSLO },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(0.74, 0.99, 25),
|
||||
new PayoutRange(1.0, 1.24, 50),
|
||||
new PayoutRange(1.25, 1.49, 75),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 100)
|
||||
},
|
||||
PayoutType.Personal);
|
||||
|
||||
public static readonly PayoutProfile MSCPersonalVehicle = new PayoutProfile(9,
|
||||
Product.Vehicle, new[] { Role.MSCTeamLead },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(0.74, 0.99, 25),
|
||||
new PayoutRange(1.0, 1.24, 50),
|
||||
new PayoutRange(1.25, 1.49, 75),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 100)
|
||||
},
|
||||
PayoutType.Personal);
|
||||
|
||||
public static readonly PayoutProfile BMNewChecking = new PayoutProfile(10,
|
||||
Product.NewChecking, new[] { Role.BM },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 200),
|
||||
new PayoutRange(1.25, 1.49, 250),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 325)
|
||||
},
|
||||
PayoutType.Department);
|
||||
|
||||
public static readonly PayoutProfile ABMBOMNewChecking = new PayoutProfile(11,
|
||||
Product.NewChecking, new[] { Role.ABM, Role.BOM, Role.ManagementTrainee },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 125),
|
||||
new PayoutRange(1.25, 1.49, 175),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 250)
|
||||
},
|
||||
PayoutType.Department);
|
||||
|
||||
public static readonly PayoutProfile PFOMSLONewChecking = new PayoutProfile(12,
|
||||
Product.NewChecking, new[] { Role.PFO, Role.UniversalSpecialistPFO },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(0.74, 0.99, 50),
|
||||
new PayoutRange(1.0, 1.24, 100),
|
||||
new PayoutRange(1.25, 1.49, 150),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 200)
|
||||
},
|
||||
PayoutType.Personal);
|
||||
|
||||
public static readonly PayoutProfile MSCNewChecking = new PayoutProfile(13,
|
||||
Product.NewChecking, new[] { Role.MSCTeamLead },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 50),
|
||||
new PayoutRange(1.25, 1.49, 75),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 100)
|
||||
},
|
||||
PayoutType.Department);
|
||||
|
||||
public static readonly PayoutProfile MSCPersonalNewChecking = new PayoutProfile(14,
|
||||
Product.NewChecking, new[] { Role.MSCTeamLead },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(0.74, 0.99, 50),
|
||||
new PayoutRange(1.0, 1.24, 100),
|
||||
new PayoutRange(1.25, 1.49, 150),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 200)
|
||||
},
|
||||
PayoutType.Personal);
|
||||
|
||||
public static readonly PayoutProfile BMCreditCard = new PayoutProfile(15,
|
||||
Product.CreditCard, new[] { Role.BM },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 125),
|
||||
new PayoutRange(1.25, 1.49, 175),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 225)
|
||||
},
|
||||
PayoutType.Department);
|
||||
|
||||
public static readonly PayoutProfile ABMBOMCreditCardPayout = new PayoutProfile(16,
|
||||
Product.CreditCard, new[] { Role.ABM, Role.BOM, Role.ManagementTrainee },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 50),
|
||||
new PayoutRange(1.25, 1.49, 100),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 125)
|
||||
},
|
||||
PayoutType.Department);
|
||||
|
||||
public static readonly PayoutProfile MSCCreditCardPayout = new PayoutProfile(17,
|
||||
Product.CreditCard, new[] { Role.MSCTeamLead },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(1.0, 1.24, 50),
|
||||
new PayoutRange(1.25, 1.49, 75),
|
||||
new PayoutRange(1.5, PayoutRange.NOLIMIT, 100)
|
||||
},
|
||||
PayoutType.Department);
|
||||
|
||||
public static readonly PayoutProfile BMABMPFOGAPPayout = new PayoutProfile(18,
|
||||
Product.GAPInsurance,
|
||||
new[] { Role.BM, Role.ABM, Role.PFO, Role.ManagementTrainee, Role.MSCTeamLead, Role.MSLO, Role.UniversalSpecialistPFO },
|
||||
new[]
|
||||
{
|
||||
new PayoutRange(0.3, 0.39, 30),
|
||||
new PayoutRange(0.4, 0.49, 40),
|
||||
new PayoutRange(0.5, 0.59, 50),
|
||||
new PayoutRange(0.6, PayoutRange.NOLIMIT, 60)
|
||||
},
|
||||
PayoutType.Personal, PayForEach, false);
|
||||
|
||||
public static readonly List<PayoutProfile> PayoutProfiles = new List<PayoutProfile>
|
||||
{
|
||||
ABMBOMCreditCardPayout,
|
||||
ABMBOMNewChecking,
|
||||
ABMMortgage,
|
||||
ABMVehicle,
|
||||
BMABMPFOGAPPayout,
|
||||
BMCreditCard,
|
||||
BMMortgage,
|
||||
BMNewChecking,
|
||||
BMVehicle,
|
||||
MSCCreditCardPayout,
|
||||
MSCMortgage,
|
||||
MSCNewChecking,
|
||||
MSCPersonalMortgage,
|
||||
MSCPersonalNewChecking,
|
||||
MSCPersonalVehicle,
|
||||
PFOMSLOMortgage,
|
||||
PFOMSLONewChecking,
|
||||
PFOMSLOVehicle,
|
||||
};
|
||||
|
||||
public static readonly List<PayoutProfile> ActivePayoutProfiles = PayoutProfiles.Where(x => x.IsEnabled).ToList();
|
||||
|
||||
public static IEnumerable<PayoutProfile> FindForRole(Role employeeRole)
|
||||
{
|
||||
return ActivePayoutProfiles.Where(profile => profile.Roles.Contains(employeeRole));
|
||||
}
|
||||
|
||||
public static PayoutProfile FindById(int id)
|
||||
{
|
||||
return PayoutProfiles.First(profile => profile.Id == id);
|
||||
}
|
||||
|
||||
public static PayoutProfile LookupProfile(Product product, Role role, PayoutType type)
|
||||
{
|
||||
return ActivePayoutProfiles
|
||||
.Find(profile => profile.Product == product
|
||||
&& profile.Roles.Contains(role)
|
||||
&& profile.Type == type);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user