示例#1
0
        private void AddRecord(string requestedResource, string replacementResource)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new AddRecordDelegate(this.AddRecord), new object[] { requestedResource, replacementResource });
                return;
            }

            RequestURL requestUrl = this.ParseRequestedURLRegex(requestedResource);

            // Verify whether replacement file resource is valid
            if (!File.Exists(replacementResource))
            {
                throw new Exception("The injection file does not exist.");
            }

            // Verify if record already exists
            foreach (InjectFileRecord tmpRecord in this.injectFileRecords)
            {
                if (tmpRecord.RequestedHostRegex == requestUrl.HostRegex &&
                    tmpRecord.RequestedPathRegex == requestUrl.PathRegex)
                {
                    throw new Exception("A record with this host name already exists.");
                }
            }

            lock (this)
            {
                InjectFileRecord newRecord = new InjectFileRecord(requestUrl.HostRegex, requestUrl.PathRegex, replacementResource);

                this.dgv_InjectionTriggerURLs.SuspendLayout();
                this.injectFileRecords.Insert(0, newRecord);
                this.dgv_InjectionTriggerURLs.ResumeLayout();
            }
        }
 public WebHCatRequestsManager(string webHCatBaseUrl, string webHCatVersion, string webHCatUserName)
 {
     _webHcatBaseUrl  = webHCatBaseUrl;
     _webHCatVersion  = webHCatVersion;
     _webHCatUserName = webHCatUserName;
     requestURL       = new RequestURL(_webHCatVersion, _webHCatUserName);
 }
示例#3
0
        private RequestURL ParseRequestedUrlRegex(string url)
        {
            RequestURL requestedUrl;
            var        pathDelimiter = '/';

            if (string.IsNullOrEmpty(url) == true ||
                string.IsNullOrWhiteSpace(url) == true)
            {
                throw new Exception("The URL is invalid");
            }

            url = url.Trim();
            if (url.StartsWith("http://") == true ||
                url.StartsWith("https://") == true)
            {
                throw new Exception("The URL must not contain a scheme definition");
            }

            if (url.Contains(pathDelimiter) == false)
            {
                throw new Exception("The URL must contain a root path slash");
            }

            string[] splitter = url.Split(new char[] { pathDelimiter }, 2);

            if (splitter == null ||
                splitter.Count() != 2)
            {
                throw new Exception("The URL is invalid");
            }

            string urlPath = $"{pathDelimiter}{splitter[1]}";

            requestedUrl = new RequestURL(splitter[0], urlPath);

            return(requestedUrl);
        }
