Exemplo n.º 1
0
        public IActionResult GetUserInfo()
        {
            SingleResponse <AuthorizationResponse> response = new SingleResponse <AuthorizationResponse>();

            string sessionId = "";
            byte   language  = 0;

            //Սեսիայի նունականացման համար
            if (!string.IsNullOrEmpty(HttpContext.Request.Headers["SessionId"]))
            {
                sessionId = HttpContext.Request.Headers["SessionId"];
            }

            //Լեզու
            if (!string.IsNullOrEmpty(HttpContext.Request.Headers["language"]))
            {
                byte.TryParse(HttpContext.Request.Headers["language"], out language);
            }

            OnlineBankingUser onlineUserData = _xbSecurityService.CheckAuthorization(sessionId, language);

            if (onlineUserData.AuthorizationResult.IsAuthorized)
            {
                CustomerMainData customerMainData = _xbService.GetCustomerMainData(ulong.Parse(onlineUserData.CustomerNumber));

                if (customerMainData.CustomerType != 6)
                {
                    var str     = customerMainData.CustomerDescription;
                    var symbols = new string[] { "«", "»" };
                    foreach (var s in symbols)
                    {
                        str = str.Replace(s, "");
                    }

                    customerMainData.CustomerDescription = str;
                }

                response.Result           = new AuthorizationResponse();
                response.Result.SessionId = onlineUserData.SessionID;
                response.Result.PasswordChangeRequirement = onlineUserData.ChangeRequirement;
                response.Result.UserPermission            = onlineUserData.Permission;
                response.Result.FullName                 = customerMainData.CustomerDescription;
                response.Result.FullNameEnglish          = customerMainData.CustomerDescriptionEng;
                response.Result.IsLastConfirmer          = onlineUserData.IsLastConfirmer;
                response.Result.CustomerType             = (XBS.CustomerTypes)onlineUserData.TypeOfClient;
                response.Result.SecondConfirmRequirement = onlineUserData.SecondConfirm;
                response.Result.IsEmployee               = _xbService.IsEmployee(ulong.Parse(onlineUserData.CustomerNumber));
                response.Result.UserName                 = onlineUserData.UserName;
                response.ResultCode = ResultCodes.normal;
                try
                {
                    response.Result.TotalAvailableBalance = _xbService.GetUserTotalAvailableBalance(onlineUserData.UserID, ulong.Parse(onlineUserData.CustomerNumber));
                }
                catch (Exception)
                {
                    response.Result.TotalAvailableBalance = null;
                }
            }
            return(ResponseExtensions.ToHttpResponse(response));
        }
