Esempio n. 1
0
        public ActionResult Payment()
        {
            var payment = new Payment()
                              {
                                  PosId = Convert.ToInt32(ConfigurationManager.AppSettings["pos_id"]),
                                  PosAuthKey = ConfigurationManager.AppSettings["pos_auth_key"],
                                  //FirstName = "",
                                  //LastName = "",
                                  Email = "*****@*****.**",
                                  OrderId = new Random().Next(1,100000000),
                                  Description = "Nowy przedmiot." + new Random().Next(1,100000).ToString(),
                                  SessionId = new Random().Next(1,100000).ToString(),//Session.SessionID,
                                  Amount = 999,
                                  ClientIp = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]
                              };

            return View(payment);
        }
Esempio n. 2
0
        public void Payment(Payment payment)
        {
            var t = HttpContext.Request.UserHostAddress;

            ExecutePayment(payment);
        }
Esempio n. 3
0
        private void ExecutePayment(Payment payment)
        {
            Response.Clear();

            var url = string.Format("{0}/{1}/{2}", _payUUrl, _encoding, _newPaymentURI);
            var ts = PayUHelper.TS.ToString();
            var sig = PayUHelper.GetSig(payment.PosId.ToString(), // pos_id,
                                        "", // pay_type
                                        payment.SessionId,
                                        payment.PosAuthKey,
                                        payment.Amount.ToString(),
                                        payment.Description,
                                        "", // desc2
                                        "", // trsDesc
                                        payment.OrderId.ToString(),
                                        "",
                                        "",
                                        "", // payback_login
                                        "",
                                        "",
                                        "",
                                        "",
                                        "",
                                        "",
                                        payment.Email,
                                        "",
                                        "",
                                        payment.ClientIp,
                                        ts,
                                        _key1);

            var result = PayUHelper.PreparePOSTForm(url, new NameValueCollection()
                                                                        {
                                                                            {"pos_id", payment.PosId.ToString()},
                                                                            {"pay_type", ""},
                                                                            {"session_id", payment.SessionId},
                                                                            {"pos_auth_key", payment.PosAuthKey},
                                                                            {"amount", payment.Amount.ToString()},
                                                                            {"desc", payment.Description},
                                                                            {"desc2", ""},
                                                                            {"trsDesc", ""},
                                                                            {"order_id", payment.OrderId.ToString()},
                                                                            {"first_name", ""},
                                                                            {"last_name", ""},
                                                                            {"payback_login", ""},
                                                                            {"street", ""},
                                                                            {"street_hn", ""},
                                                                            {"street_an", ""},
                                                                            {"city", ""},
                                                                            {"post_code", ""},
                                                                            {"country", ""},
                                                                            {"email", payment.Email},
                                                                            {"phone", ""},
                                                                            {"language", ""},
                                                                            {"client_ip", payment.ClientIp},
                                                                            {"ts", ts},
                                                                            {"sig", sig},
                                                                        });
            Response.Write(result);
            Response.End();
        }