示例#4
0
        public JsonResult RefundAmount(Guid OrderID)
        {
            string Cart = "VP" + "_" + "1.0" + "_" + "0.00";

            DataTable dt = BLObj.GetTransactionID(OrderID);

            string MerchantTxnRefNumber = (dt.Rows[0]["UniquTxnRefNo"]).ToString();
            string TPSLTxnID = (dt.Rows[0]["TPSLTxnID"]).ToString();

            RequestURL objRequestURL = new RequestURL();

            String response = objRequestURL.SendRequest("R", "T5041", MerchantTxnRefNumber, "NA", "1.00", "INR", "NA", "NA", "NA",
                TPSLTxnID, Cart, DateTime.Now.ToString("dd-MM-yyyy"), "", "", "", "", @"D:\DotnetIntegrationKit\PropertyFile\Merchant.property");

            // String strResponse = response.ToUpper();

            if (response.ToUpper().Contains("SUCCESS"))
            {
                BLObj.UpdateOrderAfterRefund(MerchantTxnRefNumber);
                bool result = true;
                return Json(new { result }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                bool result = false;
                return Json(new { result }, JsonRequestBehavior.AllowGet);
            }

            //return Json(new { }, JsonRequestBehavior.AllowGet);
        }
示例#5
0
        public ActionResult RequestForPayment(int PackageID, int amount, string request)
        {
            string getError = "";
            try
            {
                TempData["RequestInfo"] = request.ToString() + " " + PackageID.ToString() + " " + amount;
                TempData["PaymentInformationforPackage"] = PackageID.ToString() + " " + amount.ToString();

                string commition = "0.00";

                var host = Request.Url.Host.ToLower();
                var port = Request.Url.Port.ToString();

                //RequestForPayment rp = new Models.RequestForPayment();

                Guid OrderID = Guid.NewGuid();
                Guid TransactionID = Guid.NewGuid();
                int UserId = Convert.ToInt32(Common.GetUserId(HttpContext.User.Identity.Name));
                RequestURL objRequestURL = new RequestURL();

                string Requesttype = "T";

                string MerchantCode = "L5041";//"T5041";

                string MTRN = Guid.NewGuid().ToString("N").Substring(0, 10);

                string ITC = "NA";

                double Amount = Convert.ToDouble(amount);//Convert.ToDouble(amo);

                string CurrencyCode = "INR";

                string UCI = "NA";

                string RL = "http://" + host + ":" + port + "/Home/PaymentDone";//?PackageID=" + PackageID + "&amount=" + amo;

                string ReturnURL = "NA";

                string TranID = "NA";//"151180865";

                string Cart = "VP" + "_" + Amount + "_" + commition;

                string TxnDate = Convert.ToString(DateTime.Now.ToString("dd-MM-yyyy").Split(' ')[0]);

                string Email = "";

                string Mobile = "";

                string BankCode = "";//Convert.ToString(rp.BankCode);

                string CustomerName = "";

                string PropertyPath = @"D:\DotnetIntegrationKit\PropertyFile\Merchant.property";

                String response = objRequestURL.SendRequest(Requesttype, MerchantCode, MTRN, ITC, Convert.ToString(Amount), CurrencyCode, UCI, RL, ReturnURL,
                TranID, Cart, TxnDate, Email, Mobile, BankCode, CustomerName, PropertyPath);

                String strResponse = response.ToUpper();

                if (strResponse.StartsWith("ERROR"))
                {
                    getError = "Error 6";
                    ViewBag.ResultMessage = response;
                }
                else
                {
                    getError = "Error 7";
                    BLObj.CreatNewOrder(OrderID, TransactionID, request, PackageID, MTRN, UserId);
                    getError = "Error 8";
                    TempData["OrderID"] = OrderID.ToString();
                    getError = "Error 9";

                    Response.Write("<form name='s1_2' id='s1_2' action='" + response + "' method='post'> ");

                    Response.Write("<script type='text/javascript' language='javascript' >document.getElementById('s1_2').submit();");

                    Response.Write("</script>");
                    Response.Write("<script language='javascript' >");
                    Response.Write("</script>");
                    Response.Write("</form> ");

                }
            }
            catch (Exception ex)
            {
                ViewBag.ResultMessage = ex.Message;
            }
            return View();

            //return View(rp);

            //  return RedirectToAction("PaymentDone", "Home");
        }
示例#6
0
        private void AddRecord(string requestedResource, string replacementResource, string tag, string position)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new AddRecordDelegate(this.AddRecord), new object[] { requestedResource, replacementResource, tag, position });
                return;
            }

            RequestURL requestUrl = this.ParseRequestedUrlRegex(requestedResource);
            var        scheme     = "http://";

            // Verify if replacement file resource is valid
            if (!File.Exists(replacementResource))
            {
                throw new Exception("The injection file does not exist.");
            }

            // Verify if record already exists
            foreach (InjectCodeRecord tmpRecord in this.injectCodeRecords)
            {
                if (tmpRecord.RequestedHostRegex == requestUrl.HostRegex &&
                    tmpRecord.RequestedPathRegex == requestUrl.PathRegex &&
                    tmpRecord.Tag == tag)
                {
                    throw new Exception("A record with this host name already exists.");
                }
            }

            // Verify whether regex contain invalid characters
            if (Regex.Match(requestUrl.HostRegex, @"[^\d\w\-\._\*]+").Success == true)
            {
                throw new Exception($"The request host regex contains invalid characters: {requestUrl.HostRegex}");
            }

            if (Regex.Match(requestUrl.PathRegex, @"[^\d\w\-\,\._\/\+\&\*]+").Success == true)
            {
                throw new Exception($"The request path regex contains invalid characters: {requestUrl.PathRegex}");
            }

            // Replace * char by regex
            if (requestUrl.HostRegex.Contains("*"))
            {
                requestUrl.HostRegex = Regex.Escape(requestUrl.HostRegex);
                requestUrl.HostRegex.Replace("ASTERISK", @"[\d\w\-\._]{0,}");
            }

            if (requestUrl.PathRegex.Contains("*"))
            {
                requestUrl.PathRegex = Regex.Escape(requestUrl.PathRegex);
                requestUrl.PathRegex.Replace("ASTERISK", @"[\d\w\-\,\._\/\+\&]{0,}");
            }

            // Verify if host name is correct
            if (this.IsRegexPatternValid(requestUrl.HostRegex) == false)
            {
                this.pluginProperties.HostApplication.LogMessage($"{this.Config.PluginName}: Invalid host name regex: {requestUrl.HostRegex}");
                throw new Exception("The host name regex is invalid");
            }

            if (this.IsRegexPatternValid(requestUrl.PathRegex) == false)
            {
                throw new Exception("The request path regex is invalid");
            }

            lock (this)
            {
                InjectCodeRecord newRecord = new InjectCodeRecord(scheme, requestUrl.HostRegex, requestUrl.PathRegex, replacementResource, tag, position);

                this.dgv_InjectionTriggerURLs.SuspendLayout();
                this.injectCodeRecords.Insert(0, newRecord);
                this.dgv_InjectionTriggerURLs.ResumeLayout();
            }
        }
