Beispiel #1
0
 public IActionResult GetAvailableCardsForCreditLine(ProductQualityFilterRequest request)
 {
     if (ModelState.IsValid)
     {
         var authorizedCustomer = _cacheHelper.GetAuthorizedCustomer();
         var response           = new SingleResponse <List <Card> >()
         {
             ResultCode = ResultCodes.normal
         };
         response.Result = _xbService.GetAvailableCardsForCreditLine(request.Filter);
         if (authorizedCustomer.LimitedAccess != 0)
         {
             response.Result.RemoveAll(m => !_xbService.HasProductPermission(m.CardAccount.AccountNumber, (ulong)m.ProductId));
         }
         foreach (var card in response.Result)
         {
             if (card.CardNumber != null)
             {
                 card.ArCaBalance = _xbService.GetArcaBalance(card.CardNumber);
                 if (card.CardAccount.AccountNumber == "220000295380000" && Convert.ToBoolean(_config["TestVersion"]))
                 {
                     card.ArCaBalance = null;
                 }
             }
         }
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
        public IActionResult GetDeposits(ProductQualityFilterRequest request)
        {
            if (ModelState.IsValid)
            {
                var authorizedCustomer = _cacheHelper.GetAuthorizedCustomer();
                SingleResponse <List <Deposit> > response = new SingleResponse <List <Deposit> >()
                {
                    ResultCode = ResultCodes.normal
                };
                response.Result = _xbService.GetDeposits(request.Filter);
                if (authorizedCustomer.LimitedAccess != 0)
                {
                    response.Result.RemoveAll(m => _xbService.HasProductPermission(m.DepositAccount.AccountNumber, (ulong)m.ProductId));
                }

                Parallel.ForEach(response.Result, dep =>
                {
                    dep.ProductNote = _xbService.GetProductNote(Convert.ToDouble(dep.ProductId));
                });

                return(ResponseExtensions.ToHttpResponse(response));
            }
            else
            {
                return(ValidationError.GetValidationErrorResponse(ModelState));
            }
        }
Beispiel #3
0
        public IActionResult GetCards(ProductQualityFilterRequest request)
        {
            if (ModelState.IsValid)
            {
                var authorizedCustomer = _cacheHelper.GetAuthorizedCustomer();

                SingleResponse <List <Card> > response = new SingleResponse <List <Card> >()
                {
                    ResultCode = ResultCodes.normal
                };
                List <Card> cards = _xbService.GetCards(request.Filter);
                if (request.Filter == ProductQualityFilter.Closed)
                {
                    cards = _xbService.GetClosedCardsForDigitalBanking();
                }
                else
                {
                    cards = _xbService.GetCards(request.Filter);
                    if (request.Filter == ProductQualityFilter.All)
                    {
                        cards.RemoveAll(m => m.ClosingDate != null);
                        cards.AddRange(_xbService.GetClosedCardsForDigitalBanking());
                        cards.AddRange(_xbService.GetnotActivatedVirtualCards());
                    }
                    cards.AddRange(_xbService.GetLinkedCards());
                }

                foreach (var card in cards)
                {
                    if (card.CardNumber != null)
                    {
                        card.ArCaBalance             = _xbService.GetArcaBalance(card.CardNumber);
                        card.CardAccount.ArcaBalance = card.ArCaBalance;
                        if (card.CardAccount.AccountNumber == "220000295380000" && Convert.ToBoolean(_config["TestVersion"]))
                        {
                            card.ArCaBalance = null;
                        }
                        card.CVVNote     = _xbService.GetCVVNote((ulong)card.ProductId);
                        card.FilialName  = _xBInfoService.GetFilialName(card.FilialCode);
                        card.ProductNote = _xbService.GetProductNote(card.ProductId);
                        if (card.Type == 51)  //VISA VIRTUAL
                        {
                            card.RealCVV = _xbService.GetVirtualCardDetails(card.CardNumber)?.Cvv;
                        }
                    }
                }
                response.Result = cards;
                if (authorizedCustomer.LimitedAccess != 0)
                {
                    response.Result.RemoveAll(m => !_xbService.HasProductPermission(m.CardAccount.AccountNumber, (ulong)m.ProductId));
                }
                return(ResponseExtensions.ToHttpResponse(response));
            }
            else
            {
                return(ValidationError.GetValidationErrorResponse(ModelState));
            }
        }
        public IActionResult GetCreditLines(ProductQualityFilterRequest request)
        {
            if (ModelState.IsValid)
            {
                SingleResponse <List <CreditLine> > response = new SingleResponse <List <CreditLine> >();
                response.Result = _xbService.GetCreditLines(request.Filter);
                response.Result.RemoveAll(m => m.Type == 25 || m.Type == 18 || m.Type == 46 || m.Type == 36 || m.Type == 60);
                Parallel.ForEach(response.Result, x => x.HasContractFile = _xbService.HasUploadedContract(x.LoanAccount.AccountNumber, 1));
                Parallel.ForEach(response.Result, item =>
                {
                    List <CreditLineGrafik> grafik = _xbService.GetCreditLineGrafik((ulong)item.ProductId);
                    if (grafik.Count != 0)
                    {
                        grafik.Sort((x, y) => x.EndDate.CompareTo(y.EndDate));
                        var selectedRow = grafik.Find(x => x.EndDate >= _xbService.GetNextOperDay() && x.Amount - x.MaturedAmount > 0);

                        if (selectedRow != null)
                        {
                            item.NextRepaymentAmount = selectedRow.Amount - selectedRow.MaturedAmount;
                            item.NextRepaymentDate   = selectedRow.EndDate;
                        }
                    }
                    if (!string.IsNullOrWhiteSpace(item.CardNumber))
                    {
                        item.CardSystem = _xbService.GetCardSystem(item.CardNumber);
                    }
                    if (!string.IsNullOrWhiteSpace(item.LoanAccount.ProductNumber))
                    {
                        item.LoanAccount.CardSystem = _xbService.GetCardSystem(item.LoanAccount.ProductNumber);
                    }

                    item.TotalDebt = Math.Abs(item.Quality == 11 || item.Quality == 12 ? item.OutCapital : item.CurrentCapital)
                                     + Math.Abs(item.CurrentRateValue) + Math.Abs(item.PenaltyAdd) + item.JudgmentRate;
                    if ((!string.IsNullOrWhiteSpace(item.CardNumber)) && item.CardNumber != "0")
                    {
                        CreditLine overdraft = _xbService.GetCardOverDraft(item.CardNumber);
                        item.CardOverdraft   = Math.Abs(overdraft.Quality == 11 || overdraft.Quality == 12 ? overdraft.OutCapital : overdraft.CurrentCapital)
                                               + Math.Abs(overdraft.CurrentRateValue) + Math.Abs(overdraft.PenaltyAdd) + overdraft.JudgmentRate;
                        item.TotalDebt += item.CardOverdraft;
                    }

                    item.PenaltyAdd -= item.JudgmentRate;
                });
                response.ResultCode = ResultCodes.normal;
                return(ResponseExtensions.ToHttpResponse(response));
            }
            else
            {
                return(ValidationError.GetValidationErrorResponse(ModelState));
            }
        }
 public IActionResult GetCurrentAccountOverdrafts(ProductQualityFilterRequest request)
 {
     if (ModelState.IsValid)
     {
         SingleResponse <List <CreditLine> > response = new SingleResponse <List <CreditLine> >();
         response.Result     = _xbService.GetCreditLines(request.Filter);
         response.Result     = response.Result.FindAll(m => m.Type == 25 || m.Type == 18 || m.Type == 46 || m.Type == 36 || m.Type == 60);
         response.ResultCode = ResultCodes.normal;
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
Beispiel #6
0
 public IActionResult GetFactorings(ProductQualityFilterRequest request)
 {
     if (ModelState.IsValid)
     {
         var response = new SingleResponse <List <Factoring> >()
         {
             ResultCode = ResultCodes.normal
         };
         response.Result = _xbService.GetFactorings(request.Filter);
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
 public IActionResult GetCurrentAccounts(ProductQualityFilterRequest request)
 {
     if (ModelState.IsValid)
     {
         var authorizedCustomer = _cacheHelper.GetAuthorizedCustomer();
         SingleResponse <List <Account> > response = new SingleResponse <List <Account> >()
         {
             ResultCode = ResultCodes.normal
         };
         response.Result = _xbService.GetCurrentAccounts(request.Filter);
         if (authorizedCustomer.LimitedAccess != 0)
         {
             response.Result.RemoveAll(m => !_xbService.HasProductPermission(m.AccountNumber));
         }
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
Beispiel #8
0
        public IActionResult GetLoans(ProductQualityFilterRequest request)
        {
            if (ModelState.IsValid)
            {
                var authorizedCustomer = _cacheHelper.GetAuthorizedCustomer();
                var response           = new SingleResponse <List <Loan> >()
                {
                    ResultCode = ResultCodes.normal
                };
                response.Result = _xbService.GetLoans(request.Filter);
                if (authorizedCustomer.LimitedAccess != 0)
                {
                    response.Result.RemoveAll(m => !_xbService.HasProductPermissionByProductID((ulong)m.ProductId));
                }
                response.Result.RemoveAll(m => m.Quality == 10 && !m.Is_24_7);

                foreach (Loan loan in response.Result)
                {
                    if (loan.ContractDate != null)
                    {
                        loan.StartDate = loan.ContractDate ?? loan.StartDate;
                    }

                    if (loan.Is_24_7)
                    {
                        loan.CurrentCapital = loan.ContractAmount;
                    }
                }

                Parallel.ForEach(response.Result, x => x.HasContractFile = _xbService.HasUploadedContract(x.LoanAccount.AccountNumber, 0));

                return(ResponseExtensions.ToHttpResponse(response));
            }
            else
            {
                return(ValidationError.GetValidationErrorResponse(ModelState));
            }
        }
 public IActionResult GetPeriodicTransfers(ProductQualityFilterRequest request)
 {
     if (ModelState.IsValid)
     {
         var authorizedCustomer = _cacheHelper.GetAuthorizedCustomer();
         var response           = new SingleResponse <List <PeriodicTransfer> >()
         {
             ResultCode = ResultCodes.normal
         };
         var result = _xbService.GetPeriodicTransfers(request.Filter);
         result.RemoveAll(x => x.Type == 9);
         if (authorizedCustomer.LimitedAccess != 0)
         {
             response.Result.RemoveAll(m => !_xbService.HasProductPermissionByProductID(m.ProductId));
         }
         result.ForEach(m =>
         {
             if (m.FeeAccount != null && (m.FeeAccount.AccountNumber == "0" || m.FeeAccount.AccountNumber == null || m.FeeAccount.AccountNumber == "-1"))
             {
                 m.FeeAccount = null;
             }
             if (m.ChargeType == 0)
             {
                 m.ChargeType = 1;
             }
             else
             {
                 m.ChargeType = 2;
             }
         });
         response.Result = result;
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }