mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 00:22:50 -05:00
bitpay invoice api
This commit is contained in:
@ -1,11 +1,21 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Models.Api;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
public class MiscController : Controller
|
||||
{
|
||||
private readonly BitPayClient _bitPayClient;
|
||||
|
||||
public MiscController(BitPayClient bitPayClient)
|
||||
{
|
||||
_bitPayClient = bitPayClient;
|
||||
}
|
||||
|
||||
[HttpGet("~/alive")]
|
||||
[HttpGet("~/now")]
|
||||
public DateTime Get()
|
||||
@ -28,5 +38,14 @@ namespace Bit.Api.Controllers
|
||||
Headers = HttpContext.Request?.Headers,
|
||||
});
|
||||
}
|
||||
|
||||
[Authorize("Application")]
|
||||
[HttpPost("~/bitpay-invoice")]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task<string> PostBitPayInvoice([FromBody]BitPayInvoiceRequestModel model)
|
||||
{
|
||||
var invoice = await _bitPayClient.CreateInvoiceAsync(model.ToBitpayClientInvoice());
|
||||
return invoice.Url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +63,8 @@ namespace Bit.Api
|
||||
// Rate limiting
|
||||
services.AddSingleton<IIpPolicyStore, MemoryCacheIpPolicyStore>();
|
||||
services.AddSingleton<IRateLimitCounterStore, MemoryCacheRateLimitCounterStore>();
|
||||
// BitPay
|
||||
services.AddSingleton<BitPayClient>();
|
||||
}
|
||||
|
||||
// Identity
|
||||
|
@ -14,6 +14,9 @@
|
||||
},
|
||||
"braintree": {
|
||||
"production": true
|
||||
},
|
||||
"bitPay": {
|
||||
"production": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,10 @@
|
||||
"merchantId": "SECRET",
|
||||
"publicKey": "SECRET",
|
||||
"privateKey": "SECRET"
|
||||
},
|
||||
"bitPay": {
|
||||
"production": false,
|
||||
"base58Secret": "SECRET"
|
||||
}
|
||||
},
|
||||
"IpRateLimitOptions": {
|
||||
|
Reference in New Issue
Block a user