2022-04-24 05:19:34 +02:00
|
|
|
#nullable enable
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Net.Http;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using BTCPayServer.Client.Models;
|
|
|
|
|
|
|
|
namespace BTCPayServer.Client
|
|
|
|
{
|
|
|
|
public partial class BTCPayServerClient
|
|
|
|
{
|
2023-01-06 14:18:07 +01:00
|
|
|
public virtual async Task<IEnumerable<PayoutProcessorData>> GetPayoutProcessors(string storeId,
|
2022-04-24 05:19:34 +02:00
|
|
|
CancellationToken token = default)
|
|
|
|
{
|
|
|
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/payout-processors"), token);
|
|
|
|
return await HandleResponse<IEnumerable<PayoutProcessorData>>(response);
|
|
|
|
}
|
|
|
|
public virtual async Task RemovePayoutProcessor(string storeId, string processor, string paymentMethod, CancellationToken token = default)
|
|
|
|
{
|
|
|
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/payout-processors/{processor}/{paymentMethod}", null, HttpMethod.Delete), token);
|
|
|
|
await HandleResponse(response);
|
|
|
|
}
|
2023-01-06 14:18:07 +01:00
|
|
|
|
2022-04-24 05:19:34 +02:00
|
|
|
public virtual async Task<IEnumerable<LightningAutomatedPayoutSettings>> GetStoreLightningAutomatedPayoutProcessors(string storeId, string? paymentMethod = null,
|
|
|
|
CancellationToken token = default)
|
|
|
|
{
|
2023-01-06 14:18:07 +01:00
|
|
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/payout-processors/LightningAutomatedPayoutSenderFactory{(paymentMethod is null ? string.Empty : $"/{paymentMethod}")}"), token);
|
2022-04-24 05:19:34 +02:00
|
|
|
return await HandleResponse<IEnumerable<LightningAutomatedPayoutSettings>>(response);
|
|
|
|
}
|
2023-01-06 14:18:07 +01:00
|
|
|
public virtual async Task<LightningAutomatedPayoutSettings> UpdateStoreLightningAutomatedPayoutProcessors(string storeId, string paymentMethod, LightningAutomatedPayoutSettings request, CancellationToken token = default)
|
2022-04-24 05:19:34 +02:00
|
|
|
{
|
2023-01-06 14:18:07 +01:00
|
|
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/payout-processors/LightningAutomatedPayoutSenderFactory/{paymentMethod}", null, request, HttpMethod.Put), token);
|
2022-04-24 05:19:34 +02:00
|
|
|
return await HandleResponse<LightningAutomatedPayoutSettings>(response);
|
|
|
|
}
|
2023-01-06 14:18:07 +01:00
|
|
|
public virtual async Task<OnChainAutomatedPayoutSettings> UpdateStoreOnChainAutomatedPayoutProcessors(string storeId, string paymentMethod, OnChainAutomatedPayoutSettings request, CancellationToken token = default)
|
2022-04-24 05:19:34 +02:00
|
|
|
{
|
2023-01-06 14:18:07 +01:00
|
|
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/payout-processors/OnChainAutomatedPayoutSenderFactory/{paymentMethod}", null, request, HttpMethod.Put), token);
|
2022-04-24 05:19:34 +02:00
|
|
|
return await HandleResponse<OnChainAutomatedPayoutSettings>(response);
|
|
|
|
}
|
2023-01-06 14:18:07 +01:00
|
|
|
|
2022-04-24 05:19:34 +02:00
|
|
|
public virtual async Task<IEnumerable<OnChainAutomatedPayoutSettings>> GetStoreOnChainAutomatedPayoutProcessors(string storeId, string? paymentMethod = null,
|
|
|
|
CancellationToken token = default)
|
|
|
|
{
|
2023-01-06 14:18:07 +01:00
|
|
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/payout-processors/OnChainAutomatedPayoutSenderFactory{(paymentMethod is null ? string.Empty : $"/{paymentMethod}")}"), token);
|
2022-04-24 05:19:34 +02:00
|
|
|
return await HandleResponse<IEnumerable<OnChainAutomatedPayoutSettings>>(response);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|