Exemplo n.º 1
0
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            if (context.ActionArguments.Count != 0)
            {
                ulong productId = 0;
                var   argument  = context.ActionArguments.Values.First();
                if (argument is ProductIdRequest)
                {
                    ProductIdRequest idRequest = argument as ProductIdRequest;
                    productId = idRequest.ProductId;
                }
                else if (argument is CVVNoteRequest)
                {
                    CVVNoteRequest idRequest = argument as CVVNoteRequest;
                    productId = idRequest.ProductId;
                }

                if (!_xbService.ValidateProductId(productId, _type))
                {
                    Response response = new Response
                    {
                        ResultCode  = ResultCodes.validationError,
                        Description = _localizer["Պրոդուկտի ունիկալ համարը սխալ է։"]
                    };
                    context.Result = ResponseExtensions.ToHttpResponse(response);
                }
            }
        }
Exemplo n.º 2
0
        public IActionResult GetLoan(ProductIdRequest request)
        {
            if (ModelState.IsValid)
            {
                var response = new SingleResponse <Loan>()
                {
                    ResultCode = ResultCodes.normal
                };
                response.Result = _xbService.GetLoan(request.ProductId);
                response.Result.HasContractFile = _xbService.HasUploadedContract(response.Result.LoanAccount.AccountNumber, 0);

                List <ProductOtherFee> fees = new List <ProductOtherFee>();
                fees = _xbService.GetProductOtherFees(response.Result.ProductId).Where(x => x.Type == 1).ToList();

                if (fees.Count > 0)
                {
                    response.Result.RepaymentAmount = fees[0].Amount;
                }



                return(ResponseExtensions.ToHttpResponse(response));
            }
            else
            {
                return(ValidationError.GetValidationErrorResponse(ModelState));
            }
        }
        public IActionResult GetPeriodicTransfer(ProductIdRequest request)
        {
            if (ModelState.IsValid)
            {
                var response = new SingleResponse <PeriodicTransfer>()
                {
                    ResultCode = ResultCodes.normal
                };
                response.Result = _xbService.GetPeriodicTransfer(request.ProductId);
                if (response.Result != null)
                {
                    if (response.Result.FeeAccount != null && (response.Result.FeeAccount.AccountNumber == "0" || response.Result.FeeAccount.AccountNumber == null))
                    {
                        response.Result.FeeAccount = null;
                    }
                    if (response.Result.ChargeType == 0)
                    {
                        response.Result.ChargeType = 1;
                    }
                    else
                    {
                        response.Result.ChargeType = 2;
                    }
                }

                return(ResponseExtensions.ToHttpResponse(response));
            }
            else
            {
                return(ValidationError.GetValidationErrorResponse(ModelState));
            }
        }
