2017-10-24 18:41:01 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace BTCPayServer.Data
|
|
|
|
|
{
|
|
|
|
|
public class HistoricalAddressInvoiceData
|
|
|
|
|
{
|
2017-10-27 10:53:04 +02:00
|
|
|
|
public string InvoiceDataId
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
2017-10-24 18:41:01 +02:00
|
|
|
|
|
2018-01-08 17:56:37 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Some crypto currencies share same address prefix
|
|
|
|
|
/// For not having exceptions thrown by two address on different network, we suffix by "#CRYPTOCODE"
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Obsolete("Use GetCryptoCode instead")]
|
2017-10-27 10:53:04 +02:00
|
|
|
|
public string Address
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
2017-10-24 18:41:01 +02:00
|
|
|
|
|
2017-12-21 07:52:04 +01:00
|
|
|
|
|
|
|
|
|
[Obsolete("Use GetCryptoCode instead")]
|
|
|
|
|
public string CryptoCode { get; set; }
|
|
|
|
|
|
|
|
|
|
#pragma warning disable CS0618
|
|
|
|
|
public string GetCryptoCode()
|
|
|
|
|
{
|
|
|
|
|
return string.IsNullOrEmpty(CryptoCode) ? "BTC" : CryptoCode;
|
|
|
|
|
}
|
2018-01-08 17:56:37 +01:00
|
|
|
|
public string GetAddress()
|
|
|
|
|
{
|
|
|
|
|
if (Address == null)
|
|
|
|
|
return null;
|
2018-02-17 05:18:16 +01:00
|
|
|
|
var index = Address.IndexOf("#", StringComparison.InvariantCulture);
|
2018-01-08 17:56:37 +01:00
|
|
|
|
if (index == -1)
|
|
|
|
|
return Address;
|
|
|
|
|
return Address.Substring(0, index);
|
|
|
|
|
}
|
|
|
|
|
public HistoricalAddressInvoiceData SetAddress(string depositAddress, string cryptoCode)
|
|
|
|
|
{
|
|
|
|
|
Address = depositAddress + "#" + cryptoCode;
|
|
|
|
|
CryptoCode = cryptoCode;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2017-12-21 07:52:04 +01:00
|
|
|
|
#pragma warning restore CS0618
|
|
|
|
|
|
2017-10-27 10:53:04 +02:00
|
|
|
|
public DateTimeOffset Assigned
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
2017-10-24 18:41:01 +02:00
|
|
|
|
|
2017-10-27 10:53:04 +02:00
|
|
|
|
public DateTimeOffset? UnAssigned
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-10-24 18:41:01 +02:00
|
|
|
|
}
|