Refactor Get Store Payment Methods

Add tests + docs + new pluggbale format for fetching payment method data + client
This commit is contained in:
Kukks
2021-07-23 10:05:15 +02:00
committed by Andrew Camilleri
parent 17e6179fec
commit 4d538c61b1
20 changed files with 316 additions and 55 deletions

View File

@@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using BTCPayServer.Client.Models;
namespace BTCPayServer.Client
{
public partial class BTCPayServerClient
{
public virtual async Task<Dictionary<string, GenericPaymentMethodData>> GetStorePaymentMethods(string storeId,
bool enabledOnly = false,
CancellationToken token = default)
{
var response =
await _httpClient.SendAsync(
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods",
new Dictionary<string, object>() {{nameof(enabledOnly), enabledOnly}}), token);
return await HandleResponse<Dictionary<string, GenericPaymentMethodData>>(response);
}
}
}