示例#1
0
        public static void ProcessPaymentNotification()
        {
            Guid userId = new Guid("92A8AA97-294C-487F-8B82-4DA9836C1136");
            User user   = DbCommonManager.GetUser(userId);

            Configuration config = new Configuration();

            config.PayUFailureUrl = "FailureUrl";
            config.PayUSuccessUrl = "FailureUrl";
            config.PayUSalt       = "Salt";
            config.PayUKey        = "Key";

            PayUManager payUManager = new PayUManager(config);
            Payment     payment     = new Payment();

            payment.customerEmail         = "*****@*****.**";
            payment.customerPhone         = "9986249131";
            payment.customerName          = "MuthuPP";
            payment.amount                = 135.00M;
            payment.notificationId        = "123456";
            payment.paymentId             = "12345678";
            payment.paymentMode           = "DC";
            payment.productInfo           = "ProductInfo";
            payment.split_info            = "split_info";
            payment.status                = "Success";
            payment.merchantTransactionId = "1";
            payment.udf1 = "92A8AA97-294C-487F-8B82-4DA9836C1136";

            Status status = payUManager.ProcessPayment(payment);
        }
示例#2
0
        public void TestInitiateCheckout()
        {
            Guid userId = new Guid("92A8AA97-294C-487F-8B82-4DA9836C1136");
            User user   = DbCommonManager.GetUser(userId);

            Configuration config      = new Configuration();
            PayUManager   payUManager = new PayUManager(config);

            CheckoutRequest cr = new CheckoutRequest();

            cr.User          = user;
            cr.CheckoutItems = new CheckoutItems();
            cr.CheckoutItems.TotalCalcPrice = 135;

            List <CheckoutItem> cil = new List <CheckoutItem>();
            CheckoutItem        ci  = new CheckoutItem();

            ci.SID  = 1;
            ci.Qty  = 1;
            ci.ID   = 1;
            ci.IPID = 1;
            cil.Add(ci);

            cr.CheckoutItems.Items = cil.ToArray();

            CheckoutResponse response = payUManager.InitiateCheckout(cr);
        }
示例#3
0
        public static bool IsUserNameAvailable(string userName)
        {
            bool available = false;

            if (string.IsNullOrWhiteSpace(userName))
            {
                return(available);
            }
            User user = DbCommonManager.GetUser(userName);

            available = user == null ? true : false;

            return(available);
        }
示例#4
0
        public static LoginResponse Login(LoginRequest loginRequest)
        {
            LoginResponse response = new LoginResponse();

            response.Status = LoginStatus.Failure;

            if (loginRequest == null)
            {
                response.Status = LoginStatus.InvalidInput;
                return(response);
            }
            if (string.IsNullOrWhiteSpace(loginRequest.UserName) ||
                string.IsNullOrWhiteSpace(loginRequest.Password))
            {
                response.Status = LoginStatus.InvalidUserNamePassword;
                return(response);
            }

            User user = DbCommonManager.GetUser(loginRequest.UserName);

            if (user == null)
            {
                response.Status = LoginStatus.InvalidUser;
                return(response);
            }

            string hashedPassword = CryptoHelper.ComputeSHA256Hash(loginRequest.Password.ToLowerInvariant());

            if (!user.Password.Equals(hashedPassword))
            {
                response.Status = LoginStatus.InvalidUserNamePassword;
                return(response);
            }

            string token = LoginDbManager.CreateToken(user);

            if (string.IsNullOrWhiteSpace(token))
            {
                response.Status = LoginStatus.InvalidToken;
                return(response);
            }
            response.Status = LoginStatus.Success;
            response.Token  = token;
            response.User   = user;

            return(response);
        }
示例#5
0
        public static void InitiateCheckout()
        {
            Guid userId = new Guid("92A8AA97-294C-487F-8B82-4DA9836C1136");
            User user   = DbCommonManager.GetUser(userId);

            Configuration config = new Configuration();

            config.PayUFailureUrl = "FailureUrl";
            config.PayUSuccessUrl = "SuccessUrl";
            config.PayUSalt       = "Salt";
            config.PayUKey        = "Key";

            PayUManager payUManager = new PayUManager(config);

            CheckoutRequest cr = new CheckoutRequest();

            cr.User                    = user;
            cr.DeliveryAddress         = new OrderDeliveryAddressMap();
            cr.DeliveryAddress.City    = "Bangalore";
            cr.DeliveryAddress.ZipCode = "560068";
            cr.DeliveryAddress.State   = "Karnataka";
            cr.DeliveryAddress.Address = "No 204 Sunnyvale apartment, 15th main road, AECS layout block A, Singasandra/Kudlu";

            CheckoutItems coi = new CheckoutItems();

            cr.CheckoutItems = coi;
            List <CheckoutItem> cil = new List <CheckoutItem>();
            CheckoutItem        ci  = new CheckoutItem();

            ci.SID       = 1;
            ci.Qty       = 1;
            ci.ID        = 1;
            ci.IPID      = 1;
            ci.CalcPrice = 135;
            cil.Add(ci);
            cr.CheckoutItems.Items          = cil.ToArray();
            cr.CheckoutItems.TotalCalcPrice = 135;

            CheckoutResponse response = payUManager.InitiateCheckout(cr);
        }