Ejemplo n.º 1
0
        public ActionResult HandleRequest(FormtoRequest model)
        {
            string secretKey     = ConfigurationManager.AppSettings["SecretKey"];
            string signatureData = "";

            PropertyInfo[] keys = model.GetType().GetProperties();
            keys = keys.OrderBy(key => key.Name).ToArray();

            foreach (PropertyInfo key in keys)
            {
                signatureData += key.Name + key.GetValue(model);
            }
            var hmacsha256 = new HMACSHA256(StringEncode(secretKey));

            byte[] gensignature = hmacsha256.ComputeHash(StringEncode(signatureData));
            string signature    = Convert.ToBase64String(gensignature);

            ViewData["signature"] = signature;

            string mode = ConfigurationManager.AppSettings["Mode"];

            if (mode == "PROD")
            {
                ViewData["url"] = "https://www.cashfree.com/checkout/post/submit";
            }
            else
            {
                ViewData["url"] = "https://test.cashfree.com/billpay/checkout/post/submit";
            }
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult Payment()
        {
            string customer = "Newcustomer" + DateTime.Now;

            if ((string)Session["Customer"] != null)
            {
                customer = Convert.ToString(Session["Customer"]);
            }


            FormtoRequest model = new FormtoRequest();

            model.appId         = ConfigurationManager.AppSettings["AppId"];
            model.orderId       = DateTime.Now.Ticks.ToString();
            model.orderNote     = "Abirami Arrangements payment";
            model.orderCurrency = "INR";
            model.customerName  = customer;
            model.customerEmail = "*****@*****.**";
            model.customerPhone = "9585831457";
            model.orderAmount   = "2000";
            model.notifyUrl     = "https://www.thirukadaiyurweddings.com/Home/Index/";
            model.returnUrl     = "https://www.thirukadaiyurweddings.com/Home/OnlineBookingconfirmation/";

            string secretKey     = ConfigurationManager.AppSettings["SecretKey"];
            string signatureData = "";

            PropertyInfo[] keys = model.GetType().GetProperties();
            keys = keys.OrderBy(key => key.Name).ToArray();

            foreach (PropertyInfo key in keys)
            {
                signatureData += key.Name + key.GetValue(model);
            }
            var hmacsha256 = new HMACSHA256(StringEncode(secretKey));

            byte[] gensignature = hmacsha256.ComputeHash(StringEncode(signatureData));
            string signature    = Convert.ToBase64String(gensignature);

            ViewData["signature"] = signature;
            string mode = ConfigurationManager.AppSettings["Mode"];

            if (mode == "PROD")
            {
                ViewData["url"] = "https://www.cashfree.com/checkout/post/submit";
            }
            else
            {
                ViewData["url"] = "https://test.cashfree.com/billpay/checkout/post/submit";
            }
            return(View(model));
        }