first commit
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
using Landmark.OLA.Models.Loan.Enums;
|
||||
|
||||
namespace CRIF.ACTion.Services.Landmark.SourceChannel
|
||||
{
|
||||
public interface ISourceChannelLookupService
|
||||
{
|
||||
int GetSourceChannelByLoanType(LoanType loanType);
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using CRIF.ACTion.Configuration;
|
||||
using Landmark.OLA.Models.Loan.Enums;
|
||||
|
||||
namespace CRIF.ACTion.Services.Landmark.SourceChannel
|
||||
{
|
||||
public class LandmarkSourceChannelLookupService : ISourceChannelLookupService
|
||||
{
|
||||
private readonly CrifSettings _settings;
|
||||
private ReadOnlyDictionary<LoanType, int> _loanTypeToSourceChannel;
|
||||
|
||||
public LandmarkSourceChannelLookupService(CrifSettings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
|
||||
ConfigureMapping();
|
||||
}
|
||||
|
||||
private void ConfigureMapping()
|
||||
{
|
||||
var mapping = new Dictionary<LoanType, int>
|
||||
{
|
||||
{LoanType.CC_CashBack, _settings.SourceChannels.CreditCardSourceChannelId},
|
||||
{LoanType.CC_Rewards, _settings.SourceChannels.CreditCardSourceChannelId},
|
||||
{LoanType.CC_Secure, _settings.SourceChannels.CreditCardSourceChannelId},
|
||||
{LoanType.CC_Student, _settings.SourceChannels.CreditCardSourceChannelId},
|
||||
};
|
||||
|
||||
_loanTypeToSourceChannel = new ReadOnlyDictionary<LoanType, int>(mapping);
|
||||
}
|
||||
|
||||
public int GetSourceChannelByLoanType(LoanType loanType)
|
||||
{
|
||||
var channelId = _loanTypeToSourceChannel.TryGetValue(loanType, out int foundValue)
|
||||
? foundValue : _settings.SourceChannels.DefaultSourceChannelId;
|
||||
|
||||
return channelId;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user