Example #1
0
        public ALUResponse ProcessPayment(OrderDetails parameters)
        {
            var parameterHandler = new ParameterHandler(parameters);
              parameterHandler.CreateOrderRequestHash(this.SignatureKey);
              var requestData = parameterHandler.GetRequestData();

              //Console.WriteLine("Request is {0}", string.Join(", ", requestData.AllKeys.Select(key => key + ": " + requestData[key]).ToArray()));

              var response = ALURequest.SendRequest(this, requestData);

              //Console.WriteLine("Response: {0}", response);

              return ALUResponse.FromString(response);
        }
Example #2
0
        public virtual void button1Clicked(object sender, EventArgs args)
        {
            var parameters = new OrderDetails();

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

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

            parameters.OrderDate = DateTime.Now;
            parameters.ProductDetails.Add(new ProductDetails
                                       {
                Code = "TCK1",
                Name = "Ticket1",
                Quantity = 1,
                UnitPrice = 1M,
                Information = "Barcelona flight"
            });
            parameters.ProductDetails.Add(new ProductDetails
                                       {
                Code = "TCK2",
                Name = "Ticket2",
                Quantity = 1,
                UnitPrice = 1M,
                Information = "London Flight"
            });
            parameters.PricesCurrency = "TRY";
            parameters.CardDetails = new CardDetails
            {
                CardNumber = textBoxCardNumber.Text,
                ExpiryMonth = textBoxExpiryMonth.Text,
                ExpiryYear = textBoxExpiryYear.Text,
                CVV = textBoxCVV.Text,
                CardOwnerName = textBoxCardHolderName.Text
            };
            parameters.BillingDetails = new BillingDetails
            {
                LastName = "Doe",
                FirstName = "John",
                Email = textBoxEmail.Text,
                PhoneNumber = "1234567890",
                CountryCode = "TR",
                ZipCode = "12345", //optional
                Address = "Billing address", //optional
                Address2 = "Billing address ", //optional
                City = "City", //optional
                State = "State / Dept.", //optional
                Fax = "1234567890" //optional
            };
            parameters.DeliveryDetails = new DeliveryDetails
            {
                LastName = "John", //optional
                FirstName = "Doe", //optional
                Email = "*****@*****.**", //optional
                PhoneNumber = "1234567890", //optional
                Company = "Company Name", //optional
                Address = "Delivery Address", //optional
                Address2 = "Delivery Address", //optional
                ZipCode = "12345", //optional
                City = "City", //optional
                State = "State / Dept.", //optional
                CountryCode = "TR" //optional
            };
            parameters.ReturnUrl = "~/AutomaticLiveUpdate/ThreeDS.aspx".ToAbsoluteUrl();
            parameters.ClientIpAddress = Request.UserHostAddress;
            //request.ClientTime = DateTime.UtcNow; // optional
            parameters.SelectedInstallmentNumber = Convert.ToInt32(ddlInstallmentCount.SelectedValue);

            var sb = new StringBuilder();

            try {
                var service = new ALUService("4@ET=1()T=%y3S8b(r_]", null, true);
                var response = service.ProcessPayment(parameters);

                if (response.Is3DSResponse) {
                    Response.Redirect (response.Url3DS);
                    Response.End();
                }

                sb.AppendLine ("<ul>");
                sb.AppendFormat("<li><b>{0}:</b> {1}", "RefNo", response.RefNo);
                sb.AppendFormat("<li><b>{0}:</b> {1}", "Alias", response.Alias);
                sb.AppendFormat("<li><b>{0}:</b> {1}", "Status", response.Status);
                sb.AppendFormat("<li><b>{0}:</b> {1}", "ReturnCode", response.ReturnCode);
                sb.AppendFormat("<li><b>{0}:</b> {1}", "ReturnMessage", response.ReturnMessage);
                sb.AppendFormat("<li><b>{0}:</b> {1}", "Date", response.Date);
                sb.AppendFormat("<li><b>{0}:</b> {1}", "Url3DS", response.Url3DS);
                sb.AppendFormat("<li><b>{0}:</b> {1}", "Hash", response.Hash);
                sb.AppendLine ("</ul>");
            }
            catch (PayuException ex)
            {
                sb.AppendFormat("Exception: {0}", ex);
            }

            ltrOutput.Text = sb.ToString();
        }
Example #3
0
        public static void Run()
        {
            var order = new OrderDetails();

            order.Merchant = "TOKENTES";

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

            order.OrderRef = "EXT_" + new Random().Next(100000, 999999).ToString();
            order.OrderDate = DateTime.UtcNow;
            order.ProductDetails.Add(new ProductDetails
            {
                Code = "SPTHAR031092",
                Name = "HARDLINE SOY PRO (90SOYAPROTEINI)",
                Quantity = 1,
                UnitPrice = 1M
            });

            order.ProductDetails.Add(new ProductDetails
            {
                Code = "SPTHAR031093",
                Name = "HARDLINE SOY",
                Quantity = 1,
                UnitPrice = 1M
            });
            order.PricesCurrency = "TRY";

            order.CardDetails = new CardDetails
            {
                CardNumber = "4242424242424242",
                ExpiryMonth = "12",
                ExpiryYear = "2015",
                CVV = "000",
                CardOwnerName = "Mehmet Coşkun"
            };
            order.BillingDetails = new BillingDetails
            {
                FirstName = "Mehmet",
                LastName = "Coşkun",
                Email = "*****@*****.**",
                PhoneNumber = "2122223344",
                City = "Kağıthane", //Ilce/Semt
                State = "Istanbul", //Sehir
                CountryCode = "TR"
            };
            order.ReturnUrl = "http://178.18.33.6/direct.php";
            order.ClientIpAddress = "10.10.10.5";
            order.ClientTime = DateTime.UtcNow;
            order.SelectedInstallmentNumber = 1;

            order.UseLoyaltyPoints = true;
            order.LoyaltyPointsAmount = 0.12M;
            order.ShippingCost = 1.32M;

            order.SelectedInstallmentNumber = 5;
            order.CampaignType = CampaignType.DelayInstallments;

            var service = new ALUService("4@ET=1()T=%y3S8b(r_]");
            var response = service.ProcessPayment(order);

            Console.WriteLine("Successful: {0}", response.IsSuccess);
            Console.WriteLine("Response: {0}-{1}-{2}-{3}", response.RefNo, response.Status, response.ReturnCode, response.ReturnMessage);
        }