mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04: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;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<div class="form-group">
|
||||
<label asp-for="Trigger" class="form-label" data-required></label>
|
||||
<select asp-for="Trigger" asp-items="@WebhookSender.GetSupportedWebhookTypes()
|
||||
.OrderBy(a=>a.Value).Select(s => new SelectListItem(s.Value, s.Key))"
|
||||
.OrderBy(a=>a.Value).Select(s => new SelectListItem(s.Value, s.Key))"
|
||||
class="form-select email-rule-trigger" required></select>
|
||||
<span asp-validation-for="Trigger" class="text-danger"></span>
|
||||
<div class="form-text" text-translate="true">Choose what event sends the email.</div>
|
||||
@@ -66,7 +66,7 @@
|
||||
<input type="text" asp-for="Subject" class="form-control email-rule-subject" />
|
||||
<span asp-validation-for="Subject" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="Body" class="form-label" data-required></label>
|
||||
<textarea asp-for="Body" class="form-control richtext email-rule-body" rows="4"></textarea>
|
||||
@@ -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