示例#1
0
        public List <ApiChecksLogModel> Create(EZBob.DatabaseLib.Model.Database.Customer customer)
        {
            var models = new List <ApiChecksLogModel>();

            var postCode = _postcodeServiceLog.GetByCustomer(customer);
            var customerMarketPlaceHistory = _mpCustomerMarketPlaceUpdatingHistory
                                             .GetByCustomer(customer)
                                             .Select(c => new
            {
                history         = c,
                marketplaceType = c.CustomerMarketPlace.Marketplace.Name,
                displayName     = c.CustomerMarketPlace.DisplayName
            });
            var eseriasLog = _serviceLogRepository.GetByCustomer(customer);
            var pacnetLog  = _pacnetPaypointServiceLogRepository.GetByCustomerId(customer.Id);

            models.AddRange(postCode.Select(val => new ApiChecksLogModel
            {
                ApiType      = "Postcode",
                DateTime     = val.InsertDate,
                ErrorMessage = val.ErrorMessage,
                Status       = val.Status
            }));

            models.AddRange(customerMarketPlaceHistory.Select(val => new ApiChecksLogModel
            {
                ApiType      = val.marketplaceType,
                DateTime     = val.history.UpdatingStart,
                ErrorMessage = val.history.Error,
                Status       = string.IsNullOrEmpty(val.history.Error) ? "Successful" : "Failed",
                Marketplace  = val.displayName
            }));

            models.AddRange(eseriasLog.Select(val => new ApiChecksLogModel
            {
                ApiType      = val.ServiceType,
                DateTime     = val.InsertDate,
                ErrorMessage = "",
                Status       = "Successful"
            }));

            models.AddRange(pacnetLog.Select(val => new ApiChecksLogModel
            {
                ApiType      = val.RequestType,
                DateTime     = val.InsertDate,
                ErrorMessage = val.ErrorMessage,
                Status       = val.Status
            }));

            models = new List <ApiChecksLogModel>(models.OrderByDescending(x => x.DateTime));

            return(models);
        }
示例#2
0
        public void FromCustomer(EZBob.DatabaseLib.Model.Database.Customer customer)
        {
            PersonalModel = new PersonalModel {
                ID           = customer.Id,
                Email        = customer.Name,
                Name         = customer.PersonalInfo != null ? customer.PersonalInfo.Fullname : string.Empty,
                FraudStatus  = customer.FraudStatus.ToString(),
                CreditStatus = customer.CreditResult != null?customer.CreditResult.ToString() : string.Empty,
                                   AmlScore          = customer.AmlScore,
                                   AmlDescription    = customer.AmlDescription,
                                   IsPendingDecision = customer.CreditResult.HasValue &&
                                                       customer.CreditResult.Value == CreditResultStatus.ApprovedPending &&
                                                       (!customer.IsWaitingForSignature.HasValue || (!customer.IsWaitingForSignature.Value)),
                                   TypeOfBusiness = customer.PersonalInfo != null?customer.PersonalInfo.TypeOfBusiness.DescriptionAttr() : string.Empty,
                                                        PromoCode = customer.PromoCode
            };

            if (customer.Company != null)
            {
                PersonalModel.CompanyName      = string.IsNullOrEmpty(customer.Company.ExperianCompanyName) ? customer.Company.CompanyName : customer.Company.ExperianCompanyName;
                PersonalModel.CompanyRefNumber = string.IsNullOrEmpty(customer.Company.ExperianRefNum) ? customer.Company.CompanyNumber : customer.Company.ExperianRefNum;
            }

            if (customer.IsWaitingForSignature.HasValue && customer.IsWaitingForSignature.Value)
            {
                PersonalModel.CreditStatus += " (Signatures)";
            }

            MarketPlaces = customer
                           .CustomerMarketPlaces
                           .Where(x => x.Disabled == false)
                           .Select(x => new SalesForceMarketPlaceModel {
                Created     = x.Created,
                MpName      = x.Marketplace.Name,
                displayName = x.DisplayName,
                UpdateError = x.UpdateError,
                Updated     = x.UpdatingEnd
            })
                           .ToList();

            Loans = customer
                    .Loans
                    .Select(LoanHistoryModel.Create)
                    .OrderBy(x => x.DateApplied)
                    .ToList();
        }
