mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 01: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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user