Improve tests of webhooks

This commit is contained in:
nicolas.dorier
2020-11-13 16:28:15 +09:00
parent 94bcbeb604
commit df79c2cf48
13 changed files with 269 additions and 30 deletions

View File

@@ -51,7 +51,7 @@ namespace BTCPayServer.Controllers
}
[HttpGet]
[Route("invoices")]
public async Task<DataWrapper<InvoiceResponse[]>> GetInvoices(
public async Task<IActionResult> GetInvoices(
string token,
DateTimeOffset? dateStart = null,
DateTimeOffset? dateEnd = null,
@@ -61,6 +61,8 @@ namespace BTCPayServer.Controllers
int? limit = null,
int? offset = null)
{
if (User.Identity.AuthenticationType == Security.Bitpay.BitpayAuthenticationTypes.Anonymous)
return Forbid(Security.Bitpay.BitpayAuthenticationTypes.Anonymous);
if (dateEnd != null)
dateEnd = dateEnd.Value + TimeSpan.FromDays(1); //Should include the end day
@@ -79,7 +81,7 @@ namespace BTCPayServer.Controllers
var entities = (await _InvoiceRepository.GetInvoices(query))
.Select((o) => o.EntityToDTO()).ToArray();
return DataWrapper.Create(entities);
return Json(DataWrapper.Create(entities));
}
}
}