Exemplo n.º 2
0
        public async Task <SingleResponse <byte[]> > PrintExchangeOrderStatement(long id, int lang, PaymentOrder paymentOrder, string exportFormat = "pdf")
        {
            SingleResponse <byte[]> response = new SingleResponse <byte[]>();
            byte   convType = paymentOrder.SubType;
            string report   = "";
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            report = paymentOrder.SubType == 3 ? "Cross_Convertation_NonCash" : "Convertation_NonCash";
            parameters.Add(key: "User", value: "");
            parameters.Add(key: "nn", value: paymentOrder.Id.ToString());
            parameters.Add(key: "Filial_code", value: paymentOrder.FilialCode.ToString());
            parameters.Add(key: "customer_number", value: paymentOrder.CustomerNumber.ToString());
            parameters.Add(key: "purpose", value: paymentOrder.Description);
            parameters.Add(key: "customer_debit_account", value: paymentOrder.DebitAccount.AccountNumber);
            parameters.Add(key: "customer_credit_account", value: paymentOrder.ReceiverAccount.AccountNumber);
            if (convType != 3)
            {
                parameters.Add(key: "amount", value: convType == 2 ? paymentOrder.Amount.ToString() : (paymentOrder.Amount * paymentOrder.ConvertationRate).ToString());
                parameters.Add(key: "currency", value: paymentOrder.ReceiverAccount.Currency);
                parameters.Add(key: "exch_rate", value: paymentOrder.ConvertationRate.ToString());
                parameters.Add(key: "amount_exch", value: convType == 2 ? (paymentOrder.Amount * paymentOrder.ConvertationRate).ToString() : paymentOrder.Amount.ToString());
                parameters.Add(key: "currency_exch", value: paymentOrder.DebitAccount.Currency);
                parameters.Add(key: "oper", value: convType == 2 ? "Առք" : "Վաճառք");
                parameters.Add(key: "fileName", value: "Convertation_NonCash");
                parameters.Add(key: "transaction_purpose", value: "Ներբանկային փոխարկման հայտ");
                parameters.Add(key: "transaction_purpose1", value: "Արտարժույթի առք ու վաճառքի գործառնությունների վերաբերյալ");
                parameters.Add(key: "Hb_quality", value: ((int)paymentOrder.Quality).ToString());
                if (!String.IsNullOrEmpty(paymentOrder.ConfirmationDate.ToString()))
                {
                    parameters.Add(key: "Hb_confirmation_date", value: paymentOrder.ConfirmationDate.Value.Date.ToString("dd/MM/yy"));
                }
            }
            else
            {
                parameters.Add(key: "amount_buy", value: paymentOrder.Amount.ToString());
                parameters.Add(key: "currency_buy", value: paymentOrder.ReceiverAccount.Currency);
                parameters.Add(key: "kurs_buy", value: paymentOrder.ConvertationRate.ToString());
                parameters.Add(key: "amount_sell", value: (paymentOrder.Amount * paymentOrder.ConvertationRate / paymentOrder.ConvertationRate1).ToString());
                parameters.Add(key: "currency_sell", value: paymentOrder.ReceiverAccount.Currency);
                parameters.Add(key: "Kurs_sell", value: paymentOrder.ConvertationRate1.ToString());
                parameters.Add(key: "diff_inAMD", value: ((paymentOrder.Amount * paymentOrder.ConvertationRate / paymentOrder.ConvertationRate1) - paymentOrder.Amount * paymentOrder.ConvertationRate1).ToString());
                parameters.Add(key: "cross_kurs", value: paymentOrder.ConvertationCrossRate.ToString());
                parameters.Add(key: "cred_acc_descr", value: " ");
                parameters.Add(key: "quality", value: paymentOrder.Quality.ToString());
                if (!String.IsNullOrEmpty(paymentOrder.ConfirmationDate.ToString()))
                {
                    parameters.Add(key: "confirm_date", value: paymentOrder.ConfirmationDate.Value.Date.ToString("dd/MM/yy"));
                }
                parameters.Add(key: "DocID", value: id.ToString());
            }
            parameters.Add(key: "Hb_Doc_ID", value: id.ToString());
            if (convType != 3)
            {
                parameters.Add(key: "Hb_time", value: paymentOrder.ConfirmationDate.Value.TimeOfDay.ToString());
                parameters.Add(key: "Hb_send_date", value: paymentOrder.ConfirmationDate.Value.Date.ToString("dd/MM/yy"));
            }
            else
            {
                parameters.Add(key: "ConfirmDateText", value: paymentOrder.ConfirmationDate.ToString() + ", " + paymentOrder.RegistrationTime);
                parameters.Add(key: "SentDate", value: paymentOrder.ConfirmationDate.Value.Date.ToString("dd/MM/yy"));
            }
            AuthorizedCustomer authorizedCustomer = _cacheHelper.GetAuthorizedCustomer();
            CustomerMainData   customerData       = _xBService.GetCustomerMainData(authorizedCustomer.CustomerNumber);

            parameters.Add(key: "seria", value: _xBInfoService.GetCurrencyLetter(paymentOrder.ReceiverAccount.Currency, convType));
            Dictionary <string, string> customerDetails = new Dictionary <string, string>();

            customerDetails = _xBService.GetOrderDetailsForReport(id);
            parameters.Add(key: "Customer_Info", value: customerData.CustomerDescription);
            parameters.Add(key: "Customer_address", value: customerDetails["cust_adress"]);
            parameters.Add(key: "cust_pass", value: customerDetails["passport_number"] + " " + customerDetails["passport_inf"] + " " + customerDetails["passport_date"]);


            response.Result = await _reportService.RenderReport($"/{_reportName}/{report}", parameters, ReportService.GetExportFormatEnumeration(exportFormat), $"{report}");

            response.ResultCode = ResultCodes.normal;
            return(response);
        }
