Пример #1
0
        public CreateTicketStruct CreateTicket(string phone, double amount, string btcAddr, string email = "", bool withDelay = true)
        {
            CreateTicket model = new CreateTicket()
            {
                httpRequest   = httpRequest,
                BASE_URL      = BASE_URL,
                phone         = phone,
                amount        = amount,
                btcAddr       = btcAddr,
                TICKET_ACTION = PAIR
            };

            try
            {
                Random r = new Random();

                model.MainPage();
                App.actionsLog.Append(new ActionDataItem(phone, "MainPage loaded success"));

                if (withDelay)
                {
                    Thread.Sleep(r.Next(App.settings.cache365.delay_before_each_step_from, App.settings.cache365.delay_before_each_step_to));
                }
                model.Step1Page();

                App.actionsLog.Append(new ActionDataItem(phone, "Step1Page loaded success"));

                if (withDelay)
                {
                    Thread.Sleep(r.Next(App.settings.cache365.delay_before_each_step_from, App.settings.cache365.delay_before_each_step_to));
                }
                model.Step2Page(email);

                App.actionsLog.Append(new ActionDataItem(phone, "Step2Page loaded success"));

                if (withDelay)
                {
                    Thread.Sleep(r.Next(App.settings.cache365.delay_before_each_step_from, App.settings.cache365.delay_before_each_step_to));
                }
                model.Step3Page();

                App.actionsLog.Append(new ActionDataItem(phone, "Step3Page loaded success"));

                string finalContent = model.finalStepContent;

                if (withDelay)
                {
                    Thread.Sleep(r.Next(App.settings.cache365.delay_before_get_qiwi_number_from, App.settings.cache365.delay_before_get_qiwi_number_to));
                }

                var qiwiNumber = model
                                 .GetQIWINumber()
                                 .GetPhone();

                App.actionsLog.Append(new ActionDataItem(phone, "qiwiNumber loaded success"));

                return(new CreateTicketStruct()
                {
                    content = finalContent,
                    qiwiNumber = qiwiNumber
                });
            }
            catch (Exception) { return(new CreateTicketStruct()); }
        }