Esempio n. 1
0
        protected override void Constructor()
        {
            if (Update.Message != null && Update.Message.ReplyToMessage != null)
            {
                CommandName = Update.Message.ReplyToMessage.Text;
            }

            try
            {
                PaymentsMethodsListMsg = new PaymentsMethodsListMessage();
                if (base.Argumetns.Count > 0)
                {
                    OrderId      = Argumetns[0];
                    OrderViewMsg = new OrderViewMessage(this.OrderId);
                    MyOrdersMsg  = new MyOrdersMessage(base.FollowerId, BotInfo.Id);
                    using (MarketBotDbContext db = new MarketBotDbContext())
                        Order = db.Orders.Where(o => o.Id == this.OrderId).Include(o => o.OrderConfirm).
                                Include(o => o.OrderDone).Include(o => o.OrderDeleted).
                                Include(o => o.OrderProduct).Include(o => o.Follower).Include(o => o.FeedBack).Include(o => o.Invoice).FirstOrDefault();
                    CheckPayMsg = new CheckPayMessage(Order);
                }

                RequestPhoneNumberMsg = new RequestPhoneNumberMessage(base.FollowerId);
                ViewShipAddressMsg    = new AddressListMessage(base.FollowerId);
                OrderPreviewMsg       = new OrderTempMessage(base.FollowerId, BotInfo.Id);
            }

            catch
            {
            }

            finally
            {
            }
        }
Esempio n. 2
0
 protected override void Initializer()
 {
     RequestPhoneNumberMessageMsg = new RequestPhoneNumberMessage();
 }
Esempio n. 3
0
        /// <summary>
        /// Пользователь выбрал методо оплаты
        /// </summary>
        /// <returns></returns>
        private async Task <IActionResult> SelectPaymentMethod()
        {
            OrderFunction = new OrderFunction();

            int PaymentTypeId = 0;

            bool TestConnection = false;

            bool ExistUserName = false;

            bool ExistTelephone = false;

            OrderTemp orderTemp = null;

            ConfigurationBot = GetConfigurationBot(BotInfo.Id);

            if (Argumetns.Count > 0)
            {
                PaymentTypeId = Argumetns[0];

                TestConnection = OrderFunction.PaymentTypeTestConnection(PaymentTypeId);
            }

            if (TestConnection == false)
            {
                await AnswerCallback("Ошибка. Данный способ оплаты недоступен!", true);

                OrderFunction.Dispose();
                return(OkResult);
            }

            if (TestConnection)
            {
                orderTemp = OrderFunction.AddPaymentMethodToOrderTmp(FollowerId, BotInfo.Id, PaymentTypeId);
                OrderFunction.Dispose();
            }


            //Данные о выбраном способоне оплаты успешно занесены в БД.
            //Если в настройках бота включена верификация по номеру телефона, то проверяем указан ли номер телефона у этого пользователя
            //Если не указан то просим указать
            ExistTelephone = FollowerFunction.ExistTelephone(FollowerId);
            if (orderTemp != null && ConfigurationBot != null && ConfigurationBot.VerifyTelephone && !ExistTelephone)
            {
                BotMessage = new RequestPhoneNumberMessage();
                await SendMessage(BotMessage.BuildMsg());
            }
            //телефон указан
            if (orderTemp != null && ConfigurationBot != null && ConfigurationBot.VerifyTelephone && ExistTelephone)
            {
                return(await SendOrderTemp());
            }


            //Данные о выбраном способоне оплаты успешно занесены в БД.
            //Если в настройках бота верификация по телефону отключена, проверяем указан ли у пользователя UserName
            ExistUserName = FollowerFunction.ExistUserName(FollowerId);
            if (orderTemp != null && ConfigurationBot != null && !ConfigurationBot.VerifyTelephone && !ExistUserName)
            {
                return(await SendUserNameAddedFaq());
            }

            //UserName указан
            if (orderTemp != null && ConfigurationBot != null && !ConfigurationBot.VerifyTelephone && ExistUserName)
            {
                return(await SendOrderTemp());
            }


            return(OkResult);
        }
Esempio n. 4
0
 protected override void Constructor()
 {
     RequestPhoneNumberMessageMsg = new RequestPhoneNumberMessage(base.FollowerId);
     OrderPreviewMsg = new OrderTempMessage(base.FollowerId, BotInfo.Id);
 }