Esempio n. 1
0
        public virtual void button1Clicked(object sender, EventArgs args)
        {
            form1.Disabled = true;
            form1.Visible = false;

            var order = new OrderDetails();
            order.Merchant = "TOKENTES";
            order.OrderRef = "EXT_" + new Random().Next(100000, 999999).ToString();

            order.TokenEnable = true;
            order.TokenType = PayU.Core.Base.TokenType.PAY_ON_TIME;

            order.ProductDetails.Add(new ProductDetails
                                          {
                Code = "TCK1",
                Name = "Ticket1",
                Quantity = 1,
                UnitPrice = 1M,
                Information = "Barcelona flight"
            });
            order.ProductDetails.Add(new ProductDetails
                                          {
                Code = "TCK2",
                Name = "Ticket2",
                Quantity = 1,
                UnitPrice = 1M,
                Information = "London Flight"
            });

            order.ShippingCosts = 0M;
            order.PricesCurrency = "TRY";
            order.DestinationCity = "Ankara";
            order.DestinationState = "Ankara";
            order.DestinationCountry = "TR";
            order.TestOrder = true;
            order.InstallmentOptions = "2,3,7,10,12";

            order.BillingDetails = new BillingDetails {
                FirstName = textBoxName.Text,
                LastName = textBoxLastName.Text,
                Email = textBoxEmail.Text,
                City = "Kağıthane", //Ilce/Semt
                State = "Istanbul", //Sehir
                CountryCode = "TR"
            };

            order.AutoMode = true;
            order.ReturnUrl = string.Format("~/LiveUpdate/OrderComplete.aspx?orderid={0}", order.OrderRef).ToAbsoluteUrl();

            var service = new LiveUpdateService("4@ET=1()T=%y3S8b(r_]");

            ltrLiveUpdateForm.Text = service.RenderPaymentForm(order, "Ödeme Yap");

            ltrLiveUpdateForm.Text += @"<script>document.getElementById('payForm').submit();</script>";
        }
Esempio n. 2
0
        public string RenderPaymentForm(OrderDetails order, string buttonName, string formId)
        {
            var sb = new StringBuilder();

              sb.AppendFormat(@"<form action=""{0}"" method=""POST"" id=""{1}"" name=""{2}"">", EndpointUrl, formId, formId);
              sb.AppendLine();
              sb.Append(RenderPaymentInputs(order));
              sb.AppendFormat(@"<input type=""submit"" value=""{0}"">", buttonName);
              sb.AppendLine();
              sb.AppendLine("</form>");

              return sb.ToString();
        }
Esempio n. 3
0
        public string RenderPaymentInputs(OrderDetails order)
        {
            var parameterHandler = new ParameterHandler(order, false);
              parameterHandler.CreateOrderRequestHash(this.SignatureKey);
              var requestData = parameterHandler.GetRequestData();

              var sb = new StringBuilder();

              foreach (var key in requestData.AllKeys) {
            sb.AppendFormat(@"<input type=""hidden"" name=""{0}"" value=""{1}"">", key, requestData[key]);
            sb.AppendLine();
              }

              return sb.ToString();
        }
Esempio n. 4
0
        public static void Run()
        {
            var order = new OrderDetails();
            order.Merchant = "PAYUDEMO";
            order.OrderRef = "6112457";

            order.TokenEnable = true;
            order.TokenType = PayU.Core.Base.TokenType.PAY_ON_TIME;

            order.ProductDetails.Add(new ProductDetails
            {
                Code = "Product code",
                Name = "Product nameĞŞÇÖıİ",
                Quantity = 2,
                VAT = 67M,
                UnitPrice = 20M,
                Information = "Product info",
                PriceType = PriceType.GROSS
            });
            order.ShippingCosts = 47M;
            order.PricesCurrency = "TRY";
            order.PaymentMethod = "";
            order.Discount = 10M;
            order.DestinationCity = "Ankara";
            order.DestinationState = "Ankara";
            order.DestinationCountry = "TR";
            order.TestOrder = true;
            order.InstallmentOptions = "2,3,7,10,12";

            order.BillingDetails = new BillingDetails {
                FirstName = "Mehmet",
                LastName = "Coşkun",
                Email = "*****@*****.**",
                City = "Kağıthane", //Ilce/Semt
                State = "Istanbul", //Sehir
                CountryCode = "TR"
            };

            var service = new LiveUpdateService("P5@F8*3!m0+?^9s3&u8(");

            Console.WriteLine("{0}", service.RenderPaymentForm(order, "Go to Payment Page"));
        }
Esempio n. 5
0
 public string RenderPaymentForm(OrderDetails order, string buttonName)
 {
     return RenderPaymentForm(order, buttonName, "payForm");
 }