예제 #1
0
        public ActionResult BuyGold(UserPaymentViewModel userPaymentViewModel)
        {
            var payment = _paymentManager.CreatePayment(User.Identity.GetUserId(), userPaymentViewModel.Amount);

            PaymentRequest paymentRequest = new PaymentRequest()
            {
                OrderId     = payment.ID,
                Amount      = payment.Amount,
                ServiceName = "Gold",
                CompanyName = "Slowpoke",
                CallbackUrl = HttpContext.Request.UrlReferrer + "api/payment/pay/",
                ReturnUrl   = HttpContext.Request.UrlReferrer.ToString(),
            };

            string paymentRequestQS = paymentRequest.ToString();

            ICryptoProvider cryptoProvider = new SlowpokeCryptoProvider();

            paymentRequest.Sign = cryptoProvider.ComputeHash(paymentRequestQS, "test");

            var redirectUrl = "http://localhost:10127/Payment/Pay?" + paymentRequest.GetFullSignedUrl();

            return(Redirect(redirectUrl));
        }