Greenfield: Add payments list endpoint (#4407)

Based on btcpayserver/BTCPayServer.Lightning#109
This commit is contained in:
d11n
2023-01-26 05:22:49 +01:00
committed by GitHub
parent f46443a5e3
commit de4ac2c830
9 changed files with 269 additions and 0 deletions

View File

@@ -290,6 +290,14 @@ namespace BTCPayServer.Controllers.Greenfield
return Ok(invoices.Select(ToModel));
}
public virtual async Task<IActionResult> GetPayments(string cryptoCode, [FromQuery] bool? includePending, [FromQuery] long? offsetIndex, CancellationToken cancellationToken = default)
{
var lightningClient = await GetLightningClient(cryptoCode, false);
var param = new ListPaymentsParams { IncludePending = includePending, OffsetIndex = offsetIndex };
var payments = await lightningClient.ListPayments(param, cancellationToken);
return Ok(payments.Select(ToModel));
}
public virtual async Task<IActionResult> CreateInvoice(string cryptoCode, CreateLightningInvoiceRequest request, CancellationToken cancellationToken = default)
{
var lightningClient = await GetLightningClient(cryptoCode, false);