diff --git a/BTCPayServer.Client/Models/CreatePullPaymentRequest.cs b/BTCPayServer.Client/Models/CreatePullPaymentRequest.cs index 3ef48c5ba..5a5394862 100644 --- a/BTCPayServer.Client/Models/CreatePullPaymentRequest.cs +++ b/BTCPayServer.Client/Models/CreatePullPaymentRequest.cs @@ -8,6 +8,7 @@ namespace BTCPayServer.Client.Models public class CreatePullPaymentRequest { public string Name { get; set; } + public string Description { get; set; } [JsonProperty(ItemConverterType = typeof(NumericStringJsonConverter))] public decimal Amount { get; set; } public string Currency { get; set; } diff --git a/BTCPayServer.Client/Models/PullPaymentBaseData.cs b/BTCPayServer.Client/Models/PullPaymentBaseData.cs index c4fc9f390..bd3bf2123 100644 --- a/BTCPayServer.Client/Models/PullPaymentBaseData.cs +++ b/BTCPayServer.Client/Models/PullPaymentBaseData.cs @@ -13,6 +13,7 @@ namespace BTCPayServer.Client.Models public DateTimeOffset? ExpiresAt { get; set; } public string Id { get; set; } public string Name { get; set; } + public string Description { get; set; } public string Currency { get; set; } [JsonConverter(typeof(NumericStringJsonConverter))] public decimal Amount { get; set; } diff --git a/BTCPayServer.Tests/GreenfieldAPITests.cs b/BTCPayServer.Tests/GreenfieldAPITests.cs index c671df5ec..df7cca19c 100644 --- a/BTCPayServer.Tests/GreenfieldAPITests.cs +++ b/BTCPayServer.Tests/GreenfieldAPITests.cs @@ -361,6 +361,7 @@ namespace BTCPayServer.Tests var result = await client.CreatePullPayment(storeId, new Client.Models.CreatePullPaymentRequest() { Name = "Test", + Description = "Test description", Amount = 12.3m, Currency = "BTC", PaymentMethods = new[] { "BTC" } @@ -369,6 +370,7 @@ namespace BTCPayServer.Tests void VerifyResult() { Assert.Equal("Test", result.Name); + Assert.Equal("Test description", result.Description); Assert.Null(result.Period); // If it contains ? it means that we are resolving an unknown route with the link generator Assert.DoesNotContain("?", result.ViewLink); diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldPullPaymentController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldPullPaymentController.cs index 88fdf5119..aa362cbf1 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldPullPaymentController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldPullPaymentController.cs @@ -133,6 +133,7 @@ namespace BTCPayServer.Controllers.Greenfield Period = request.Period, BOLT11Expiration = request.BOLT11Expiration, Name = request.Name, + Description = request.Description, Amount = request.Amount, Currency = request.Currency, StoreId = storeId, @@ -152,6 +153,7 @@ namespace BTCPayServer.Controllers.Greenfield ExpiresAt = pp.EndDate, Amount = ppBlob.Limit, Name = ppBlob.Name, + Description = ppBlob.Description, Currency = ppBlob.Currency, Period = ppBlob.Period, Archived = pp.Archived, diff --git a/BTCPayServer/Controllers/UIStorePullPaymentsController.PullPayments.cs b/BTCPayServer/Controllers/UIStorePullPaymentsController.PullPayments.cs index b87d9b867..320d92494 100644 --- a/BTCPayServer/Controllers/UIStorePullPaymentsController.PullPayments.cs +++ b/BTCPayServer/Controllers/UIStorePullPaymentsController.PullPayments.cs @@ -129,6 +129,7 @@ namespace BTCPayServer.Controllers await _pullPaymentService.CreatePullPayment(new HostedServices.CreatePullPayment() { Name = model.Name, + Description = model.Description, Amount = model.Amount, Currency = model.Currency, StoreId = storeId, diff --git a/BTCPayServer/Data/PullPayments/PullPaymentBlob.cs b/BTCPayServer/Data/PullPayments/PullPaymentBlob.cs index 8e487cbd3..63b6a4d19 100644 --- a/BTCPayServer/Data/PullPayments/PullPaymentBlob.cs +++ b/BTCPayServer/Data/PullPayments/PullPaymentBlob.cs @@ -10,6 +10,7 @@ namespace BTCPayServer.Data public class PullPaymentBlob { public string Name { get; set; } + public string Description { get; set; } public string Currency { get; set; } public int Divisibility { get; set; } [JsonConverter(typeof(NumericStringJsonConverter))] diff --git a/BTCPayServer/HostedServices/PullPaymentHostedService.cs b/BTCPayServer/HostedServices/PullPaymentHostedService.cs index b9c747f4b..2520bdacd 100644 --- a/BTCPayServer/HostedServices/PullPaymentHostedService.cs +++ b/BTCPayServer/HostedServices/PullPaymentHostedService.cs @@ -28,6 +28,7 @@ namespace BTCPayServer.HostedServices public DateTimeOffset? StartsAt { get; set; } public string StoreId { get; set; } public string Name { get; set; } + public string Description { get; set; } public decimal Amount { get; set; } public string Currency { get; set; } public string CustomCSSLink { get; set; } @@ -103,6 +104,7 @@ namespace BTCPayServer.HostedServices o.SetBlob(new PullPaymentBlob() { Name = create.Name ?? string.Empty, + Description = create.Description ?? string.Empty, Currency = create.Currency, Limit = create.Amount, Period = o.Period is long periodSeconds ? (TimeSpan?)TimeSpan.FromSeconds(periodSeconds) : null, @@ -110,7 +112,7 @@ namespace BTCPayServer.HostedServices View = new PullPaymentBlob.PullPaymentView() { Title = create.Name ?? string.Empty, - Description = string.Empty, + Description = create.Description ?? string.Empty, CustomCSSLink = create.CustomCSSLink, Email = null, EmbeddedCSS = create.EmbeddedCSS, diff --git a/BTCPayServer/Models/ViewPullPaymentModel.cs b/BTCPayServer/Models/ViewPullPaymentModel.cs index d684926da..d286945bf 100644 --- a/BTCPayServer/Models/ViewPullPaymentModel.cs +++ b/BTCPayServer/Models/ViewPullPaymentModel.cs @@ -24,6 +24,7 @@ namespace BTCPayServer.Models SelectedPaymentMethod = PaymentMethods.First().ToString(); Archived = data.Archived; Title = blob.View.Title; + Description = blob.View.Description; Amount = blob.Limit; Currency = blob.Currency; Description = blob.View.Description; diff --git a/BTCPayServer/Models/WalletViewModels/PullPaymentsModel.cs b/BTCPayServer/Models/WalletViewModels/PullPaymentsModel.cs index c9b54f3b2..faab012f1 100644 --- a/BTCPayServer/Models/WalletViewModels/PullPaymentsModel.cs +++ b/BTCPayServer/Models/WalletViewModels/PullPaymentsModel.cs @@ -35,6 +35,7 @@ namespace BTCPayServer.Models.WalletViewModels { [MaxLength(30)] public string Name { get; set; } + public string Description { get; set; } [Required] public decimal Amount { diff --git a/BTCPayServer/Views/UIPullPayment/ViewPullPayment.cshtml b/BTCPayServer/Views/UIPullPayment/ViewPullPayment.cshtml index 24ea0cb98..81a6dc537 100644 --- a/BTCPayServer/Views/UIPullPayment/ViewPullPayment.cshtml +++ b/BTCPayServer/Views/UIPullPayment/ViewPullPayment.cshtml @@ -119,9 +119,9 @@ @Model.ResetIn
} - @if (!string.IsNullOrEmpty(Model.Description) && Model.Description != "