mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 09:32:48 -05:00
stripe webhook key from billing settings
This commit is contained in:
@ -1,14 +1,27 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Bit.Billing.Controllers
|
||||
{
|
||||
[Route("stripe")]
|
||||
public class StripeController : Controller
|
||||
{
|
||||
[HttpPost("webhook")]
|
||||
public void PostWebhook([FromBody]dynamic body, [FromQuery] string key)
|
||||
{
|
||||
private readonly BillingSettings _billingSettings;
|
||||
|
||||
public StripeController(IOptions<BillingSettings> billingSettings)
|
||||
{
|
||||
_billingSettings = billingSettings?.Value;
|
||||
}
|
||||
|
||||
[HttpPost("webhook")]
|
||||
public IActionResult PostWebhook([FromBody]dynamic body, [FromQuery] string key)
|
||||
{
|
||||
if(key != _billingSettings.StripeWebhookKey)
|
||||
{
|
||||
return new BadRequestResult();
|
||||
}
|
||||
|
||||
return new OkResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user