41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|