btcpayserver/BTCPayServer/Models/AppViewModels/ViewCrowdfundViewModel.cs

90 lines
3.5 KiB
C#
Raw Normal View History

2020-06-28 21:44:35 -05:00
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
2020-06-28 17:55:27 +09:00
using System.Linq;
using BTCPayServer.Payments;
2019-01-08 15:49:07 +01:00
using BTCPayServer.Services.Rates;
namespace BTCPayServer.Models.AppViewModels
2018-12-11 16:36:25 +01:00
{
public class ViewCrowdfundViewModel
{
2019-03-09 16:08:31 +09:00
public string HubPath { get; set; }
public string StoreId { get; set; }
public string AppId { get; set; }
2018-12-11 16:36:25 +01:00
public string Title { get; set; }
public string Description { get; set; }
2018-12-22 15:02:16 +01:00
public string MainImageUrl { get; set; }
2018-12-22 15:43:40 +01:00
public string EmbeddedCSS { get; set; }
2018-12-11 16:36:25 +01:00
public string CustomCSSLink { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
public string TargetCurrency { get; set; }
public decimal? TargetAmount { get; set; }
public bool EnforceTargetAmount { get; set; }
public CrowdfundInfo Info { get; set; }
2018-12-22 15:02:16 +01:00
public string Tagline { get; set; }
2018-12-29 11:52:07 +01:00
public ViewPointOfSaleViewModel.Item[] Perks { get; set; }
2018-12-31 11:38:05 +01:00
public bool DisqusEnabled { get; set; }
public bool SoundsEnabled { get; set; }
public string DisqusShortname { get; set; }
public bool AnimationsEnabled { get; set; }
public string[] AnimationColors { get; set; }
public string[] Sounds { get; set; }
public int ResetEveryAmount { get; set; }
public bool NeverReset { get; set; }
2019-01-08 15:10:05 +01:00
public Dictionary<string, int> PerkCount { get; set; }
2019-01-08 15:49:07 +01:00
public CurrencyData CurrencyData { get; set; }
2020-06-28 17:55:27 +09:00
public class CrowdfundInfo
{
public int TotalContributors { get; set; }
public decimal CurrentPendingAmount { get; set; }
public decimal CurrentAmount { get; set; }
2018-12-22 15:02:16 +01:00
public decimal? ProgressPercentage { get; set; }
2018-12-28 17:38:20 +01:00
public decimal? PendingProgressPercentage { get; set; }
2019-01-02 09:45:04 +01:00
public DateTime LastUpdated { get; set; }
public Dictionary<string, decimal> PaymentStats { get; set; }
public Dictionary<string, decimal> PendingPaymentStats { get; set; }
public DateTime? LastResetDate { get; set; }
public DateTime? NextResetDate { get; set; }
}
public class Contribution
{
public PaymentMethodId PaymentMethodId { get; set; }
public decimal Value { get; set; }
public decimal CurrencyValue { get; set; }
}
public class Contributions : Dictionary<PaymentMethodId, Contribution>
{
public Contributions(IEnumerable<KeyValuePair<PaymentMethodId, Contribution>> collection) : base(collection)
{
TotalCurrency = Values.Select(v => v.CurrencyValue).Sum();
}
public decimal TotalCurrency { get; }
}
2019-01-07 14:39:04 +01:00
public bool Started => !StartDate.HasValue || DateTime.UtcNow > StartDate;
2019-01-07 14:39:04 +01:00
public bool Ended => EndDate.HasValue && DateTime.UtcNow > EndDate;
2019-01-09 12:22:36 +01:00
public bool DisplayPerksRanking { get; set; }
public bool Enabled { get; set; }
public string ResetEvery { get; set; }
public Dictionary<string, CurrencyData> CurrencyDataPayments { get; set; }
}
public class ContributeToCrowdfund
{
2018-12-22 15:02:16 +01:00
public ViewCrowdfundViewModel ViewCrowdfundViewModel { get; set; }
[Required] public decimal Amount { get; set; }
public string Email { get; set; }
2018-12-29 11:52:07 +01:00
public string ChoiceKey { get; set; }
public bool RedirectToCheckout { get; set; }
public string RedirectUrl { get; set; }
2018-12-11 16:36:25 +01:00
}
}