Exemplo n.º 3
0
        public async Task <SingleResponse <byte[]> > PrintTransfersAcbaStatement(long id, int lang, string exportFormat = "pdf")
        {
            SingleResponse <byte[]> response = new SingleResponse <byte[]>();

            PaymentOrder paymentOrder = _xBService.GetPaymentOrder(id);

            switch (paymentOrder.Type)
            {
            case XBS.OrderType.Convertation:
                return(PrintExchangeOrderStatement(id, lang, paymentOrder, exportFormat).Result);
            }
            if (paymentOrder.Quality == OrderQuality.Completed)
            {
                string policeCode              = "";
                string description             = paymentOrder.Description;
                long   policeResponseDetailsId = 0;
                int    regCode = 0;

                if (!String.IsNullOrEmpty(paymentOrder.CreditCode))
                {
                    description += ", " + paymentOrder.CreditCode + ", " + paymentOrder.Borrower + ", " + paymentOrder.MatureTypeDescription;
                }


                if (paymentOrder.Type == OrderType.RATransfer)
                {
                    BudgetPaymentOrder budgetPaymentOrder = new BudgetPaymentOrder();
                    if (paymentOrder.SubType != 5 && paymentOrder.SubType != 6)  //ՀՀ տարածքում / Հաշիվների միջև
                    {
                        paymentOrder = _xBService.GetPaymentOrder(id);
                    }
                    else  //Բյուջե / Ճանապարհային Ոստիկանություն փոխանցում
                    {
                        budgetPaymentOrder = _xBService.GetBudgetPaymentOrder(id);
                        paymentOrder       = budgetPaymentOrder;

                        policeCode = budgetPaymentOrder.PoliceCode == 0 ? "" : budgetPaymentOrder.PoliceCode.ToString();
                        policeResponseDetailsId = budgetPaymentOrder.PoliceResponseDetailsId;
                        regCode = budgetPaymentOrder.LTACode;
                    }
                }

                AuthorizedCustomer          authorizedCustomer = _cacheHelper.GetAuthorizedCustomer();
                CustomerMainData            customerData       = _xBService.GetCustomerMainData(authorizedCustomer.CustomerNumber);
                Dictionary <string, string> parameters         = new Dictionary <string, string>();

                string sentTime = _xBService.GetInternationalTransferSentTime((int)id);

                parameters.Add(key: "cred_acc", value: paymentOrder.ReceiverAccount.AccountNumber + policeCode);
                parameters.Add(key: "deb_acc", value: paymentOrder.DebitAccount.AccountNumber.ToString());
                parameters.Add(key: "deb_bank", value: paymentOrder.DebitAccount.AccountNumber.Substring(0, 5).ToString());
                parameters.Add(key: "reg_date", value: paymentOrder.OperationDate.Value.ToString("dd/MMM/yyyy"));
                parameters.Add(key: "lang_id", value: lang.ToString());
                parameters.Add(key: "credit_bank", value: paymentOrder.ReceiverAccount.AccountNumber.Substring(0, 5));
                parameters.Add(key: "amount", value: paymentOrder.Amount.ToString());
                parameters.Add(key: "currency", value: paymentOrder.Currency.ToString());
                parameters.Add(key: "descr", value: description);
                parameters.Add(key: "confirm_date", value: paymentOrder.ConfirmationDate.Value.ToString("dd/MMM/yyyy"));
                parameters.Add(key: "for_HB", value: "1");
                parameters.Add(key: "doc_id", value: id.ToString());
                parameters.Add(key: "document_number", value: paymentOrder.OrderNumber.ToString());
                parameters.Add(key: "reciever", value: paymentOrder.Receiver != null ? paymentOrder.Receiver : "");

                if (paymentOrder.CreditorDescription != null)
                {
                    description += ", " + paymentOrder.CreditorDescription;
                    parameters.Add(key: "debtor_Name", value: paymentOrder.CreditorDescription);
                }

                if (paymentOrder.CreditorDocumentNumber != null)
                {
                    if (paymentOrder.CreditorDocumentType == 1)
                    {
                        description += ", ՀԾՀ " + paymentOrder.CreditorDocumentNumber;
                        parameters.Add(key: "debtor_soccard", value: paymentOrder.CreditorDocumentNumber);
                    }
                    else if (paymentOrder.CreditorDocumentType == 2)
                    {
                        description += ", Պարտատիրոջ ՀԾՀ չստանալու մասին տեղեկանքի համար " + paymentOrder.CreditorDocumentNumber;
                        parameters.Add(key: "debtor_soccard", value: paymentOrder.CreditorDocumentNumber);
                    }
                    else if (paymentOrder.CreditorDocumentType == 3)
                    {
                        description += ", Անձնագիր " + paymentOrder.CreditorDocumentNumber;
                    }
                    else if (paymentOrder.CreditorDocumentType == 4)
                    {
                        description += ", ՀՎՀՀ " + paymentOrder.CreditorDocumentNumber;
                        parameters.Add(key: "debtor_code_of_tax", value: paymentOrder.CreditorDocumentNumber);
                    }
                }

                if (paymentOrder.CreditorDeathDocument != null)
                {
                    description += ", Մահվան վկայական " + paymentOrder.CreditorDeathDocument;
                }
                if (paymentOrder.Fees != null)
                {
                    if (paymentOrder.Fees.Exists(m => m.Type == 20 || m.Type == 5))
                    {
                        double transferFee = paymentOrder.Fees.Find(m => m.Type == 20 || m.Type == 5).Amount;
                        parameters.Add(key: "commission", value: transferFee.ToString());
                    }
                }

                parameters.Add(key: "TransactionTime", value: sentTime);


                parameters.Add(key: "print_soc_card", value: customerData.CustomerType == 6 ? "True" : "False");
                parameters.Add(key: "is_copy", value: "False");
                parameters.Add(key: "reciever_tax_code", value: "");
                parameters.Add(key: "reg_code", value: regCode.ToString());
                parameters.Add(key: "cust_name", value: customerData.CustomerDescription);
                if (customerData.CustomerType != 6)
                {
                    parameters.Add(key: "tax_code", value: customerData.TaxCode);
                }

                parameters.Add(key: "quality", value: ((short)paymentOrder.Quality).ToString());
                parameters.Add(key: "police_code", value: policeResponseDetailsId.ToString());


                response.Result = await _reportService.RenderReport($"/{_reportName}/Payment_order", parameters, ReportService.GetExportFormatEnumeration(exportFormat), "Payment_order");
            }
            else
            {
                paymentOrder.Description = "Հայտը կատարված չէ։";
            }
            response.ResultCode = ResultCodes.normal;
            return(response);
        }