mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
InvoiceExpiredPaidPartial and InvoicePaidAfterExpiration webhooks
This commit is contained in:
@@ -5,11 +5,13 @@ public static class WebhookEventType
|
||||
{
|
||||
public const string InvoiceCreated = nameof(InvoiceCreated);
|
||||
public const string InvoiceReceivedPayment = nameof(InvoiceReceivedPayment);
|
||||
public const string InvoicePaymentSettled = nameof(InvoicePaymentSettled);
|
||||
public const string InvoiceProcessing = nameof(InvoiceProcessing);
|
||||
public const string InvoiceExpired = nameof(InvoiceExpired);
|
||||
public const string InvoiceSettled = nameof(InvoiceSettled);
|
||||
public const string InvoiceInvalid = nameof(InvoiceInvalid);
|
||||
public const string InvoicePaymentSettled = nameof(InvoicePaymentSettled);
|
||||
public const string InvoiceExpiredPaidPartial = nameof(InvoiceExpiredPaidPartial);
|
||||
public const string InvoicePaidAfterExpiration = nameof(InvoicePaidAfterExpiration);
|
||||
public const string PayoutCreated = nameof(PayoutCreated);
|
||||
public const string PayoutApproved = nameof(PayoutApproved);
|
||||
public const string PayoutUpdated = nameof(PayoutUpdated);
|
||||
@@ -18,5 +20,4 @@ public static class WebhookEventType
|
||||
public const string PaymentRequestArchived = nameof(PaymentRequestArchived);
|
||||
public const string PaymentRequestStatusChanged = nameof(PaymentRequestStatusChanged);
|
||||
public const string PaymentRequestCompleted = nameof(PaymentRequestCompleted);
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ public class InvoiceWebhookProvider : WebhookProvider<InvoiceEvent>
|
||||
{WebhookEventType.InvoiceExpired, "Invoice - Expired"},
|
||||
{WebhookEventType.InvoiceSettled, "Invoice - Is Settled"},
|
||||
{WebhookEventType.InvoiceInvalid, "Invoice - Became Invalid"},
|
||||
{WebhookEventType.InvoiceExpiredPaidPartial, "Invoice - Expired Paid Partial"},
|
||||
{WebhookEventType.InvoicePaidAfterExpiration, "Invoice - Expired Paid Late"},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -113,6 +115,26 @@ public class InvoiceWebhookProvider : WebhookProvider<InvoiceEvent>
|
||||
Payment = GreenfieldInvoiceController.ToPaymentModel(invoiceEvent.Invoice, invoiceEvent.Payment),
|
||||
StoreId = invoiceEvent.Invoice.StoreId
|
||||
};
|
||||
case InvoiceEventCode.ExpiredPaidPartial:
|
||||
return new WebhookInvoiceReceivedPaymentEvent(WebhookEventType.InvoiceExpiredPaidPartial, storeId)
|
||||
{
|
||||
AfterExpiration =
|
||||
invoiceEvent.Invoice.Status == InvoiceStatus.Expired ||
|
||||
invoiceEvent.Invoice.Status == InvoiceStatus.Invalid,
|
||||
PaymentMethodId = invoiceEvent.Payment.PaymentMethodId.ToString(),
|
||||
Payment = GreenfieldInvoiceController.ToPaymentModel(invoiceEvent.Invoice, invoiceEvent.Payment),
|
||||
StoreId = invoiceEvent.Invoice.StoreId
|
||||
};
|
||||
case InvoiceEventCode.PaidAfterExpiration:
|
||||
return new WebhookInvoiceReceivedPaymentEvent(WebhookEventType.InvoicePaidAfterExpiration, storeId)
|
||||
{
|
||||
AfterExpiration =
|
||||
invoiceEvent.Invoice.Status == InvoiceStatus.Expired ||
|
||||
invoiceEvent.Invoice.Status == InvoiceStatus.Invalid,
|
||||
PaymentMethodId = invoiceEvent.Payment.PaymentMethodId.ToString(),
|
||||
Payment = GreenfieldInvoiceController.ToPaymentModel(invoiceEvent.Invoice, invoiceEvent.Payment),
|
||||
StoreId = invoiceEvent.Invoice.StoreId
|
||||
};
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -163,6 +163,14 @@
|
||||
subject: 'Invoice {Invoice.Id} payment settled',
|
||||
body: 'Invoice {Invoice.Id} (Order Id: {Invoice.OrderId}) payment settled.'
|
||||
},
|
||||
@WebhookEventType.InvoiceExpiredPaidPartial: {
|
||||
subject: 'Invoice {Invoice.Id} Expired Paid Partial',
|
||||
body: 'Invoice {Invoice.Id} (Order Id: {Invoice.OrderId}) has expired partially paid.'
|
||||
},
|
||||
@WebhookEventType.InvoicePaidAfterExpiration: {
|
||||
subject: 'Invoice {Invoice.Id} Expired Paid Late',
|
||||
body: 'Invoice {Invoice.Id} (Order Id: {Invoice.OrderId}) has been paid after expiration.'
|
||||
},
|
||||
@{ var paymentRequestsLink = CallbackGenerator.PaymentRequestListLink(storeId, this.Context.Request); }
|
||||
@WebhookEventType.PaymentRequestCompleted: {
|
||||
subject: 'Payment Request {PaymentRequest.Title} {PaymentRequest.ReferenceId} Completed',
|
||||
|
||||
Reference in New Issue
Block a user