예제 #1
0
        public IActionResult DoMakeRequest()
        {
            var usr = authService.GetAuthUser(Request, Response);

            if (usr == null)
            {
                return(authService.UnAuthenticatedResult);
            }

            if (!(Request.Form.ContainsKey("msgp") && Request.Form.ContainsKey("msgt") &&
                  Request.Form.ContainsKey("amm") && Request.Form.ContainsKey("wallet")))
            {
                return(authService.UnAuthenticatedResult);
            }

            var qr = QueryHelpers.AddQueryString("http://memeium.azurewebsites.net/Home/PayRequest", "msgp",
                                                 Request.Form["msgp"]);

            qr = QueryHelpers.AddQueryString(qr, "msgt", Request.Form["msgt"]);
            qr = QueryHelpers.AddQueryString(qr, "amm", Request.Form["amm"].ToString());
            qr = QueryHelpers.AddQueryString(qr, "addr", Request.Form["wallet"].ToString().Split('-')[1]);

            var qrCode = walletUtil.SaveQrCode(qr);
            var model  = new RequestOutputViewModel()
            {
                Title        = Request.Form["msgp"],
                Message      = Request.Form["msgt"],
                FileNameOfQr = qrCode + ".png",
                Url          = qr,
                ToAddr       = Request.Form["wallet"].ToString().Split('-')[1],
                Ammount      = Request.Form["amm"]
            };

            return(View(model));
        }
예제 #2
0
        public IActionResult PayRequest(string msgp, string msgt, string amm, string addr)
        {
            if (msgp == null)
            {
                msgp = "";
            }
            if (msgt == null)
            {
                msgt = "";
            }
            if (amm == null)
            {
                amm = "0";
            }
            if (addr == null)
            {
                return(NotFound());
            }
            var usr = authService.GetAuthUser(Request, Response);

            if (usr == null)
            {
                return(authService.UnAuthenticatedResult);
            }

            var req = new RequestOutputViewModel()
            {
                User         = usr,
                Ammount      = amm,
                FileNameOfQr = "",
                Message      = msgt,
                Title        = msgp,
                ToAddr       = addr,
                Url          = ""
            };

            return(View(req));
        }