public DummyController(ILogger <BaseController> logger, IDistributedCache distributedCache, IApplicationSessionState sessionState, IConfiguration configuration) : base(logger, distributedCache, sessionState, configuration) { }
public PaymentOptionsController(ILogger <BaseController> logger, IConfiguration configuration, IBuildPaymentOptionsVmService buildPaymentOptionsVmService, IBuildOneOffPaymentReviewVmService buildOneOffPaymentReviewVmService, IVerifonePaymentProviderService verifonePaymentProviderService, IWebActivityService webActivityService, IBuildDirectDebitDetailsVmService buildDirectDebitDetailsVmService, IBuildDirectDebitPlanOverviewVmService buildDirectDebitPlanOverviewVmService, IDirectDebitPlanSetupService directDebitPlanSetupService, IDistributedCache distributedCache, IApplicationSessionState sessionState, IGtmService gtmService, IMapper mapper) : base(logger, distributedCache, sessionState, configuration) { _logger = logger; _buildPaymentOptionsVmService = buildPaymentOptionsVmService; _buildOneOffPaymentReviewVmService = buildOneOffPaymentReviewVmService; _verifonePaymentProviderService = verifonePaymentProviderService; _buildDirectDebitDetailsVmService = buildDirectDebitDetailsVmService; _buildDirectDebitPlanOverviewVmService = buildDirectDebitPlanOverviewVmService; _directDebitPlanSetupService = directDebitPlanSetupService; _gtmService = gtmService; _mapper = mapper; _webActivityService = webActivityService; }
public UnreadDocumentsService(IAccountsService accountsService, IHttpContextAccessor httpContext, IApplicationSessionState sessionState) { _accountsService = accountsService; _httpContext = httpContext; _sessionState = sessionState; }
public async Task <AmendDirectDebitVm> Build(IApplicationSessionState session, Guid lowellReferenceSurrogateKey, string caseflowUserId) { string lowellReference = session.GetLowellReferenceFromSurrogate(lowellReferenceSurrogateKey); AccountReferenceDto accountReferenceDto = new AccountReferenceDto { LowellReference = lowellReference }; var currentDirectDebit = await _getCurrentDirectDebitProcess.GetCurrentDirectDebit(accountReferenceDto); IncomeAndExpenditureApiModel incomeAndExpenditureDto = await _apiGatewayProxy.GetIncomeAndExpenditure(lowellReference); var workingAccounts = 0; if (caseflowUserId != null) { List <AccountSummary> accounts = await _accountService.GetAccounts(caseflowUserId); workingAccounts = accounts.Count(a => !a.AccountStatusIsClosed); } PaymentOptionsDto paymentOptionsDto = await _apiGatewayProxy.GetPaymentOptions(accountReferenceDto); var obj = new AmendDirectDebitVm { LowellReference = currentDirectDebit.LowellReference, ClientName = currentDirectDebit.ClientName, OutstandingBalance = currentDirectDebit.OutstandingBalance, DirectDebitAmount = null, PlanType = currentDirectDebit.PlanType, EarliestStartDate = currentDirectDebit.EarliestInstalmentDate, LatestStartDate = currentDirectDebit.LatestPlanSetupDate, PlanStartDate = currentDirectDebit.EarliestInstalmentDate, DiscountedBalance = currentDirectDebit.DiscountedBalance, DiscountAmount = currentDirectDebit.DiscountAmount, DiscountExpiry = currentDirectDebit.DiscountExpiry, DiscountPercentage = currentDirectDebit.DiscountPercentage, DiscountedBalancePreviouslyAccepted = paymentOptionsDto.DiscountedBalancePreviouslyAccepted, Frequency = _buildFrequencyListProcess.BuildFrequencyList(currentDirectDebit.DirectDebitFrequencies), IandENotAvailable = incomeAndExpenditureDto == null, IandELessThanOrIs12MonthsOld = (incomeAndExpenditureDto != null && incomeAndExpenditureDto.Created.AddMonths(12).Date >= DateTime.Now.Date), AverageMonthlyPayment = _portalSetting.AverageMonthlyPaymentAmount, MonthlyDisposableIncome = (incomeAndExpenditureDto == null ? 0 : (incomeAndExpenditureDto.DisposableIncome * (_portalSetting.MonthlyDisposableIncomePlanSetupPercentage / 100))) }; obj.AccountCount = workingAccounts; if (workingAccounts > 1) { obj.MonthlyDisposableIncomePerAccount = obj.MonthlyDisposableIncome / workingAccounts; } else { obj.MonthlyDisposableIncomePerAccount = obj.MonthlyDisposableIncome; } return(obj); }
public HomeController(ILogger <BaseController> logger, IConfiguration configuration, IDistributedCache distributedCache, IApplicationSessionState sessionState, IContactLinksService contactLinks) : base(logger, distributedCache, sessionState, configuration) { _contactLinks = contactLinks; }
public ContactUsController(IBuildContactUsVmService contactUsVmService, IContactUsService contactUsService, IDistributedCache distributedCache, Microsoft.Extensions.Configuration.IConfiguration configuration, IApplicationSessionState sessionState, ILogger <ContactUsController> logger) : base(logger, distributedCache, sessionState, configuration) { _contactUsVmService = contactUsVmService; _contactUsService = contactUsService; }
protected BaseController(ILogger <BaseController> logger, IDistributedCache distributedCache, IApplicationSessionState sessionState, IConfiguration configuration) { Logger = logger; Configuration = configuration; DistributedCache = distributedCache; ApplicationSessionState = sessionState; }
public PaymentCancelledController( ILogger <BaseController> logger, IWebActivityService webActivityService, IDistributedCache distributedCache, IApplicationSessionState sessionState, IConfiguration configuration) : base(logger, distributedCache, sessionState, configuration) { _webActivityService = webActivityService; }
public HeartBeatController(ILogger <BaseController> logger, IApiGatewayHeartbeatService apiGatewayHeartbeatService, HeartbeatSetting heartbeatSetting, IDistributedCache distributedCache, IApplicationSessionState sessionState, IConfiguration configuration) : base(logger, distributedCache, sessionState, configuration) { _apiGatewayHeartbeatService = apiGatewayHeartbeatService; _heartbeatSetting = heartbeatSetting; }
public AmendDirectDebtPlanController(ILogger <BaseController> logger, IConfiguration configuration, IBuildAmendDirectDebitVmService buildAmendDirectDebitVmService, IAmendDirectDebitPlanService amendDirectDebitPlanService, IWebActivityService webActivityService, IDistributedCache distributedCache, IApplicationSessionState sessionState, IGtmService gtmService) : base(logger, distributedCache, sessionState, configuration) { _buildAmendDirectDebitVmService = buildAmendDirectDebitVmService; _amendDirectDebitPlanService = amendDirectDebitPlanService; _webActivityService = webActivityService; _gtmService = gtmService; }
public DataProtectionController(ILogger <BaseController> logger, IConfiguration configuration, IBuildDataProtectionVmService buildDataProtectionVm, IDataProtectionService dataProtectionService, IGtmService gtmService, IWebActivityService webActionLoggingService, IDistributedCache distributedCache, IApplicationSessionState applicationSessionState) : base(logger, distributedCache, applicationSessionState, configuration) { _buildDataProtectionVm = buildDataProtectionVm; _dataProtectionService = dataProtectionService; _gtmService = gtmService; _webActivityService = webActionLoggingService; }
public MyAccountsController(ILogger <BaseController> logger, IConfiguration configuration, IDistributedCache distributedCache, IGtmService gtmService, IWebActivityService webActivityService, IAccountsService accountsService, IApplicationSessionState sessionState, IMapper mapper) : base(logger, distributedCache, sessionState, configuration) { _gtmService = gtmService; _webActivityService = webActivityService; _accountsService = accountsService; _mapper = mapper; }
public OneOffPaymentResultController(ILogger <BaseController> logger, IConfiguration configuration, IPaymentService paymentService, IVerifonePaymentProviderService verifonePaymentProviderService, IGtmService gtmService, IDistributedCache distributedCache, IApplicationSessionState sessionState, IWebActivityService webActivityService) : base(logger, distributedCache, sessionState, configuration) { _paymentService = paymentService; _verifonePaymentProviderService = verifonePaymentProviderService; _gtmService = gtmService; _webActivityService = webActivityService; }
public async Task <IBuildDirectDebitPlanOverviewVmValidationResult> ValidateAndBuild( IUserIdentity loggedInUser, IApplicationSessionState applicationSessionState, Guid lowellReferenceSurrogateKey, PaymentOptionsVm paymentOptionsVmWithUserEntries, DirectDebitDetailsVm directDebitDetailsVmWithUserEntries, string caseflowUserId) { // // Payment Options - reconstruct from CaseFlow, populate user entris and validate clean // PaymentOptionsVm paymentOptionsVm = await _buildPaymentOptionsVmService.Build(loggedInUser, applicationSessionState, lowellReferenceSurrogateKey, caseflowUserId); _buildPaymentOptionsVmService.UpdateFieldsFromUserEntries(loggedInUser, paymentOptionsVm, paymentOptionsVmWithUserEntries); if (!_paymentOptionsVmValidatorProcess.Validate(paymentOptionsVm)) { return new ValidationResult() { IsValid = false } } ; // // Direct Debit Details - reconstruct from fresh payment options, populate user entris and validate clean // DirectDebitDetailsVm directDebitDetailsVm = _buildDirectDebitDetailsVmService.Build(paymentOptionsVm); _buildDirectDebitDetailsVmService.UpdateFieldsFromUserEntries(directDebitDetailsVm, directDebitDetailsVmWithUserEntries); if (!_directDebitDetailsVmValidatorProcess.Validate(directDebitDetailsVm)) { return new ValidationResult() { IsValid = false } } ; // // Return valid result with overview built clean // return(new ValidationResult() { IsValid = true, DirectDebitPlanOverviewVm = Build(paymentOptionsVm, directDebitDetailsVm) }); } } }
public MyProfileController(ILogger <BaseController> logger, IConfiguration configuration, IMyProfileService myProfileService, IGtmService gtmService, IDistributedCache distributedCache, IApplicationSessionState sessionState, IWebActivityService webActivityService, IAccountsService accountsService, PortalSetting portalSetting) : base(logger, distributedCache, sessionState, configuration) { _myProfileService = myProfileService; _gtmService = gtmService; _webActivityService = webActivityService; _accountsService = accountsService; _portalSetting = portalSetting; }
public async Task <ExpenditureMetrics> GetExpenditureMetrics(IApplicationSessionState sessionState) { ExpenditureMetrics expenditureMetrics = sessionState.GetExpenditureMetrics(); if (expenditureMetrics == null) { var innerUrl = $"{_portalSetting.GatewayEndpoint}api/BudgetCalculator/GetTriggerFigures"; ExpenditureMetricsApiModel apiExpenditureMetrics = await _restClient.GetAsync <ExpenditureMetricsApiModel>(innerUrl); expenditureMetrics = _mapper.Map <ExpenditureMetrics>(apiExpenditureMetrics); sessionState.SaveExpenditureMetrics(expenditureMetrics); } return(expenditureMetrics); }
public MyDocumentsController(ILogger <BaseController> logger, IDistributedCache distributedCache, IApplicationSessionState sessionState, IConfiguration configuration, IDocumentsService documentsService, IAccountsService accountsService, IWebActivityService webActivityService, IMapper mapper, PortalSetting setting) : base(logger, distributedCache, sessionState, configuration) { _documentsService = documentsService; _accountsService = accountsService; _webActivityService = webActivityService; _mapper = mapper; _setting = setting; }
public async Task <bool> AmendDirectDebitPlan(IUserIdentity loggedInUser, IApplicationSessionState applicationSessionState, Guid lowellReferenceSurrogateKey, AmendDirectDebitVm amendDirectDebitVmWithUserEntries, string caseflowUserId) { // Must be a logged in user if (loggedInUser.IsLoggedInUser == false) { throw new ApplicationException("AmendDirectDebitPlan can only be used for a logged in user due to requiring email address."); } // Reload from CaseFlow AmendDirectDebitVm amendDirectDebitVm = await _buildAmendDirectDebitVmService.Build(applicationSessionState, lowellReferenceSurrogateKey, caseflowUserId); // Populate user entries, giving a clean model to validate _buildAmendDirectDebitVmService.UpdateFieldsFromUserEntries(amendDirectDebitVm, amendDirectDebitVmWithUserEntries); if (!_amendDirectDebitVmValidatorProcess.Validate(amendDirectDebitVm)) { return(false); } // Ensure we are not using this - must use clean, validated model (defensive coding) // ReSharper disable once RedundantAssignment amendDirectDebitVmWithUserEntries = null; var directDebitPaymentDto = new DirectDebitPaymentDto { Frequency = _directDebitFrequencyTranslator.TranslateClientScriptCompatibleValueToDescription(amendDirectDebitVm.PlanFrequency), LowellReference = amendDirectDebitVm.LowellReference, PaymentAmount = amendDirectDebitVm.DirectDebitAmount.Value, StartDate = amendDirectDebitVm.PlanStartDate.ToShortDateString(), PlanTotal = amendDirectDebitVm.OutstandingBalance, DiscountAmount = amendDirectDebitVm.DiscountAmount, DiscountAccepted = amendDirectDebitVm.DiscountedBalance < amendDirectDebitVm.OutstandingBalance, EmailAddress = loggedInUser.EmailAddress, User = loggedInUser.IsLoggedInUser ? "WebUser" : "WebAnon" }; await _sendAmendDirectDebitPlanProcess.SendAmendDirectDebitPlanAsync(directDebitPaymentDto); return(true); }
public RegisterController(ILogger <BaseController> logger, IBuildDataProtectionVmService buildDataProtectionVm, IRegisterService registerService, IGtmService gtmService, IWebActivityService webActionLoggingService, IDistributedCache distributedCache, IConfiguration configuration, IApplicationSessionState sessionState, IMapper mapper, IContactLinksService contactLinks) : base(logger, distributedCache, sessionState, configuration) { _buildDataProtectionVm = buildDataProtectionVm; _registerService = registerService; _gtmService = gtmService; _webActivityService = webActionLoggingService; _mapper = mapper; _contactLinks = contactLinks; }
public BudgetCalculatorController(ILogger <BaseController> logger, IConfiguration configuration, IGtmService gtmService, IDistributedCache distributedCache, ICalculatorService calculatorService, IApplicationSessionState sessionState, IWebActivityService webActivityService, ITriggerFigureService triggerFigureService, IBudgetCalculatorService budgetCalculatorService, PortalSetting portalSettings, IMapper mapper) : base(logger, distributedCache, sessionState, configuration) { _gtmService = gtmService; _calculatorService = calculatorService; _budgetCalculatorService = budgetCalculatorService; _portalSettings = portalSettings; _mapper = mapper; _webActivityService = webActivityService; _triggerFigureService = triggerFigureService; }
public ViewTransactionsController(ILogger <BaseController> logger, IConfiguration configuration, ITransactionsService transactionsService, PortalSetting portalSetting, IGtmService gtmService, IPdfGenerator <PdfViewModel> pdfGenerator, IDistributedCache distributedCache, IWebActivityService webActivityService, IMapper mapper, IApplicationSessionState sessionState, IAccountsService accountsService) : base(logger, distributedCache, sessionState, configuration) { _transactionsService = transactionsService; _portalSetting = portalSetting; _pageSize = _portalSetting.PageSizeViewTransactions; _gtmService = gtmService; _webActivityService = webActivityService; _pdfGenerator = pdfGenerator; _mapper = mapper; _accountsService = accountsService; }
public OpenWrksController( ILogger <OpenWrksController> logger, IDistributedCache distributedCache, IConfiguration configuration, OpenWrksSetting openWrksSetting, IApplicationSessionState sessionState, IWebActivityService webActivityService, IAccountsService accountsService, PortalSetting portalSetting, IBudgetCalculatorService budgetCalculatorService, IPortalCryptoAlgorithm cryptoAlgorithm, IOpenWrksService openWrkService) : base(logger, distributedCache, sessionState, configuration) { _openWrksSetting = openWrksSetting; _openWrkService = openWrkService; _webActivityService = webActivityService; _budgetCalculatorService = budgetCalculatorService; _cryptoAlgorithm = cryptoAlgorithm; _accountService = accountsService; _portalSetting = portalSetting; }
// Checks the information entered by the user against CaseFlow afresh // If validation fails, returns false and OneOffPaymentReviewVm will be output as NULL // If successful, returns true and OneOffPaymentReviewVm will be output populated public async Task <IBuildOneOffPaymentReviewVmValidationResult> ValidateAndBuild( IUserIdentity loggedInUser, IApplicationSessionState applicationSessionState, Guid lowellReferenceSurrogateKey, PaymentOptionsVm paymentOptionsVmWithUserEntries, string caseflowUserId) { // Reload from CaseFlow PaymentOptionsVm paymentOptionsVm = await _buildPaymentOptionsVmService.Build(loggedInUser, applicationSessionState, lowellReferenceSurrogateKey, caseflowUserId); // Populate user entries, giving a clean model to validate _buildPaymentOptionsVmService.UpdateFieldsFromUserEntries(loggedInUser, paymentOptionsVm, paymentOptionsVmWithUserEntries); if (!_paymentOptionsVmValidatorProcess.Validate(paymentOptionsVm)) { return new ValidationResult() { IsValid = false } } ; // Ensure we are not using this - must use clean, validated model (defensive coding) // ReSharper disable once RedundantAssignment paymentOptionsVmWithUserEntries = null; var postDataXml = _verifonePaymentProviderService.CreatePayload(paymentOptionsVm); OneOffPaymentReviewVm vm = new OneOffPaymentReviewVm() { LowellReference = paymentOptionsVm.LowellReference, ClientName = paymentOptionsVm.ClientName, VerifoneUrl = _verifoneSetting.ApiEndpoint, VerifonePostDataXml = postDataXml, VerifoneTransactionGuid = paymentOptionsVm.VerifoneTransactionGuid.ToString(), UserID = loggedInUser.UserId, PaidInFull = paymentOptionsVm.SelectedPaymentOption == PaymentOptionsSelectionsVm.Values.FullPayment, DiscountAvailable = paymentOptionsVm.DiscountBalanceAvailable, DiscountSelected = paymentOptionsVm.DiscountAccepted, PlanInPlace = paymentOptionsVm.PlanInPlace, InArrears = !String.IsNullOrEmpty(paymentOptionsVm.ArrearsMessage) }; // Source payment information from appropriate nested object if (paymentOptionsVm.SelectedPaymentOption == PaymentOptionsSelectionsVm.Values.FullPayment) { vm.PaymentAmount = paymentOptionsVm.FullPaymentAmountDerived; vm.SourceOfFunds = paymentOptionsVm.FullPaymentSelectedSourceOfFunds; vm.SourceOfFundsOther = paymentOptionsVm.FullPaymentSourceOfFundsOtherText; vm.PaidInFull = true; } else if (paymentOptionsVm.SelectedPaymentOption == PaymentOptionsSelectionsVm.Values.PartialPayment) { Debug.Assert(paymentOptionsVm.PartialPaymentAmount != null, "paymentOptionsVmWithUserEntries.PartialPaymentAmount != null"); vm.PaymentAmount = paymentOptionsVm.PartialPaymentAmount.Value; vm.SourceOfFunds = paymentOptionsVm.PartialPaymentSelectedSourceOfFunds; vm.SourceOfFundsOther = paymentOptionsVm.PartialPaymentSourceOfFundsOtherText; } else { throw new ApplicationException("Invalid SelectedPaymentOption"); } return(new ValidationResult() { IsValid = true, OneOffPaymentReviewVm = vm }); } }
public async Task <PaymentOptionsVm> Build(IUserIdentity loggedInUser, IApplicationSessionState applicationSessionState, Guid lowellReferenceSurrogateKey, string caseflowUserId) { string lowellReference = applicationSessionState.GetLowellReferenceFromSurrogate(lowellReferenceSurrogateKey); AccountReferenceDto accountReferenceDto = new AccountReferenceDto() { LowellReference = lowellReference }; PaymentOptionsDto paymentOptionsDto = await _apiGatewayProxy.GetPaymentOptions(accountReferenceDto); IncomeAndExpenditureApiModel incomeAndExpenditureDto = await _apiGatewayProxy.GetIncomeAndExpenditure(lowellReference); List <AccountSummary> accounts; if (caseflowUserId != null) { accounts = await _accountsService.GetAccounts(caseflowUserId); } else { accounts = await _accountsService.GetMyAccountsSummary(lowellReference); } var workingAccounts = accounts.Count(a => !a.AccountStatusIsClosed); if (workingAccounts == 0) { workingAccounts = 1; } var accountDetails = await _accountsService.GetAccount(caseflowUserId, lowellReference); string[] planMessages = accountDetails.PlanMessages; var paymentOptionsVm = new PaymentOptionsVm() { OutstandingBalance = paymentOptionsDto.OutstandingBalance, LowellReference = paymentOptionsDto.LowellReference, ClientName = paymentOptionsDto.ClientName, ExcludedAccountMessage = paymentOptionsDto.ExcludedAccountMessage, PlanInPlace = paymentOptionsDto.PlanInPlace, PlanIsDirectDebit = paymentOptionsDto.PaymentPlanIsDirectDebit, WithLowellSolicitors = paymentOptionsDto.WithLowellSolicitors, PaymentOptions = new List <PaymentOptionsSelectionsVm>(), DiscountPercentage = paymentOptionsDto.DiscountPercentage, DiscountAmount = paymentOptionsDto.DiscountAmount, DiscountExpiryDate = paymentOptionsDto.DiscountExpiryDate, DiscountedBalance = paymentOptionsDto.DiscountedBalance, DiscountBalanceAvailable = paymentOptionsDto.DiscountBalanceAvailable, ProposedDiscountedBalanceIfAccepted = paymentOptionsDto.ProposedDiscountedBalanceIfAccepted, DiscountedBalancePreviouslyAccepted = paymentOptionsDto.DiscountedBalancePreviouslyAccepted, ArrearsMessage = _arrearsDescriptionProcess.DeriveArrearsDetail(paymentOptionsDto.PaymentPlanArrearsAmount, paymentOptionsDto.PaymentPlanIsAutomated), StandingOrder = paymentOptionsDto.StandingOrder, StandingOrderMessage = paymentOptionsDto.StandingOrderMessage, VerifoneTransactionGuid = $"{paymentOptionsDto.LowellReference}_{Guid.NewGuid()}", DiscountAccepted = paymentOptionsDto.DiscountedBalancePreviouslyAccepted, PlanMessage = planMessages != null && planMessages.Length > 0? planMessages[0]:string.Empty }; if (loggedInUser.IsLoggedInUser) { paymentOptionsVm.DirectDebitEmailAddress = loggedInUser.EmailAddress; } else { paymentOptionsVm.DirectDebitIsEmailAddressFieldVisible = true; } // Logged in user has accept T&C defaulted and will be hidden. // Anon user has tick box displayed. Must be ticked. if (loggedInUser.IsLoggedInUser) { paymentOptionsVm.AcceptTermsAndConditions = true; } else { paymentOptionsVm.IsAcceptTermsAndConditionsFieldVisible = true; } // Work out amount that needs to be paid to clear balance if (paymentOptionsVm.DiscountedBalancePreviouslyAccepted) { paymentOptionsVm.FullPaymentBalance = paymentOptionsVm.DiscountedBalance; } else { paymentOptionsVm.FullPaymentBalance = paymentOptionsVm.OutstandingBalance; } // Customer has a plan but it isn't direct debit. // Used to display a message informing customer that they can change to a DD online. if (paymentOptionsDto.PlanInPlace && !paymentOptionsDto.PaymentPlanIsDirectDebit) { paymentOptionsVm.HasNonDirectDebitPlanInPlace = true; } if (paymentOptionsDto.WithLowellSolicitors) { paymentOptionsVm.LowellSolicitorsRedirectLink = _portalSetting.SolicitorsRedirectDataProtectionUrl; } // Shared list of options for partial / full paymentOptionsVm.SourceOfFunds = BuildSourceOfFundsSelections(paymentOptionsDto); // Direct Debit paymentOptionsVm.DirectDebitFrequency = BuildFrequencyList(paymentOptionsDto.DirectDebitFrequencies); paymentOptionsVm.DirectDebitStartDateEarliest = paymentOptionsDto.DirectDebitStartDateEarliest; paymentOptionsVm.DirectDebitStartDateLatest = paymentOptionsDto.DirectDebitStartDateLatest; // TODO: Wrap the code below in a strategy pattern if (paymentOptionsDto.CanMakeFullPayment) { paymentOptionsVm.PaymentOptions.Add(new PaymentOptionsSelectionsVm() { DisplayedText = "Card payment (Pay in Full)", Value = PaymentOptionsSelectionsVm.Values.FullPayment, DataFormValue = PaymentOptionsSelectionsVm.Values.FullPayment }); } if (paymentOptionsDto.CanMakePartialPayment) { paymentOptionsVm.PaymentOptions.Add(new PaymentOptionsSelectionsVm() { DisplayedText = "Card payment (Partial amount)", Value = PaymentOptionsSelectionsVm.Values.PartialPayment, DataFormValue = PaymentOptionsSelectionsVm.Values.PartialPayment, ClassValue = "js-hide-option" // script hides this }); } if (paymentOptionsDto.CanSetupDirectDebit) { paymentOptionsVm.PaymentOptions.Add(new PaymentOptionsSelectionsVm() { DisplayedText = "Direct Debit plan", Value = PaymentOptionsSelectionsVm.Values.DirectDebit, DataFormValue = PaymentOptionsSelectionsVm.Values.DirectDebit }); } // Only add 'please select' if there are options // Required because view checks for availability of payment options if (paymentOptionsVm.PaymentOptions.Count > 0) { paymentOptionsVm.PaymentOptions.Insert(0, new PaymentOptionsSelectionsVm() { DisplayedText = "Please Select", Value = PaymentOptionsSelectionsVm.Values.PleaseSelect, DataFormValue = PaymentOptionsSelectionsVm.Values.PleaseSelect }); } paymentOptionsVm.LowellReferenceSurrogate = lowellReferenceSurrogateKey; paymentOptionsVm.IandENotAvailable = incomeAndExpenditureDto == null; paymentOptionsVm.IandELessThanOrIs12MonthsOld = (incomeAndExpenditureDto != null && incomeAndExpenditureDto.Created.AddMonths(12).Date >= DateTime.Now.Date); paymentOptionsVm.AverageMonthlyPayment = _portalSetting.AverageMonthlyPaymentAmount; paymentOptionsVm.MonthlyDisposableIncome = (incomeAndExpenditureDto == null ? 0 : (incomeAndExpenditureDto.DisposableIncome * (_portalSetting.MonthlyDisposableIncomePlanSetupPercentage / 100))); paymentOptionsVm.AccountCount = workingAccounts; paymentOptionsVm.MonthlyDisposableIncomePerAccount = paymentOptionsVm.MonthlyDisposableIncome / workingAccounts; return(paymentOptionsVm); }