public async Task <IActionResult> ActivateInvoicePaymentMethod(string storeId, string invoiceId, string paymentMethod)
        {
            var store = HttpContext.GetStoreData();

            if (store == null)
            {
                return(InvoiceNotFound());
            }

            var invoice = await _invoiceRepository.GetInvoice(invoiceId, true);

            if (invoice?.StoreId != store.Id)
            {
                return(InvoiceNotFound());
            }

            if (PaymentMethodId.TryParse(paymentMethod, out var paymentMethodId))
            {
                await _invoiceRepository.ActivateInvoicePaymentMethod(_eventAggregator, _btcPayNetworkProvider,
                                                                      _paymentMethodHandlerDictionary, store, invoice, paymentMethodId);

                return(Ok());
            }
            ModelState.AddModelError(nameof(paymentMethod), "Invalid payment method");
            return(this.CreateValidationError(ModelState));
        }
        public async Task <IActionResult> ActivateInvoicePaymentMethod(string storeId, string invoiceId, string paymentMethod)
        {
            var store = HttpContext.GetStoreData();

            if (store == null)
            {
                return(NotFound());
            }

            var invoice = await _invoiceRepository.GetInvoice(invoiceId, true);

            if (invoice?.StoreId != store.Id)
            {
                return(NotFound());
            }

            if (PaymentMethodId.TryParse(paymentMethod, out var paymentMethodId))
            {
                await _invoiceRepository.ActivateInvoicePaymentMethod(_eventAggregator, _btcPayNetworkProvider,
                                                                      _paymentMethodHandlerDictionary, store, invoice, paymentMethodId);

                return(Ok());
            }
            return(BadRequest());
        }