1
0
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:
Kyle Spearrin 2017-08-12 23:06:29 -04:00
parent f998b988ca
commit c8af0e8644
3 changed files with 41 additions and 1 deletions

View File

@ -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; }
}
}

View 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();
}
}
}

View File

@ -38,7 +38,8 @@
"billingSettings": {
"stripeWebhookKey": "SECRET",
"stripeWebhookSecret": "SECRET",
"braintreeWebhookKey": "SECRET"
"braintreeWebhookKey": "SECRET",
"jobsKey": "SECRET"
},
"braintree": {
"production": false,