private void SetValues(InvoiceStatusChangedTriggerViewModel from, RecipeTrigger to) { to.ExternalServiceId = from.ExternalServiceId; to.RecipeId = from.RecipeId; var currentData = to.Get <InvoiceStatusChangedTriggerParameters>(); currentData.Status = from.Status; to.Set(currentData); }
private void SetValues(RecipeTrigger from, InvoiceStatusChangedTriggerViewModel to) { to.RecipeId = from.RecipeId; to.ExternalServiceId = from.ExternalServiceId; var fromData = from.Get <InvoiceStatusChangedTriggerParameters>(); to.Status = fromData.Status; to.Statuses = new SelectList(AllowedStatuses, "Value", "Text", fromData.Status); }
protected override Task <NBXplorerNewBlockViewModel> BuildViewModel(RecipeTrigger data) { var innerData = data.Get <NBXplorerNewBlockTriggerParameters>(); return(Task.FromResult(new NBXplorerNewBlockViewModel() { CryptoCodes = new SelectList(_options.Cryptos?.ToList() ?? new List <string>(), innerData.CryptoCode), RecipeId = data.RecipeId, CryptoCode = innerData.CryptoCode })); }
private void SetValues(RecipeTrigger from, ReceivedEmailViewModel to) { to.RecipeId = from.RecipeId; to.ExternalServiceId = from.ExternalServiceId; var fromData = from.Get <ReceivedEmailTriggerParameters>(); to.Body = fromData.Body; to.Subject = fromData.Subject; to.FromEmail = fromData.FromEmail; to.BodyComparer = fromData.BodyComparer; to.SubjectComparer = fromData.SubjectComparer; }
public Task <bool> IsTriggered(ITrigger trigger, RecipeTrigger recipeTrigger) { if (recipeTrigger.TriggerId != trigger.Id || trigger.Id != TriggerId) { return(Task.FromResult(false)); } var triggerData = trigger.Get <TTriggerData>(); if (typeof(TTriggerParameters).IsAssignableFrom(typeof(IUseExternalService)) && ((IUseExternalService)triggerData).ExternalServiceId != recipeTrigger.ExternalServiceId) { return(Task.FromResult(false)); } return(IsTriggered(trigger, recipeTrigger, triggerData, recipeTrigger.Get <TTriggerParameters>())); }
public async Task <bool> IsTriggered(ITrigger trigger, RecipeTrigger recipeTrigger) { if (recipeTrigger.TriggerId != trigger.Id || trigger.Id != TriggerId) { return(false); } var triggerData = await GetTriggerData(trigger); if (typeof(IUseExternalService).IsAssignableFrom(typeof(TTriggerData)) && ((IUseExternalService)triggerData).ExternalServiceId != recipeTrigger.ExternalServiceId) { return(false); } return(await IsTriggered(trigger, recipeTrigger, triggerData, recipeTrigger.Get <TTriggerParameters>())); }
protected override async Task <NBXplorerNewTransactionViewModel> BuildViewModel(RecipeTrigger data) { var innerData = data.Get <NBXplorerNewTransactionTriggerParameters>(); var services = await _externalServiceManager.GetExternalServicesData(new ExternalServicesDataQuery() { Type = new[] { NBXplorerWalletService.NBXplorerWalletServiceType }, UserId = GetUserId() }); return(new NBXplorerNewTransactionViewModel() { ExternalServiceId = data.ExternalServiceId, ExternalServices = new SelectList(services, nameof(ExternalServiceData.Id), nameof(ExternalServiceData.Name), data.ExternalServiceId), RecipeId = data.RecipeId, ConfirmationsRequired = innerData.ConfirmationsRequired, }); }
protected override async Task <ReceivedLightningPaymentViewModel> BuildViewModel(RecipeTrigger data) { var services = await _externalServiceManager.GetExternalServicesData(new ExternalServicesDataQuery() { Type = new[] { LightningNodeService.LightningNodeServiceType }, UserId = GetUserId() }); var innerData = data.Get <ReceivedLightningPaymentTriggerParameters>(); return(new ReceivedLightningPaymentViewModel() { ExternalServices = new SelectList(services, nameof(ExternalServiceData.Id), nameof(ExternalServiceData.Name), data.ExternalServiceId), RecipeId = data.RecipeId, ExternalServiceId = data.ExternalServiceId }); }
protected override async Task <InvoiceStatusChangedTriggerViewModel> BuildViewModel(RecipeTrigger data) { var btcPayServices = await _externalServiceManager.GetExternalServicesData(new ExternalServicesDataQuery() { Type = new[] { BtcPayServerService.BtcPayServerServiceType }, UserId = GetUserId() }); var fromData = data.Get <InvoiceStatusChangedTriggerParameters>(); return(new InvoiceStatusChangedTriggerViewModel { ExternalServices = new SelectList(btcPayServices, nameof(ExternalServiceData.Id), nameof(ExternalServiceData.Name), data.ExternalServiceId), RecipeId = data.RecipeId, ExternalServiceId = data.ExternalServiceId, Conditions = fromData.Conditions, }); }
protected override async Task <CheckExchangeBalanceViewModel> BuildViewModel(RecipeTrigger data) { var innerData = data.Get <CheckExchangeBalanceTriggerParameters>(); var services = await _externalServiceManager.GetExternalServicesData(new ExternalServicesDataQuery() { Type = new[] { ExchangeService.ExchangeServiceType }, UserId = GetUserId() }); return(new CheckExchangeBalanceViewModel() { RecipeId = data.RecipeId, ExternalServiceId = data.ExternalServiceId, ExternalServices = new SelectList(services, nameof(ExternalServiceData.Id), nameof(ExternalServiceData.Name), data.ExternalServiceId), BalanceValue = innerData.BalanceValue, BalanceComparer = innerData.BalanceComparer, Asset = innerData.Asset }); }
protected override async Task <NBXplorerBalanceViewModel> BuildViewModel(RecipeTrigger data) { var innerData = data.Get <NBXplorerBalanceTriggerParameters>(); var services = await _externalServiceManager.GetExternalServicesData(new ExternalServicesDataQuery() { Type = new[] { NBXplorerWalletService.NBXplorerWalletServiceType }, UserId = GetUserId() }); return(new NBXplorerBalanceViewModel() { RecipeId = data.RecipeId, ExternalServiceId = data.ExternalServiceId, ExternalServices = new SelectList(services, nameof(ExternalServiceData.Id), nameof(ExternalServiceData.Name), data.ExternalServiceId), BalanceComparer = innerData.BalanceComparer, BalanceValue = innerData.Balance?.ToUnit(MoneyUnit.BTC) ?? 0, BalanceMoneyUnit = MoneyUnit.BTC }); }
protected override async Task <ReceivedEmailViewModel> BuildViewModel(RecipeTrigger data) { var services = await _externalServiceManager.GetExternalServicesData(new ExternalServicesDataQuery() { Type = new[] { Pop3Service.Pop3ExternalServiceType, ImapService.ImapExternalServiceType }, UserId = GetUserId() }); var innerData = data.Get <ReceivedEmailTriggerParameters>(); return(new ReceivedEmailViewModel() { ExternalServices = new SelectList(services, nameof(ExternalServiceData.Id), nameof(ExternalServiceData.Name), data.ExternalServiceId), RecipeId = data.RecipeId, ExternalServiceId = data.ExternalServiceId, Body = innerData.Body, Subject = innerData.Subject, FromEmail = innerData.FromEmail, BodyComparer = innerData.BodyComparer, SubjectComparer = innerData.SubjectComparer }); }
protected override Task <ReceiveWebRequestTriggerViewModel> BuildViewModel(RecipeTrigger data) { return(Task.FromResult(new ReceiveWebRequestTriggerViewModel(data.Get <ReceiveWebRequestTriggerParameters>(), data.RecipeId))); }
protected override Task <TimerTriggerViewModel> BuildViewModel(RecipeTrigger data) { return(Task.FromResult(new TimerTriggerViewModel(data.Get <TimerTriggerParameters>(), data.RecipeId))); }