GreenField: Invoice API

This commit is contained in:
Kukks
2020-07-22 13:58:41 +02:00
committed by nicolas.dorier
parent 8239fd7e0e
commit 34e76494e3
11 changed files with 509 additions and 4 deletions

View File

@@ -0,0 +1,142 @@
using System;
using BTCPayServer.JsonConverters;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace BTCPayServer.Client.Models
{
public class CreateInvoiceRequest
{
[JsonProperty(ItemConverterType = typeof(DecimalDoubleStringJsonConverter))]
public decimal Amount
{
get;
set;
}
public string Currency
{
get;
set;
}
public ProductInformation Metadata { get; set; }
public BuyerInformation Customer { get; set; } = new BuyerInformation();
public CheckoutOptions Checkout { get; set; } = new CheckoutOptions();
public class CheckoutOptions
{
[JsonConverter(typeof(StringEnumConverter))]
public SpeedPolicy? SpeedPolicy { get; set; }
public string[] PaymentMethods { get; set; }
public bool? RedirectAutomatically { get; set; }
public string RedirectUri { get; set; }
public Uri WebHook { get; set; }
[JsonConverter(typeof(NBitcoin.JsonConverters.DateTimeToUnixTimeConverter))]
public DateTimeOffset? ExpirationTime { get; set; }
[JsonProperty(ItemConverterType = typeof(DecimalDoubleStringJsonConverter))]
public double? PaymentTolerance { get; set; }
}
public class BuyerInformation
{
[JsonProperty(PropertyName = "buyerName")]
public string BuyerName
{
get;
set;
}
[JsonProperty(PropertyName = "buyerEmail")]
public string BuyerEmail
{
get;
set;
}
[JsonProperty(PropertyName = "buyerCountry")]
public string BuyerCountry
{
get;
set;
}
[JsonProperty(PropertyName = "buyerZip")]
public string BuyerZip
{
get;
set;
}
[JsonProperty(PropertyName = "buyerState")]
public string BuyerState
{
get;
set;
}
[JsonProperty(PropertyName = "buyerCity")]
public string BuyerCity
{
get;
set;
}
[JsonProperty(PropertyName = "buyerAddress2")]
public string BuyerAddress2
{
get;
set;
}
[JsonProperty(PropertyName = "buyerAddress1")]
public string BuyerAddress1
{
get;
set;
}
[JsonProperty(PropertyName = "buyerPhone")]
public string BuyerPhone
{
get;
set;
}
}
public class ProductInformation
{
public string OrderId { get; set; }
public string PosData { get; set; }
public string ItemDesc
{
get;
set;
}
public string ItemCode
{
get;
set;
}
public bool Physical
{
get;
set;
}
public decimal? TaxIncluded
{
get;
set;
}
}
}
}