Example #1
0
        public ActionResult ValidateOTP(string otp)
        {
            var google = new GoogleSheetsHelper();

            var model = Session["transaction"] as DiscountTransaction;

            ViewData["SMSTemplates"] = Transform(Session["templates"] as IList <string>);

            ViewData["DiscountReasons"] = Transform(Session["reasons"] as IList <string>);

            ViewData["PCCNames"] = Transform(Session["names"] as IList <string>);

            if (otp.Length == 4)
            {
                MSGWowHelper helper = new MSGWowHelper();

                var isOTPSent = helper.verifyOTP(otp, model.MobileNumber);

                //var isOTPSent = true;

                if (isOTPSent)
                {
                    model.ValidationStatus = System.Configuration.ConfigurationManager.AppSettings["OTPVerifiedMsg"];

                    model.OTP = otp;

                    google.UpdateValidationStatus(model);

                    ViewBag.Message = System.Configuration.ConfigurationManager.AppSettings["SuccessfulTransactionMsg"];

                    Session["transaction"] = model;
                }
                else
                {
                    ViewBag.Message = System.Configuration.ConfigurationManager.AppSettings["InvalidOTPMsg"];;

                    //Session["enabletimer"] = true;

                    return(View("Index", model));
                }

                return(View("Transaction", model));
            }
            else
            {
                ViewBag.Message = System.Configuration.ConfigurationManager.AppSettings["ProvideOTPMsg"];

                return(View("Index", model));
            }
        }
Example #2
0
        //[HttpPost]
        public ActionResult ResendOTP()
        {
            MSGWowHelper helper = new MSGWowHelper();

            var google = new GoogleSheetsHelper();

            var model = Session["transaction"] as DiscountTransaction;

            if (model != null)
            {
                ViewData["SMSTemplates"] = Transform(Session["templates"] as IList <string>);

                ViewData["DiscountReasons"] = Transform(Session["reasons"] as IList <string>);

                ViewData["PCCNames"] = Transform(Session["names"] as IList <string>);

                var messageTempalte = model.MessageTemplate.
                                      Replace(System.Configuration.ConfigurationManager.AppSettings["Customername"], model.CustomerName)
                                      .Replace(System.Configuration.ConfigurationManager.AppSettings["Discount"], model.Discount.ToString() + " ")
                                      .Replace(System.Configuration.ConfigurationManager.AppSettings["Discountreason"], model.DiscountReason)
                                      .Replace(System.Configuration.ConfigurationManager.AppSettings["Billvalue"], model.BillValue.ToString());


                var isOTPSent = helper.resendOTP(model.MobileNumber, messageTempalte);

                if (isOTPSent)
                {
                    ViewBag.Message = System.Configuration.ConfigurationManager.AppSettings["SuccessfulOTPMsg"];

                    model.enableValidatebtn = true;

                    // model.enableResendbtn = false;
                }
                else
                {
                    ViewBag.Message         = System.Configuration.ConfigurationManager.AppSettings["FailureOTPMsg"];;
                    model.enableValidatebtn = false;
                    // model.enableResendbtn = true;
                }

                Session["transaction"] = model;
            }
            return(View("Index", model));
        }
Example #3
0
        public ActionResult Index(DiscountTransaction model)
        {
            ViewData["SMSTemplates"] = Transform(Session["templates"] as IList <string>);

            ViewData["DiscountReasons"] = Transform(Session["reasons"] as IList <string>);

            ViewData["PCCNames"] = Transform(Session["names"] as IList <string>);

            if (ModelState.IsValid && Session["UserEmail"] != null)
            {
                var google = new GoogleSheetsHelper();

                model.UserEmail = Session["UserEmail"].ToString();

                model.ValidationStatus = System.Configuration.ConfigurationManager.AppSettings["OTPVerificationPendingMsg"];

                model.enableSubmitbtn = false;

                MSGWowHelper helper = new MSGWowHelper();

                var messageTempalte = model.MessageTemplate.
                                      Replace(System.Configuration.ConfigurationManager.AppSettings["Customername"], model.CustomerName)
                                      .Replace(System.Configuration.ConfigurationManager.AppSettings["Discount"], model.Discount.ToString() + " ")
                                      .Replace(System.Configuration.ConfigurationManager.AppSettings["Discountreason"], model.DiscountReason)
                                      .Replace(System.Configuration.ConfigurationManager.AppSettings["Billvalue"], model.BillValue.ToString());

                model.MessageTemplate = messageTempalte;

                google.CreateTransaction(model);

                var isOTPSent = helper.sendOTP(model.MobileNumber, messageTempalte);

                //var isOTPSent = true;

                if (isOTPSent)
                {
                    ViewBag.Message = System.Configuration.ConfigurationManager.AppSettings["SuccessfulOTPMsg"];

                    //Session["enabletimer"] = true;

                    model.enableValidatebtn = true;

                    // model.enableResendbtn = true;

                    Session["transaction"] = model;

                    google.UpdateMsgTemplate(model);


                    return(View(model));
                    //enable validate otp button , disabled resend
                }
                else
                {
                    ViewBag.Message = System.Configuration.ConfigurationManager.AppSettings["FailureOTPMsg"];

                    model.enableValidatebtn = true;  // Final fix

                    // model.enableResendbtn = true;

                    Session["transaction"] = model;

                    //Should we wait for 30 sec or enable resend button ??  -> enable resend button , disabled validate otp btn
                    return(View(model));
                }
            }

            return(View(model));
        }