mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
billings jobs setup
This commit is contained in:
parent
f998b988ca
commit
c8af0e8644
@ -5,5 +5,6 @@
|
||||
public virtual string StripeWebhookKey { get; set; }
|
||||
public virtual string StripeWebhookSecret { get; set; }
|
||||
public virtual string BraintreeWebhookKey { get; set; }
|
||||
public virtual string JobsKey { get; set; }
|
||||
}
|
||||
}
|
||||
|
38
src/Billing/Controllers/JobsController.cs
Normal file
38
src/Billing/Controllers/JobsController.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using Bit.Core.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bit.Billing.Controllers
|
||||
{
|
||||
[Route("jobs")]
|
||||
public class JobsController : Controller
|
||||
{
|
||||
private readonly BillingSettings _billingSettings;
|
||||
private readonly IOrganizationService _organizationService;
|
||||
private readonly IUserService _userService;
|
||||
|
||||
public JobsController(
|
||||
IOptions<BillingSettings> billingSettings,
|
||||
IOrganizationService organizationService,
|
||||
IUserService userService)
|
||||
{
|
||||
_billingSettings = billingSettings?.Value;
|
||||
_organizationService = organizationService;
|
||||
_userService = userService;
|
||||
}
|
||||
|
||||
[HttpPost("expirations")]
|
||||
public async Task<IActionResult> PostExpirations([FromQuery] string key)
|
||||
{
|
||||
if(key != _billingSettings.JobsKey)
|
||||
{
|
||||
return new BadRequestResult();
|
||||
}
|
||||
|
||||
// TODO check for all users/orgs that are expired and disable them
|
||||
|
||||
return new OkResult();
|
||||
}
|
||||
}
|
||||
}
|
@ -38,7 +38,8 @@
|
||||
"billingSettings": {
|
||||
"stripeWebhookKey": "SECRET",
|
||||
"stripeWebhookSecret": "SECRET",
|
||||
"braintreeWebhookKey": "SECRET"
|
||||
"braintreeWebhookKey": "SECRET",
|
||||
"jobsKey": "SECRET"
|
||||
},
|
||||
"braintree": {
|
||||
"production": false,
|
||||
|
Loading…
Reference in New Issue
Block a user