2020-07-22 13:58:41 +02:00
|
|
|
using System;
|
2021-07-14 23:32:20 +09:00
|
|
|
using BTCPayServer.Client.JsonConverters;
|
|
|
|
using BTCPayServer.JsonConverters;
|
2020-07-22 13:58:41 +02:00
|
|
|
using Newtonsoft.Json;
|
|
|
|
using Newtonsoft.Json.Converters;
|
2021-07-14 23:32:20 +09:00
|
|
|
using Newtonsoft.Json.Linq;
|
2020-07-22 13:58:41 +02:00
|
|
|
|
|
|
|
namespace BTCPayServer.Client.Models
|
|
|
|
{
|
2021-08-03 17:03:00 +09:00
|
|
|
public enum InvoiceType
|
|
|
|
{
|
|
|
|
Standard,
|
|
|
|
TopUp
|
|
|
|
}
|
2021-07-14 23:32:20 +09:00
|
|
|
public class InvoiceDataBase
|
|
|
|
{
|
2021-08-03 17:03:00 +09:00
|
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
|
|
public InvoiceType Type { get; set; }
|
2021-07-14 23:32:20 +09:00
|
|
|
public string Currency { get; set; }
|
|
|
|
public JObject Metadata { get; set; }
|
|
|
|
public CheckoutOptions Checkout { get; set; } = new CheckoutOptions();
|
|
|
|
public class CheckoutOptions
|
|
|
|
{
|
|
|
|
|
|
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
|
|
public SpeedPolicy? SpeedPolicy { get; set; }
|
|
|
|
|
|
|
|
public string[] PaymentMethods { get; set; }
|
|
|
|
|
|
|
|
[JsonConverter(typeof(TimeSpanJsonConverter.Minutes))]
|
|
|
|
[JsonProperty("expirationMinutes")]
|
|
|
|
public TimeSpan? Expiration { get; set; }
|
|
|
|
[JsonConverter(typeof(TimeSpanJsonConverter.Minutes))]
|
|
|
|
[JsonProperty("monitoringMinutes")]
|
|
|
|
public TimeSpan? Monitoring { get; set; }
|
|
|
|
|
|
|
|
public double? PaymentTolerance { get; set; }
|
|
|
|
[JsonProperty("redirectURL")]
|
|
|
|
public string RedirectURL { get; set; }
|
|
|
|
|
|
|
|
public bool? RedirectAutomatically { get; set; }
|
|
|
|
public string DefaultLanguage { get; set; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public class InvoiceData : InvoiceDataBase
|
2020-07-22 13:58:41 +02:00
|
|
|
{
|
|
|
|
public string Id { get; set; }
|
2021-06-24 16:15:51 +02:00
|
|
|
public string StoreId { get; set; }
|
2021-08-03 17:03:00 +09:00
|
|
|
[JsonConverter(typeof(NumericStringJsonConverter))]
|
|
|
|
public decimal Amount { get; set; }
|
2020-12-10 23:34:50 +09:00
|
|
|
public string CheckoutLink { get; set; }
|
2020-07-24 09:40:37 +02:00
|
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
|
|
public InvoiceStatus Status { get; set; }
|
|
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
2020-07-27 10:43:35 +02:00
|
|
|
public InvoiceExceptionStatus AdditionalStatus { get; set; }
|
2020-08-26 21:31:08 +09:00
|
|
|
[JsonConverter(typeof(NBitcoin.JsonConverters.DateTimeToUnixTimeConverter))]
|
|
|
|
public DateTimeOffset MonitoringExpiration { get; set; }
|
|
|
|
[JsonConverter(typeof(NBitcoin.JsonConverters.DateTimeToUnixTimeConverter))]
|
|
|
|
public DateTimeOffset ExpirationTime { get; set; }
|
|
|
|
[JsonConverter(typeof(NBitcoin.JsonConverters.DateTimeToUnixTimeConverter))]
|
|
|
|
public DateTimeOffset CreatedTime { get; set; }
|
2020-07-22 13:58:41 +02:00
|
|
|
}
|
2020-11-23 15:57:05 +09:00
|
|
|
public enum InvoiceStatus
|
|
|
|
{
|
|
|
|
New,
|
|
|
|
Processing,
|
|
|
|
Expired,
|
|
|
|
Invalid,
|
|
|
|
Settled
|
|
|
|
}
|
2020-07-22 13:58:41 +02:00
|
|
|
}
|