Ejemplo n.º 1
0
        public ActionResult Pay(PayModel model)
        {
            if (model == null || String.IsNullOrEmpty(model.Email) || String.IsNullOrEmpty(model.Name) ||
                String.IsNullOrEmpty(model.Phone) || model.Sum < 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var robokassa = new RobokassaService(model.Name, model.Email, model.Phone, model.Sum);

            robokassa.CalcOutSum(); //calculate out sum for bank card way of payment


            var redirectModel = new RedirectPaymetModel()
            {
                Sum             = robokassa.Sum,
                Signature       = robokassa.Signature,
                MerchantLogin   = robokassa.MerchantLogin,
                Email           = robokassa.Email,
                EmailUrlEncoded = robokassa.EmailUrlEncoded,
                Name            = robokassa.Name,
                NameUrlEncoded  = robokassa.NameUrlEncoded,
                Phone           = robokassa.Phone,
                PhoneUrlEncoded = robokassa.PhoneUrlEncoded,
                IncCurrLabel    = robokassa.IncCurrLabel
            };

            return(View("PayPlatformRedirect", redirectModel));
        }
Ejemplo n.º 2
0
        protected void Application_Start()
        {
            try
            {
                AreaRegistration.RegisterAllAreas();
                RouteConfig.RegisterRoutes(RouteTable.Routes);

                //email sending configuration
                var emailConfig = (EmailConfiguration)ConfigurationManager.GetSection("emailConfiguration");
                EmailSender.Configure(emailConfig);

                //setting templates for emails
                var paymentPath      = ConfigurationManager.AppSettings.Get("paymentTmplPath");
                var trialWorkoutPath = ConfigurationManager.AppSettings.Get("trialWorkoutTmplPath");

                MessageBuilder.SetMessageTemplate("payment", paymentPath);
                MessageBuilder.SetMessageTemplate("trialworkout", trialWorkoutPath);

                //robokassa configuration
                var robokassaConfig = (RobokassaConfiguration)ConfigurationManager.GetSection("robokassaConfiguration");
                RobokassaService.Configure(robokassaConfig);
            }
            catch (Exception e)
            {
                //todo: write log
                Environment.Exit(0);
            }
        }