Improve tests of webhooks

This commit is contained in:
nicolas.dorier
2020-11-13 16:28:15 +09:00
parent 94bcbeb604
commit df79c2cf48
13 changed files with 269 additions and 30 deletions

View File

@@ -8,9 +8,85 @@ namespace BTCPayServer.Client.Models
{
public class WebhookInvoiceEvent : WebhookEvent
{
public WebhookInvoiceEvent()
{
}
public WebhookInvoiceEvent(WebhookEventType evtType)
{
this.Type = evtType;
}
[JsonProperty(Order = 1)]
public string StoreId { get; set; }
[JsonProperty(Order = 2)]
public string InvoiceId { get; set; }
public T ReadAs<T>()
{
var str = JsonConvert.SerializeObject(this, DefaultSerializerSettings);
return JsonConvert.DeserializeObject<T>(str, DefaultSerializerSettings);
}
}
public class WebhookInvoiceConfirmedEvent : WebhookInvoiceEvent
{
public WebhookInvoiceConfirmedEvent()
{
}
public WebhookInvoiceConfirmedEvent(WebhookEventType evtType) : base(evtType)
{
}
public bool ManuallyMarked { get; set; }
}
public class WebhookInvoiceInvalidEvent : WebhookInvoiceEvent
{
public WebhookInvoiceInvalidEvent()
{
}
public WebhookInvoiceInvalidEvent(WebhookEventType evtType) : base(evtType)
{
}
public bool ManuallyMarked { get; set; }
}
public class WebhookInvoicePaidEvent : WebhookInvoiceEvent
{
public WebhookInvoicePaidEvent()
{
}
public WebhookInvoicePaidEvent(WebhookEventType evtType) : base(evtType)
{
}
public bool OverPaid { get; set; }
public bool PaidAfterExpiration { get; set; }
}
public class WebhookInvoiceReceivedPaymentEvent : WebhookInvoiceEvent
{
public WebhookInvoiceReceivedPaymentEvent()
{
}
public WebhookInvoiceReceivedPaymentEvent(WebhookEventType evtType) : base(evtType)
{
}
public bool AfterExpiration { get; set; }
}
public class WebhookInvoiceExpiredEvent : WebhookInvoiceEvent
{
public WebhookInvoiceExpiredEvent()
{
}
public WebhookInvoiceExpiredEvent(WebhookEventType evtType) : base(evtType)
{
}
public bool PartiallyPaid { get; set; }
}
}