示例#3
0
        private bool AddPayPointCardToCustomer(string transactionid, string cardno, EZBob.DatabaseLib.Model.Database.Customer customer, string expiry, decimal?amount, PayPointAccount account)
        {
            bool paymentAdded = false;

            customer.TryAddPayPointCard(transactionid, cardno, expiry, customer.PersonalInfo.Fullname, account);

            bool hasOpenLoans = customer.Loans.Any(x => x.Status != LoanStatus.PaidOff);

            if (amount > 0 && hasOpenLoans)
            {
                Loan loan = customer.Loans.First(x => x.Status != LoanStatus.PaidOff);

                var nlPayment = new NL_Payments()
                {
                    Amount          = amount.Value,
                    CreatedByUserID = this.context.UserId,
                    //CreationTime = DateTime.UtcNow,
                    //	LoanID = nlLoanId,
                    //PaymentTime = DateTime.UtcNow,
                    Notes = "Add paypoint card",
                    //PaymentStatusID = (int)NLPaymentStatuses.Active,
                    PaymentMethodID   = (int)NLLoanTransactionMethods.SystemRepay,
                    PaymentSystemType = NLPaymentSystemTypes.Paypoint
                };

                var f = new LoanPaymentFacade();
                f.PayLoan(loan, transactionid, amount.Value, Request.UserHostAddress, DateTime.UtcNow, "system-repay", false, null, nlPayment);

                paymentAdded = true;
            }

            if (amount > 0 && !hasOpenLoans)
            {
                this.serviceClient.Instance.PayPointAddedWithoutOpenLoan(customer.Id, this.context.UserId, amount.Value, transactionid);
            }

            this.serviceClient.Instance.PayPointAddedByUnderwriter(customer.Id, cardno, this.context.User.FullName, this.context.User.Id);

            return(paymentAdded);
        }
示例#4
0
        public ApplyForLoanResultModel(EZBob.DatabaseLib.Model.Database.Customer customer, bool bDirectApplication)
        {
            if (customer == null)
            {
                error = "Please log out and log in again.";
                ms_oLog.Debug("Apply for a loan requested but no customer in the current context.");
                return;
            }             // if

            error = string.Empty;

            if (!bDirectApplication)
            {
                try {
                    AccountsToUpdateActionResult atuar = new ServiceClient().Instance.FindAccountsToUpdate(customer.Id);
                    m_oAccountInfo = atuar.AccountInfo;
                }
                catch (Exception e) {
                    ms_oLog.Warn(e, "Something went erroneously while looking for accounts to update.");
                }         // try
            }             // if

            ms_oLog.Debug("Apply for a loan from customer {0}: {1}.", customer.Stringify(), this);
        }         // constructor
示例#5
0
        public MedalCalculators(EZBob.DatabaseLib.Model.Database.Customer customer)
        {
            var serviceClient = ObjectFactory.GetInstance <ServiceClient>();
            var newRepo       = ObjectFactory.GetInstance <MedalCalculationsRepository>();
            var oldRepo       = ObjectFactory.GetInstance <ScoringResultRepository>();
            var context       = ObjectFactory.GetInstance <IEzbobWorkplaceContext>();
            var oldMedals     = oldRepo.GetAllOldMedals(customer.Id).ToList();
            var newMedals     = newRepo.GetAllNewMedals(customer.Id).ToList();

            if (oldMedals.Count == 0 && newMedals.Count == 0)
            {
                return;
            }

            var newMedalHistories = newMedals.Select(BuildNewScore).ToList();

            DateTime?firstNewMedalDate = null;

            if (newMedalHistories.Any())
            {
                firstNewMedalDate = newMedalHistories.Min(x => x.Date);
            }
            var oldMedalHistories = oldMedals.Where(x => firstNewMedalDate == null || x.ScoreDate < firstNewMedalDate).Select(BuildScore);

            newMedalHistories.AddRange(oldMedalHistories);
            this.History.MedalHistories = newMedalHistories.OrderBy(x => x.Date);

            var activeMedal = newMedals.FirstOrDefault(x => x.IsActive);

            if (activeMedal != null)
            {
                this.Score = BuildNewScore(activeMedal);
            }
            else if (oldMedals.Any())
            {
                var maxdate       = oldMedals.Max(s => s.ScoreDate);
                var scoringResult = oldMedals.FirstOrDefault(s => s.ScoreDate == maxdate);
                this.Score = BuildScore(scoringResult);
            }
            else
            {
                this.Score = new Score();
            }

            var details         = new MedalDetailedHistory();
            var oldMedalDetails = oldMedals.Select(BuildCharecteristic).ToList();
            var newMedalDetails = newMedals.Select(BuildNewCharecteristics).ToList();

            oldMedalDetails.AddRange(newMedalDetails);
            details.MedalDetailsHistories = oldMedalDetails.OrderByDescending(x => x.Score.Date);

            int i = 0;

            foreach (var medalDetail in details.MedalDetailsHistories)
            {
                medalDetail.Score.Id = i;
                i++;
            }

            this.DetailedHistory = details;

            this.LogicalGlue        = serviceClient.Instance.LogicalGlueGetLastInference(context.UserId, customer.Id, DateTime.UtcNow, false);
            this.LogicalGlueHistory = serviceClient.Instance.LogicalGlueGetHistory(context.UserId, customer.Id);
        }
 public void SetUp()
 {
     _customer = new EZBob.DatabaseLib.Model.Database.Customer();
     _now      = DateTime.UtcNow;
 }