diff --git a/BTCPayServer/Controllers/UIInvoiceController.UI.cs b/BTCPayServer/Controllers/UIInvoiceController.UI.cs index 7c24554ee..f535c2605 100644 --- a/BTCPayServer/Controllers/UIInvoiceController.UI.cs +++ b/BTCPayServer/Controllers/UIInvoiceController.UI.cs @@ -1079,18 +1079,6 @@ namespace BTCPayServer.Controllers catch { try { webSocket.Dispose(); } catch { } } } - [HttpPost("i/{invoiceId}/UpdateCustomer")] - [HttpPost("invoice/UpdateCustomer")] - public async Task UpdateCustomer(string invoiceId, [FromBody] UpdateCustomerModel data) - { - if (!ModelState.IsValid) - { - return BadRequest(ModelState); - } - await _InvoiceRepository.UpdateInvoice(invoiceId, data).ConfigureAwait(false); - return Ok("{}"); - } - [HttpGet("/stores/{storeId}/invoices")] [HttpGet("invoices")] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie, Policy = Policies.CanViewInvoices)] diff --git a/BTCPayServer/Models/InvoicingModels/UpdateCustomerModel.cs b/BTCPayServer/Models/InvoicingModels/UpdateCustomerModel.cs deleted file mode 100644 index 14c86873d..000000000 --- a/BTCPayServer/Models/InvoicingModels/UpdateCustomerModel.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using BTCPayServer.Validation; - -namespace BTCPayServer.Models.InvoicingModels -{ - public class UpdateCustomerModel - { - [MailboxAddress] - [Required] - public string Email - { - get; set; - } - } -} diff --git a/BTCPayServer/Services/Invoices/InvoiceRepository.cs b/BTCPayServer/Services/Invoices/InvoiceRepository.cs index b99c122c9..5c7f5523f 100644 --- a/BTCPayServer/Services/Invoices/InvoiceRepository.cs +++ b/BTCPayServer/Services/Invoices/InvoiceRepository.cs @@ -140,35 +140,6 @@ namespace BTCPayServer.Services.Invoices return await ctx.Apps.Where(a => a.StoreDataId == storeId && a.TagAllInvoices).ToArrayAsync(); } - public async Task UpdateInvoice(string invoiceId, UpdateCustomerModel data) - { -retry: - using (var ctx = _applicationDbContextFactory.CreateContext()) - { - var invoiceData = await ctx.Invoices.FindAsync(invoiceId); - if (invoiceData == null) - return; - var blob = invoiceData.GetBlob(); - if (blob.Metadata.BuyerEmail == null && data.Email != null) - { - if (MailboxAddressValidator.IsMailboxAddress(data.Email)) - { - blob.Metadata.BuyerEmail = data.Email; - invoiceData.SetBlob(blob); - AddToTextSearch(ctx, invoiceData, blob.Metadata.BuyerEmail); - } - } - try - { - await ctx.SaveChangesAsync().ConfigureAwait(false); - } - catch (DbUpdateConcurrencyException) - { - goto retry; - } - } - } - public async Task UpdateInvoiceExpiry(string invoiceId, TimeSpan seconds) { retry: