btcpayserver/BTCPayServer/Events/InvoiceIPNEvent.cs

36 lines
930 B
C#
Raw Normal View History

2018-01-14 22:06:06 +09:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BTCPayServer.Events
{
public class InvoiceIPNEvent
{
2018-01-18 20:56:55 +09:00
public InvoiceIPNEvent(string invoiceId, int? eventCode, string name)
2018-01-14 22:06:06 +09:00
{
InvoiceId = invoiceId;
2018-01-18 20:56:55 +09:00
EventCode = eventCode;
Name = name;
2018-01-14 22:06:06 +09:00
}
2018-01-18 20:56:55 +09:00
public int? EventCode { get; set; }
public string Name { get; set; }
2018-01-14 22:06:06 +09:00
public string InvoiceId { get; set; }
public string Error { get; set; }
public override string ToString()
{
2018-01-18 20:56:55 +09:00
string ipnType = "IPN";
if(EventCode.HasValue)
{
ipnType = $"IPN ({EventCode.Value} {Name})";
}
2018-01-14 22:06:06 +09:00
if (Error == null)
2018-01-18 20:56:55 +09:00
return $"{ipnType} sent for invoice {InvoiceId}";
return $"Error while sending {ipnType}: {Error}";
2018-01-14 22:06:06 +09:00
}
}
}