public IActionResult GetCardsForNewCreditLine(OrderTypeRequest request)
 {
     if (ModelState.IsValid)
     {
         SingleResponse <List <Card> > response = new SingleResponse <List <Card> >();
         response.Result = _xbService.GetCardsForNewCreditLine(request.OrderType);
         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;
                 }
             }
         }
         response.ResultCode = ResultCodes.normal;
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
Ejemplo n.º 2
0
 public IActionResult GetReceivedFastTransferPaymentOrder(IdRequest request)
 {
     if (ModelState.IsValid)
     {
         SingleResponse <ReceivedFastTransferPaymentOrder> response = new SingleResponse <ReceivedFastTransferPaymentOrder>
         {
             Result = _xBService.GetReceivedFastTransferPaymentOrder(request.Id)
         };
         //քարտային հաշիվների դեպքում
         if (response.Result.ReceiverAccount.AccountType == 11)
         {
             response.Result.ReceiverAccount.ArcaBalance = _xBService.GetArcaBalance(response.Result.ReceiverAccount.ProductNumber
                                                                                     .Substring(0, 16)
                                                                                     .Trim());
             if (response.Result.ReceiverAccount.AccountNumber == "220000295380000" && Convert.ToBoolean(_config["TestVersion"]))
             {
                 response.Result.ReceiverAccount.ArcaBalance = null;
             }
         }
         response.ResultCode = ResultCodes.normal;
         if (response.Result.Quality == OrderQuality.Declined)
         {
             response.Result.RejectReason = _xBService.GetOrderRejectReason(request.Id, response.Result.Type);
         }
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
Ejemplo n.º 3
0
 public IActionResult GetAccounts()
 {
     if (ModelState.IsValid)
     {
         SingleResponse <List <Account> > response = new SingleResponse <List <Account> >();
         response.ResultCode = ResultCodes.normal;
         response.Result     = _xbService.GetAccounts();
         Parallel.ForEach(response.Result, x => x.HasContractFile = _xbService.HasUploadedContract(x.AccountNumber, 3));
         Parallel.ForEach(response.Result, m =>
         {
             if (m.AccountType == 11)
             {
                 m.ArcaBalance = _xbService.GetArcaBalance(m.AccountDescription.Substring(0, 16).Trim());
                 if (m.AccountNumber == "220000295380000" && Convert.ToBoolean(_config["TestVersion"]))
                 {
                     m.ArcaBalance = null;
                 }
             }
         });
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
Ejemplo n.º 4
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));
            }
        }
Ejemplo n.º 5
0
        public IActionResult GetIBankingHomePage()
        {
            if (ModelState.IsValid)
            {
                var response = new SingleResponse <IBankingHomePage>()
                {
                    ResultCode = ResultCodes.normal
                };
                var        result        = _xbService.GetIBankingHomePage();
                SourceType sourceType    = _cacheHelper.GetSourceType();
                int        productsCount = 0;
                if (sourceType == SourceType.MobileBanking)
                {
                    productsCount = 1;
                }


                if (result.Loans.Content != null && result.Loans.Content.Count > 0)
                {
                    result.Loans.Content.RemoveAll(m => m.Quality == 10 && !m.Is_24_7);
                }


                if (result.Accounts.Content != null && result.Accounts.Content.Count > 0)
                {
                    Parallel.ForEach(result.Accounts.Content, x => {
                        x.DigitalAvailabelBanlanaceAMD = _xbService.GetLastExchangeRate(x.Currency, 2, 2) * x.AvailableBalance;
                    });
                    if (sourceType != SourceType.MobileBanking)
                    {
                        productsCount = result.Accounts.Content.Count;
                    }
                    result.Accounts.Content = result.Accounts.Content.OrderByDescending(x => x.DigitalAvailabelBanlanaceAMD).Take(productsCount).ToList();
                }

                if (result.Cards.Content != null && result.Cards.Content.Count > 0)
                {
                    result.Cards.Content.RemoveAll(x => x.SupplementaryType != SupplementaryType.Main);
                    foreach (var item in result.Cards.Content)
                    {
                        item.ArCaBalance             = _xbService.GetArcaBalance(item.CardNumber);
                        item.CardAccount.ArcaBalance = item.ArCaBalance;
                    }


                    Parallel.ForEach(result.Cards.Content, x =>
                    {
                        if (x.ArCaBalance.HasValue)
                        {
                            x.DigitalAvailabelBanlanaceAMD = _xbService.GetLastExchangeRate(x.Currency, 2, 2) * x.ArCaBalance.Value;
                        }
                        else
                        {
                            x.DigitalAvailabelBanlanaceAMD = null;
                        }
                    });

                    if (sourceType != SourceType.MobileBanking)
                    {
                        productsCount = result.Cards.Content.Count;
                    }
                    result.Cards.Content = result.Cards.Content.OrderByDescending(x => x.DigitalAvailabelBanlanaceAMD).Take(productsCount).ToList();
                }

                if (result.Deposits.Content != null && result.Deposits.Content.Count > 0)
                {
                    Parallel.ForEach(result.Deposits.Content, x => {
                        x.DigitalAvailabelBanlanaceAMD = _xbService.GetLastExchangeRate(x.Currency, 2, 2) * x.Balance;
                    });
                    if (sourceType != SourceType.MobileBanking)
                    {
                        productsCount = result.Deposits.Content.Count;
                    }
                    result.Deposits.Content = result.Deposits.Content.OrderByDescending(x => x.DigitalAvailabelBanlanaceAMD).Take(productsCount).ToList();
                }

                if (result.Loans.Content != null && result.Loans.Content.Count > 0)
                {
                    foreach (Loan loan in result.Loans.Content)
                    {
                        if (loan.ContractDate != null)
                        {
                            loan.StartDate = loan.ContractDate ?? loan.StartDate;
                        }

                        if (loan.Is_24_7)
                        {
                            loan.CurrentCapital = loan.ContractAmount;
                        }
                    }
                    if (sourceType != SourceType.MobileBanking)
                    {
                        productsCount = result.Loans.Content.Count;
                    }
                    result.Loans.Content = result.Loans.Content.OrderByDescending(x => x.NextRepayment.RepaymentDate).Take(productsCount).ToList();
                }
                response.Result = result;
                return(ResponseExtensions.ToHttpResponse(response));
            }
            else
            {
                return(ValidationError.GetValidationErrorResponse(ModelState));
            }
        }