Exemplo n.º 4
0
        public IActionResult GetCard(ProductIdRequest request)
        {
            if (ModelState.IsValid)
            {
                SingleResponse <Card> response = new SingleResponse <Card>()
                {
                    ResultCode = ResultCodes.normal
                };
                Card card = new Card();
                card            = _xbService.GetCard(request.ProductId);
                card.CardStatus = _xbService.GetCardStatus(request.ProductId);
                if (card.CardStatus.StatusDescription == "ՏՐ")
                {
                    card.CardStatus.StatusDescription = _localizer["Տրամադրված"];
                }
                else
                {
                    card.CardStatus.StatusDescription = _localizer["Չտրամադրված"];
                }

                card.Password = _xbService.GetCardMotherName(request.ProductId);
                CardAdditionalInfo addInfo = _xbService.GetCardAdditionalInfo(request.ProductId);
                card.CardSMSPhone            = addInfo.SMSPhone;
                card.ReportReceivingType     = addInfo.ReportReceivingType;
                card.CardEmail               = addInfo.Email;
                card.ArCaBalance             = _xbService.GetArcaBalance(card.CardNumber);
                card.CardAccount.ArcaBalance = card.ArCaBalance;
                if (card.CardAccount.AccountNumber == "220000295380000" && Convert.ToBoolean(_config["TestVersion"]))
                {
                    card.ArCaBalance = null;
                }
                if (card.Type == 34 || card.Type == 40)
                {
                    card.CashBack = _xbService.GetCashBackAmount(request.ProductId);
                }
                if (card.Type == 41 || card.Type == 40)
                {
                    var MR = _xbService.GetCardMembershipRewards(card.CardNumber);
                    if (MR == null)
                    {
                        card.BonusBalance = 0;
                    }
                    else
                    {
                        card.BonusBalance = MR.BonusBalance;
                    }
                }
                card.FilialName = _xBInfoService.GetFilialName(card.FilialCode);
                response.Result = card;
                return(ResponseExtensions.ToHttpResponse(response));
            }
            else
            {
                return(ValidationError.GetValidationErrorResponse(ModelState));
            }
        }
        public async Task <ActionResult> GetByIdAsync([FromQuery] ProductIdRequest request)
        {
            Product product = await productsService.FindByIdAsync(request.ProductId);

            if (product != null)
            {
                return(Ok(mapper.Map <Product, ProductResponse>(product)));
            }
            return(NotFound());
        }
        public async Task <ActionResult> DeleteAsync([FromQuery] ProductIdRequest request)
        {
            bool status = await productsService.DeleteAsync(request.ProductId);

            if (status)
            {
                return(Ok());
            }
            return(NotFound(new ErrorResponse {
                Error = "Product Not Found.", Status = status
            }));
        }
        public IActionResult GetCreditLine(ProductIdRequest request)
        {
            if (ModelState.IsValid)
            {
                var response = new SingleResponse <CreditLine>()
                {
                    ResultCode = ResultCodes.normal
                };
                response.Result = _xbService.GetCreditLine(request.ProductId);
                response.Result.HasContractFile = _xbService.HasUploadedContract(response.Result.LoanAccount.AccountNumber, 1);
                List <CreditLineGrafik> grafik = _xbService.GetCreditLineGrafik((ulong)response.Result.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)
                    {
                        response.Result.NextRepaymentAmount = selectedRow.Amount - selectedRow.MaturedAmount;
                        response.Result.NextRepaymentDate   = selectedRow.EndDate;
                    }
                }
                //վարտային վարկային քիժ
                if (response.Result.ConnectAccount.AccountType == 11)
                {
                    response.Result.CardSystem = _xbService.GetCardByCardNumber(response.Result.CardNumber).CardSystem;
                }
                //Քարտային վարկային գիծ
                if (response.Result.ConnectAccount.AccountType == 11)
                {
                    response.Result.LoanAccount.CardSystem = _xbService.GetCardByCardNumber(response.Result.LoanAccount.ProductNumber).CardSystem;
                }

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

                response.Result.PenaltyAdd -= response.Result.JudgmentRate;

                return(ResponseExtensions.ToHttpResponse(response));
            }
            else
            {
                return(ValidationError.GetValidationErrorResponse(ModelState));
            }
        }
Exemplo n.º 8
0
 public IActionResult GetExistingDepositContract(ProductIdRequest product)
 {
     if (ModelState.IsValid)
     {
         SingleResponse <string> response = new SingleResponse <string>();
         response.Result     = _contractManager.GetExistingDepositContract(product.ProductId);
         response.ResultCode = ResultCodes.normal;
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
Exemplo n.º 9
0
 public IActionResult GetFactoring(ProductIdRequest request)
 {
     if (ModelState.IsValid)
     {
         var response = new SingleResponse <Factoring>()
         {
             ResultCode = ResultCodes.normal
         };
         response.Result = _xbService.GetFactoring(request.ProductId);
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
Exemplo n.º 10
0
 public IActionResult GetCardLimits(ProductIdRequest request)
 {
     if (ModelState.IsValid)
     {
         var response = new SingleResponse <List <KeyValuePair <string, string> > >()
         {
             ResultCode = ResultCodes.normal
         };
         response.Result = _xbService.GetCardLimits((long)request.ProductId);
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
Exemplo n.º 11
0
 public IActionResult GetPlasticCardSMSServiceTariff(ProductIdRequest productIdRequest)
 {
     if (ModelState.IsValid)
     {
         SingleResponse <float> response = new SingleResponse <float>()
         {
             ResultCode = ResultCodes.normal
         };
         response.Result = _xbService.GetPlasticCardSMSServiceTariff(productIdRequest.ProductId)[1];
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
Exemplo n.º 12
0
 public IActionResult GetDepositRepaymentGrafik(ProductIdRequest request)
 {
     if (ModelState.IsValid)
     {
         var response = new SingleResponse <List <DepositRepayment> >()
         {
             ResultCode = ResultCodes.normal
         };
         response.Result = _xbService.GetDepositRepaymentGrafik(request.ProductId);
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            UnityConfig.Register();

            // Manual resolve for console app. This is not required for web app.
            var queryHandler = UnityConfig.UnityContainer.Resolve <IQueryHandler>();

            var input = new ProductIdRequest
            {
                Id = 100
            };

            var output = queryHandler.ExecuteQuery <ProductIdRequest, ProductEntity>(input);

            Console.WriteLine(output.ProductName);
        }
Exemplo n.º 14
0
 public IActionResult GetCardTariff(ProductIdRequest productIdRequest)
 {
     if (ModelState.IsValid)
     {
         SingleResponse <CardTariff> response = new SingleResponse <CardTariff>()
         {
             ResultCode = ResultCodes.normal
         };
         CardTariff cardTariff = _xbService.GetCardTariff(productIdRequest.ProductId);
         response.Result = cardTariff;
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }