btcpayserver/BTCPayServer/Models/WalletViewModels/PullPaymentsModel.cs

101 lines
3.2 KiB
C#
Raw Normal View History

2020-06-28 21:44:35 -05:00
using System;
2020-06-24 10:34:09 +09:00
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using BTCPayServer.Client.Models;
using BTCPayServer.Data;
using BTCPayServer.Payments;
using Microsoft.AspNetCore.Mvc.Rendering;
2020-06-24 10:34:09 +09:00
namespace BTCPayServer.Models.WalletViewModels
{
2021-12-31 16:59:02 +09:00
public class PullPaymentsModel : BasePagingViewModel
2020-06-24 10:34:09 +09:00
{
public class PullPaymentModel
{
public class ProgressModel
{
public int CompletedPercent { get; set; }
public int AwaitingPercent { get; set; }
public string CompletedFormatted { get; set; }
public string AwaitingFormatted { get; set; }
public string LimitFormatted { get; set; }
2020-06-24 10:34:09 +09:00
public string EndIn { get; set; }
public decimal Awaiting { get; set; }
public decimal Completed { get; set; }
public decimal Limit { get; set; }
2020-06-24 10:34:09 +09:00
}
public string Id { get; set; }
public string Name { get; set; }
public string ProgressText { get; set; }
public ProgressModel Progress { get; set; }
public DateTimeOffset StartDate { get; set; }
public DateTimeOffset? EndDate { get; set; }
public bool AutoApproveClaims { get; set; }
public bool Archived { get; set; } = false;
2020-06-24 10:34:09 +09:00
}
public List<PullPaymentModel> PullPayments { get; set; } = new List<PullPaymentModel>();
public override int CurrentPageCount => PullPayments.Count;
public PullPaymentState ActiveState { get; set; } = PullPaymentState.Active;
2020-06-24 10:34:09 +09:00
}
public class NewPullPaymentModel
{
[MaxLength(30)]
[Display(Name = "Name")]
2020-06-24 10:34:09 +09:00
public string Name { get; set; }
[Display(Name = "Description")]
public string Description { get; set; }
2020-06-24 10:34:09 +09:00
[Required]
[Display(Name = "Amount")]
public decimal Amount { get; set; }
2020-06-24 10:34:09 +09:00
[Required]
[ReadOnly(true)]
[Display(Name = "Currency")]
2020-06-24 10:34:09 +09:00
public string Currency { get; set; }
[Display(Name = "Payout Methods")]
public IEnumerable<string> PayoutMethods { get; set; }
public IEnumerable<SelectListItem> PayoutMethodsItem { get; set; }
[Display(Name = "Minimum acceptable expiration time for BOLT11 for refunds")]
[Range(0, 365 * 10)]
public long BOLT11Expiration { get; set; } = 30;
[Display(Name = "Automatically approve claims")]
public bool AutoApproveClaims { get; set; }
2020-06-24 10:34:09 +09:00
}
public class UpdatePullPaymentModel
{
[Display(Name = "Id")]
public string Id { get; set; }
public UpdatePullPaymentModel()
{
}
public UpdatePullPaymentModel(Data.PullPaymentData data)
{
if (data == null)
{
return;
}
Id = data.Id;
var blob = data.GetBlob();
Name = blob.Name;
Description = blob.Description;
}
[MaxLength(30)]
[Display(Name = "Name")]
public string Name { get; set; }
[Display(Name = "Memo")]
public string Description { get; set; }
}
2020-06-24 10:34:09 +09:00
}