示例#7
0
        public ActionResult PaymentDone()
        {
            //Payment response

            string[] payment_information = null;
            int packageid = 0;
            string packageamount = "";
            string serviceinfo = "";
            string[] requestinfo = null;
            string amount = "";
            //request information

            if (TempData["RequestInfo"] != null)
            {
                requestinfo = TempData["RequestInfo"].ToString().Split(' ');
                packageid = Convert.ToInt32(requestinfo[1]);
                serviceinfo = requestinfo[0].ToString();
                amount = requestinfo[2].ToString();
            }
            string UserId = Convert.ToString(Common.GetUserId(HttpContext.User.Identity.Name));
            BusinessLayer.BLControllers.BL_Account bl = new BusinessLayer.BLControllers.BL_Account();
            DataTable email_username  = bl.GetEmailId(UserId);
               // string htmlFilePath = Server.MapPath(Constants.ResetPasswordHTMLTemplate);

            if (serviceinfo == "Package")
            {
                string htmlFilePathforpackage = Server.MapPath(Constants.PackageHTMLTemplate);
                if (TempData["PaymentInformationforPackage"] != null)
                {
                    payment_information = TempData["PaymentInformationforPackage"].ToString().Split(' ');
                    packageid = Convert.ToInt32(payment_information[0]);
                    packageamount = payment_information[1];
                }
               strPGResponse = Request["msg"].ToString();
                Packages p = new Packages();

                if (strPGResponse != "" || strPGResponse != null)
                {

                    RequestURL objRequestURL = new RequestURL();

                    string strDecryptedVal = objRequestURL.VerifyPGResponse(strPGResponse, ConfigurationSettings.AppSettings["FilePath"]);

                    if (strDecryptedVal.StartsWith("ERROR"))
                    {
                        ViewBag.ResultMessage = strDecryptedVal;
                    }
                    else
                    {
                        strSplitDecryptedResponse = strDecryptedVal.Split('|');
                        GetPGRespnseData(strSplitDecryptedResponse);

                        if (strPG_TxnStatus == "0300")
                        {
                            p.PkgData = bl.GET_ACTIVE_Features_ByPackageID(packageid);
                            p.AmountAfterTransaction = packageamount;

                            Guid OrderID = new Guid(TempData["OrderID"].ToString());

                            bl.UpdateOrder(OrderID,strPG_TPSLTxnID);

                            DataTable dt = bl.getPackageDetails(Convert.ToInt32(UserId));

                            if (dt.Rows.Count > 0)
                            {
                                bl.UpdatePackageStatus(packageid, Convert.ToInt32(UserId));
                                bl.UpdatePayStatus(packageid, Convert.ToInt32(UserId));
                            }
                            else
                            {
                                bl.insertUserPackage(packageid, Convert.ToInt32(UserId));
                                bl.UpdatePayStatus(packageid, Convert.ToInt32(UserId));
                            }

                            bl.SendMailAfterPaymentDoneForPackage(email_username.Rows[0][1].ToString(), email_username.Rows[0][0].ToString(), p.PackageName, Convert.ToInt32(p.AmountAfterTransaction), htmlFilePathforpackage);

                        }
                        else
                            ViewBag.ResultMessage = "Transaction Fail ";

                    }
                }

                return View(p);
            }
            else
            {
                string htmlFilePathforService = Server.MapPath(Constants.ServiceHTMLTemplate);
                strPGResponse = Request["msg"].ToString();

                if (strPGResponse != "" || strPGResponse != null)
                {

                    RequestURL objRequestURL = new RequestURL();

                    string strDecryptedVal = objRequestURL.VerifyPGResponse(strPGResponse, ConfigurationSettings.AppSettings["FilePath"]);

                    if (strDecryptedVal.StartsWith("ERROR"))
                    {
                        ViewBag.ResultMessage = strDecryptedVal;
                    }
                    else
                    {
                        strSplitDecryptedResponse = strDecryptedVal.Split('|');
                        GetPGRespnseData(strSplitDecryptedResponse);

                        if (strPG_TxnStatus == "0300")
                        {
                            Guid OrderID = new Guid(TempData["OrderID"].ToString());

                            bl.UpdateOrder(OrderID,strPG_TPSLTxnID);

                            if (serviceinfo == "ProofReading")
                            {
                                BusinessLayer.BLControllers.BL_ProofReading proofreading = new BusinessLayer.BLControllers.BL_ProofReading();
                                proofreading.UpdateProofReadingByTrxnID(packageid, serviceinfo);
                                bl.SendMailAfterPaymentDoenForServices(email_username.Rows[0][1].ToString(), email_username.Rows[0][0].ToString(), serviceinfo, Convert.ToDouble(amount), htmlFilePathforService);
                            }
                            if (serviceinfo == "Formatting")
                            {
                                BusinessLayer.BLControllers.BL_Formatting formating = new BusinessLayer.BLControllers.BL_Formatting();
                                formating.UpdateProofReadingByTrxnID(packageid, serviceinfo);
                                bl.SendMailAfterPaymentDoenForServices(email_username.Rows[0][1].ToString(), email_username.Rows[0][0].ToString(), serviceinfo, Convert.ToDouble(amount), htmlFilePathforService);
                            }
                            if (serviceinfo == "Illustation")
                            {
                                BusinessLayer.BLControllers.BL_Illustration Illustration = new BusinessLayer.BLControllers.BL_Illustration();
                                Illustration.UpdateProofReadingByTrxnID(packageid, serviceinfo);
                                bl.SendMailAfterPaymentDoenForServices(email_username.Rows[0][1].ToString(), email_username.Rows[0][0].ToString(), serviceinfo, Convert.ToDouble(amount), htmlFilePathforService);
                            }
                            if (serviceinfo == "CoverDesign")
                            {
                                BusinessLayer.BLControllers.BL_CoverDesign CoverDesing = new BusinessLayer.BLControllers.BL_CoverDesign();
                                CoverDesing.UpdateProofReadingByTrxnID(packageid, serviceinfo);
                                bl.SendMailAfterPaymentDoenForServices(email_username.Rows[0][1].ToString(), email_username.Rows[0][0].ToString(), serviceinfo, Convert.ToDouble(amount), htmlFilePathforService);
                                //return View(CoverDesign);
                            }
                            ViewBag.Message = requestinfo;
                        }
                        else
                        {
                            ViewBag.ResultMessage = "Transaction Fail ";
                            //ViewBag.ResultMessage = "Transaction Fail :: <br/>" + "Response :: <br/>"+ strDecryptedVal;
                        }

                    }

                }
               return View();
            }
        }
