mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 09:02:48 -05:00
bitpay invoice api
This commit is contained in:
33
src/Core/Utilities/BitPayClient.cs
Normal file
33
src/Core/Utilities/BitPayClient.cs
Normal file
@ -0,0 +1,33 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user