2020-06-28 21:44:35 -05:00
|
|
|
using System;
|
2019-01-02 10:41:54 +01:00
|
|
|
using System.Collections.Generic;
|
2018-12-18 16:27:03 +01:00
|
|
|
using System.ComponentModel.DataAnnotations;
|
2020-06-28 17:55:27 +09:00
|
|
|
using System.Linq;
|
2019-03-05 13:54:34 +09:00
|
|
|
using BTCPayServer.Payments;
|
2019-01-08 15:49:07 +01:00
|
|
|
using BTCPayServer.Services.Rates;
|
2018-12-18 16:27:03 +01:00
|
|
|
|
|
|
|
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; }
|
2018-12-18 16:27:03 +01:00
|
|
|
public string StoreId { get; set; }
|
|
|
|
public string AppId { get; set; }
|
2018-12-11 16:36:25 +01:00
|
|
|
public string Title { get; set; }
|
2018-12-18 16:27:03 +01:00
|
|
|
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; }
|
2018-12-18 16:27:03 +01:00
|
|
|
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; }
|
2021-09-27 04:46:56 +02:00
|
|
|
public bool SimpleDisplay { 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; }
|
2019-03-07 06:25:09 +01:00
|
|
|
public string[] AnimationColors { get; set; }
|
|
|
|
public string[] Sounds { get; set; }
|
2019-01-04 11:42:37 +01:00
|
|
|
public int ResetEveryAmount { get; set; }
|
2019-02-19 13:18:30 +09:00
|
|
|
public bool NeverReset { get; set; }
|
2018-12-18 16:27:03 +01:00
|
|
|
|
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
|
|
|
|
2018-12-18 16:27:03 +01:00
|
|
|
public class CrowdfundInfo
|
|
|
|
{
|
|
|
|
public int TotalContributors { get; set; }
|
2019-01-02 10:41:54 +01:00
|
|
|
public decimal CurrentPendingAmount { get; set; }
|
2018-12-18 16:27:03 +01:00
|
|
|
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; }
|
2019-01-02 10:41:54 +01:00
|
|
|
public Dictionary<string, decimal> PaymentStats { get; set; }
|
|
|
|
public Dictionary<string, decimal> PendingPaymentStats { get; set; }
|
2019-01-04 11:42:37 +01:00
|
|
|
public DateTime? LastResetDate { get; set; }
|
|
|
|
public DateTime? NextResetDate { get; set; }
|
2018-12-18 16:27:03 +01:00
|
|
|
}
|
2019-03-05 13:54:34 +09:00
|
|
|
public class Contribution
|
|
|
|
{
|
2020-08-09 14:43:13 +02:00
|
|
|
public PaymentMethodId PaymentMethodId { get; set; }
|
2019-03-05 13:54:34 +09:00
|
|
|
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
|
|
|
|
2020-12-12 15:25:08 +09:00
|
|
|
public bool Started => !StartDate.HasValue || DateTime.UtcNow > StartDate;
|
2019-01-07 14:39:04 +01:00
|
|
|
|
2020-12-12 15:25:08 +09:00
|
|
|
public bool Ended => EndDate.HasValue && DateTime.UtcNow > EndDate;
|
2019-01-09 12:22:36 +01:00
|
|
|
public bool DisplayPerksRanking { get; set; }
|
2021-10-04 07:54:06 +02:00
|
|
|
public bool DisplayPerksValue { get; set; }
|
2019-03-03 17:06:11 -06:00
|
|
|
public bool Enabled { get; set; }
|
2019-04-13 13:22:19 +02:00
|
|
|
public string ResetEvery { get; set; }
|
2020-02-28 12:51:15 +01:00
|
|
|
public Dictionary<string, CurrencyData> CurrencyDataPayments { get; set; }
|
2021-10-04 07:54:06 +02:00
|
|
|
public Dictionary<string, decimal> PerkValue { get; set; }
|
2018-12-18 16:27:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public class ContributeToCrowdfund
|
|
|
|
{
|
2018-12-22 15:02:16 +01:00
|
|
|
public ViewCrowdfundViewModel ViewCrowdfundViewModel { get; set; }
|
2021-10-08 13:11:00 +02:00
|
|
|
[Required] public decimal? Amount { get; set; }
|
2018-12-18 16:27:03 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|