示例#8
0
        private void AddRecord(string redirectType, string redirectDescription, string requestedResource, string replacementResource)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new AddRecordDelegate(this.AddRecord), new object[] { redirectType, redirectDescription, requestedResource, replacementResource });
                return;
            }

            RequestURL requestUrl = this.ParseRequestedURLRegex(requestedResource);

            // Verify whether record already exists
            foreach (RequestRedirectRecord tmpRecord in this.requestRedirectRecords)
            {
                if (tmpRecord.RequestedHostRegex == requestUrl.HostRegex &&
                    tmpRecord.RequestedPathRegex == requestUrl.PathRegex)
                {
                    throw new Exception("A record with this host name already exists.");
                }
            }

            // Verify whether regex contain invalid characters
            if (Regex.Match(requestUrl.HostRegex, @"[^\d\w\-\._\*]+").Success == true)
            {
                throw new Exception($"The request host regex contains invalid characters: {requestUrl.HostRegex}");
            }

            if (Regex.Match(requestUrl.PathRegex, @"[^\d\w\-\,\._\/\+\&\*]+").Success == true)
            {
                throw new Exception($"The request path regex contains invalid characters: {requestUrl.PathRegex}");
            }

            // Verify if replacement URL resource is valid
            Uri  replacementUri;
            bool isValidReplUri = Uri.TryCreate(replacementResource, UriKind.Absolute, out replacementUri);

            if (!isValidReplUri)
            {
                throw new Exception("The replacement resource URL is invalid");
            }

            if (replacementUri.Scheme != Uri.UriSchemeHttp &&
                replacementUri.Scheme != Uri.UriSchemeHttps)
            {
                throw new Exception("The replacement URL scheme is invalid.");
            }

            if (string.IsNullOrEmpty(replacementUri.Host) ||
                string.IsNullOrWhiteSpace((replacementUri.Host)))
            {
                throw new Exception("The replacement URL host is invalid.");
            }

            if (string.IsNullOrEmpty(replacementUri.PathAndQuery) ||
                string.IsNullOrWhiteSpace((replacementUri.PathAndQuery)))
            {
                throw new Exception("The replacement URL path is invalid.");
            }

            lock (this)
            {
                RequestRedirectRecord newRecord = new RequestRedirectRecord(redirectType, redirectDescription, requestUrl.HostRegex, requestUrl.PathRegex, replacementResource);

                this.dgv_RequestRedirectURLs.SuspendLayout();
                this.requestRedirectRecords.Insert(0, newRecord);
                this.dgv_RequestRedirectURLs.ResumeLayout();
            }
        }
示例#9
0
        public static AppSetting GetSetting(this IServiceCollection services, Components components)
        {
            // List<KeyValuePair<string, List<string>>> settingDict = null;
            AppSetting appSettingObj = null;

            try
            {
                string url = "https://localhost:44359/api/Setting?component=" + (byte)components;
                HTTPResponseJsonDTO <List <KeyValuePair <string, List <string> > > > response = RequestURL.HTTPRequest <List <KeyValuePair <string, List <string> > > >(url, RequestType.GET, null);
                //Convert dictionary response to appsetting Class
                appSettingObj = SettingHandler.GetSetting <AppSetting>(response.Body);
            }
            catch (System.Exception exception)
            {
                appSettingObj = SettingHandler.GetSetting <AppSetting>(Configuration.GetSection("CommonSetting").Value);
            }
            ConfigHelper.AppSetting = appSettingObj;
            return(appSettingObj);
        }