public override async Task Process(TelegramShopClient telegramShop, MessageEventArgs e, ShopUserModel userModel) { ShopUserRepository.UpdateUserDialogState(userModel, EDialogState.PaymentMethod); ShopUserRepository.UpdateUserLicenseDuration(userModel, this.daysCount, this.price); await telegramShop.SendMessage(e.Message.Chat.Id, this.GetPaymentMethodMessage(userModel), GetKeyboard(userModel.CurrentDialogState)); }
public override async Task Process(TelegramShopClient telegramShop, MessageEventArgs e, ShopUserModel userModel) { ShopUserRepository.UpdateUserDialogState(userModel, EDialogState.LicenseDuration); ShopUserRepository.UpdateUserBuyLicenseKey(userModel, this.licenseKey); await telegramShop.SendMessage(e.Message.Chat.Id, AnswerMessage.LicenseDurationMenu, GetKeyboard(userModel.CurrentDialogState)); }
public override async Task Process(TelegramShopClient telegramShop, MessageEventArgs e, ShopUserModel userModel) { ShopUserRepository.UpdateUserDialogState(userModel, EDialogState.LicenseRenewSubscription); var keyboard = GetKeyboard(userModel.CurrentDialogState); await telegramShop.SendMessage(e.Message.Chat.Id, GetAllUsersLicenseMessage(userModel), keyboard); await telegramShop.SendMessage(e.Message.Chat.Id, AnswerMessage.SendMeLicenseKeyToStartRenew, keyboard); }
public override async Task Process(TelegramShopClient telegramShop, MessageEventArgs e, ShopUserModel userModel) { ShopUserRepository.UpdateUserDialogState(userModel, this.dialogState); await telegramShop.SendMessage(e.Message.Chat.Id, this.message, GetKeyboard(userModel.CurrentDialogState)); }
public override async Task Process(TelegramShopClient telegramShop, MessageEventArgs e, ShopUserModel userModel) { ShopUserRepository.UpdateUserDialogState(userModel, EDialogState.QiwiPaymentVerification); await telegramShop.SendMessage(e.Message.Chat.Id, GetQiwiPaymentMessage(userModel), GetKeyboard(userModel.CurrentDialogState)); }
public override async Task Process(TelegramShopClient telegramShop, MessageEventArgs e, ShopUserModel userModel) { ShopUserRepository.UpdateUserDialogState(userModel, EDialogState.QiwiPaymentVerification); if (cachedPayments != null && IsCachedOld() == false) { await telegramShop.SendMessage( e.Message.Chat.Id, GetQiwiTimeToNewRequestLeftMessage(), GetKeyboard(userModel.CurrentDialogState)); return; } var payments = telegramShop.Qiwi.GetIncomingTransactions().Result; lastRequestDate = DateTime.Now; cachedPayments = payments; var isPaymentPresent = IsPaymentPresent( userModel.LicenseBuyProcess.Comment, userModel.LicenseBuyProcess.Price, payments); if (isPaymentPresent) { await telegramShop.BoldLog($"@{userModel.Telegram} bought license for {userModel.LicenseBuyProcess.Days} days for {userModel.LicenseBuyProcess.Price} RUB"); ShopUserRepository.UpdateUserDialogState(userModel, EDialogState.Main); if (userModel.LicenseBuyProcess.LicenseKey == null) { var newLicenseKey = GetNewLicenseKey(userModel.Telegram); LicenseServerHandler.GetNewLicense(userModel.LicenseBuyProcess.Days); ShopUserRepository.AddLicenseKey(userModel, newLicenseKey); await telegramShop.SendMessage( e.Message.Chat.Id, GetQiwiNewLicenseKeyAddedMessage(newLicenseKey, userModel.LicenseBuyProcess.Days), GetKeyboard(userModel.CurrentDialogState)); } else { LicenseServerHandler.AddDaysForExistLicense( userModel.LicenseBuyProcess.LicenseKey, userModel.LicenseBuyProcess.Days); await telegramShop.SendMessage( e.Message.Chat.Id, GetQiwiLicenseKeyDaysAddedMessage( userModel.LicenseBuyProcess.LicenseKey, userModel.LicenseBuyProcess.Days), GetKeyboard(userModel.CurrentDialogState)); } ShopUserRepository.UpdatePurchaseUniqueComment(userModel, null); ShopUserRepository.UpdateUserBuyLicenseKey(userModel, null); ShopUserRepository.UpdateUserLicenseDuration(userModel, 0, 0); } else { await telegramShop.SendMessage( e.Message.Chat.Id, GetQiwiTimeToNewRequestLeftMessage(), GetKeyboard(userModel.CurrentDialogState)); } }
public override async Task Process(TelegramShopClient telegramShop, MessageEventArgs e, ShopUserModel userModel) { ShopUserRepository.UpdateUserDialogState(userModel, EDialogState.ManageLicense); await telegramShop.SendMessage(e.Message.Chat.Id, AnswerMessage.LicenseManageMenuTitle, GetKeyboard(userModel.CurrentDialogState)); }