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 != "
") + @if (!string.IsNullOrEmpty(Model.Description)) { -
@Safe.Raw(Model.Description)
+
@Safe.Raw(Model.Description)
} diff --git a/BTCPayServer/Views/UIStorePullPayments/NewPullPayment.cshtml b/BTCPayServer/Views/UIStorePullPayments/NewPullPayment.cshtml index a96644ccf..668182bdb 100644 --- a/BTCPayServer/Views/UIStorePullPayments/NewPullPayment.cshtml +++ b/BTCPayServer/Views/UIStorePullPayments/NewPullPayment.cshtml @@ -5,15 +5,25 @@ ViewData.SetActivePage(StoreNavPages.PullPayments, "New pull payment", Context.GetStoreData().Id); } +@section PageHeadContent { + +} + +@section PageFootContent { + + +} +

@ViewData["Title"]

-
-
-
+ +
+
@@ -44,6 +54,13 @@ }
+
+
+
+ + + +
Additional Options
@@ -98,6 +115,6 @@
- +
-
+ diff --git a/BTCPayServer/bundleconfig.json b/BTCPayServer/bundleconfig.json index 93a9d4ea5..a66c483db 100644 --- a/BTCPayServer/bundleconfig.json +++ b/BTCPayServer/bundleconfig.json @@ -153,12 +153,26 @@ "wwwroot/payment-request-admin/**/*.js" ] }, + { + "outputFileName": "wwwroot/bundles/pull-payment-admin-bundle.min.js", + "inputFiles": [ + "wwwroot/js/summernote-options.js", + "wwwroot/vendor/summernote/summernote-bs5.js", + "wwwroot/pull-payment-admin/**/*.js" + ] + }, { "outputFileName": "wwwroot/bundles/payment-request-admin-bundle.min.css", "inputFiles": [ "wwwroot/vendor/summernote/summernote-bs5.css" ] }, + { + "outputFileName": "wwwroot/bundles/pull-payment-admin-bundle.min.css", + "inputFiles": [ + "wwwroot/vendor/summernote/summernote-bs5.css" + ] + }, { "outputFileName": "wwwroot/bundles/payment-request-bundle.min.js", "inputFiles": [ diff --git a/BTCPayServer/wwwroot/pull-payment-admin/main.js b/BTCPayServer/wwwroot/pull-payment-admin/main.js new file mode 100644 index 000000000..e8dadd035 --- /dev/null +++ b/BTCPayServer/wwwroot/pull-payment-admin/main.js @@ -0,0 +1,3 @@ +document.addEventListener('DOMContentLoaded', () => { + $('.richtext').summernote(window.summernoteOptions()) +}) diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.pull-payments.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.pull-payments.json index 9bed84c40..97f7f772e 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.pull-payments.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.pull-payments.json @@ -63,6 +63,11 @@ "description": "The name of the pull payment", "nullable": true }, + "description": { + "type": "string", + "description": "The description of the pull payment", + "nullable": true + }, "amount": { "type": "string", "format": "decimal", @@ -645,7 +650,11 @@ }, "name": { "type": "string", - "description": "Payment method of of the pull payment" + "description": "Name given to pull payment when it was created" + }, + "description": { + "type": "string", + "description": "Description given to pull payment when it was created" }, "currency": { "type": "string",