Adding Reference Number to Payment Requests

This commit is contained in:
rockstardev
2025-03-28 22:55:13 -05:00
committed by nicolas.dorier
parent 92e7c7a5f9
commit d2debaa842
5 changed files with 26 additions and 7 deletions

View File

@@ -48,6 +48,7 @@ namespace BTCPayServer.Models.PaymentRequestViewModels
Description = blob.Description;
ExpiryDate = data.Expiry?.UtcDateTime;
Email = blob.Email;
ReferenceNumber = blob.ReferenceNumber;
AllowCustomPaymentAmounts = blob.AllowCustomPaymentAmounts;
FormResponse = blob.FormResponse is null
? null
@@ -84,6 +85,10 @@ namespace BTCPayServer.Models.PaymentRequestViewModels
[MailboxAddress]
public string Email { get; set; }
[Display(Name = "Reference Number")]
[MaxLength(50)]
public string ReferenceNumber { get; set; }
[Display(Name = "Allow payee to create invoices with custom amounts")]
public bool AllowCustomPaymentAmounts { get; set; }
@@ -106,6 +111,7 @@ namespace BTCPayServer.Models.PaymentRequestViewModels
Description = blob.Description;
ExpiryDate = data.Expiry?.UtcDateTime;
Email = blob.Email;
ReferenceNumber = blob.ReferenceNumber;
AllowCustomPaymentAmounts = blob.AllowCustomPaymentAmounts;
switch (data.Status)
{
@@ -127,6 +133,7 @@ namespace BTCPayServer.Models.PaymentRequestViewModels
}
}
public StoreBrandingViewModel StoreBranding { get; set; }
public string ReferenceNumber { get; set; }
public bool AllowCustomPaymentAmounts { get; set; }
public string Email { get; set; }
public string Status { get; set; }
@@ -147,11 +154,11 @@ namespace BTCPayServer.Models.PaymentRequestViewModels
#nullable enable
public class InvoiceList : List<PaymentRequestInvoice>
{
static HashSet<InvoiceState> stateAllowedToDisplay = new HashSet<InvoiceState>
{
new InvoiceState(InvoiceStatus.New, InvoiceExceptionStatus.None),
new InvoiceState(InvoiceStatus.New, InvoiceExceptionStatus.PaidPartial),
};
private static HashSet<InvoiceState> stateAllowedToDisplay =
[
new(InvoiceStatus.New, InvoiceExceptionStatus.None),
new(InvoiceStatus.New, InvoiceExceptionStatus.PaidPartial)
];
public InvoiceList()
{
@@ -195,7 +202,7 @@ namespace BTCPayServer.Models.PaymentRequestViewModels
public class PaymentRequestInvoicePayment
{
public static List<ViewPaymentRequestViewModel.PaymentRequestInvoicePayment>
public static List<PaymentRequestInvoicePayment>
GetViewModels(
InvoiceEntity invoice,
DisplayFormatter displayFormatter,
@@ -215,7 +222,7 @@ namespace BTCPayServer.Models.PaymentRequestViewModels
string link = paymentMethodId is null ? null : txLinkProvider.GetTransactionLink(paymentMethodId, txId);
return new ViewPaymentRequestViewModel.PaymentRequestInvoicePayment
return new PaymentRequestInvoicePayment
{
Amount = paymentEntity.PaidAmount.Gross,
Paid = paymentEntity.InvoicePaidAmount.Net,