1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-11 15:17:44 +01:00
bitwarden-server/src/Core/Utilities/BitPayClient.cs

34 lines
1.0 KiB
C#
Raw Normal View History

2019-02-22 04:43:37 +01:00
using System;
using System.Threading.Tasks;
namespace Bit.Core.Utilities
{
public class BitPayClient
{
private readonly NBitpayClient.Bitpay _bpClient;
public BitPayClient(GlobalSettings globalSettings)
{
var btcSecret = new NBitcoin.BitcoinSecret(globalSettings.BitPay.Base58Secret,
globalSettings.BitPay.Production ? null : NBitcoin.Network.TestNet);
_bpClient = new NBitpayClient.Bitpay(btcSecret.PrivateKey,
new Uri(globalSettings.BitPay.Production ? "https://bitpay.com/" : "https://test.bitpay.com/"));
}
public Task<bool> TestAccessAsync()
{
return _bpClient.TestAccessAsync(NBitpayClient.Facade.Merchant);
}
public Task<NBitpayClient.Invoice> GetInvoiceAsync(string id)
{
return _bpClient.GetInvoiceAsync(id);
}
public Task<NBitpayClient.Invoice> CreateInvoiceAsync(NBitpayClient.Invoice invoice)
{
return _bpClient.CreateInvoiceAsync(invoice);
}
}
}