2018-01-14 14:06:06 +01:00
|
|
|
namespace BTCPayServer.Events
|
|
|
|
{
|
|
|
|
public class InvoiceIPNEvent
|
|
|
|
{
|
2018-01-18 12:56:55 +01:00
|
|
|
public InvoiceIPNEvent(string invoiceId, int? eventCode, string name)
|
2018-01-14 14:06:06 +01:00
|
|
|
{
|
|
|
|
InvoiceId = invoiceId;
|
2018-01-18 12:56:55 +01:00
|
|
|
EventCode = eventCode;
|
|
|
|
Name = name;
|
2018-01-14 14:06:06 +01:00
|
|
|
}
|
|
|
|
|
2018-01-18 12:56:55 +01:00
|
|
|
public int? EventCode { get; set; }
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
2018-01-14 14:06:06 +01:00
|
|
|
public string InvoiceId { get; set; }
|
|
|
|
public string Error { get; set; }
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
{
|
2018-01-18 12:56:55 +01:00
|
|
|
string ipnType = "IPN";
|
2020-06-28 10:55:27 +02:00
|
|
|
if (EventCode.HasValue)
|
2018-01-18 12:56:55 +01:00
|
|
|
{
|
|
|
|
ipnType = $"IPN ({EventCode.Value} {Name})";
|
|
|
|
}
|
2018-01-14 14:06:06 +01:00
|
|
|
if (Error == null)
|
2018-01-18 12:56:55 +01:00
|
|
|
return $"{ipnType} sent for invoice {InvoiceId}";
|
|
|
|
return $"Error while sending {ipnType}: {Error}";
|
2018-01-14 14:06:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|