mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00
[PM-20084] [PM-20086] Add TrialLength
parameter to trial initiation endpoint and email (#5770)
* Add trial length parameter to trial initiation endpoint and email * Add feature flag that pegs trial length to 7 when disabled * Add optionality to Identity * Move feature service injection to identity accounts controller
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
using Bit.Core.Billing.Models.Api.Requests.Accounts;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Billing.Models.Api.Requests.Accounts;
|
||||
using Bit.Core.Billing.TrialInitiation.Registration;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
using Bit.Core.Tools.Services;
|
||||
@ -15,18 +17,24 @@ namespace Bit.Identity.Billing.Controller;
|
||||
public class AccountsController(
|
||||
ICurrentContext currentContext,
|
||||
ISendTrialInitiationEmailForRegistrationCommand sendTrialInitiationEmailForRegistrationCommand,
|
||||
IReferenceEventService referenceEventService) : Microsoft.AspNetCore.Mvc.Controller
|
||||
IReferenceEventService referenceEventService,
|
||||
IFeatureService featureService) : Microsoft.AspNetCore.Mvc.Controller
|
||||
{
|
||||
[HttpPost("trial/send-verification-email")]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task<IActionResult> PostTrialInitiationSendVerificationEmailAsync([FromBody] TrialSendVerificationEmailRequestModel model)
|
||||
{
|
||||
var allowTrialLength0 = featureService.IsEnabled(FeatureFlagKeys.PM20322_AllowTrialLength0);
|
||||
|
||||
var trialLength = allowTrialLength0 ? model.TrialLength ?? 7 : 7;
|
||||
|
||||
var token = await sendTrialInitiationEmailForRegistrationCommand.Handle(
|
||||
model.Email,
|
||||
model.Name,
|
||||
model.ReceiveMarketingEmails,
|
||||
model.ProductTier,
|
||||
model.Products);
|
||||
model.Products,
|
||||
trialLength);
|
||||
|
||||
var refEvent = new ReferenceEvent
|
||||
{
|
||||
|
@ -145,6 +145,7 @@ public class Startup
|
||||
// Services
|
||||
services.AddBaseServices(globalSettings);
|
||||
services.AddDefaultServices(globalSettings);
|
||||
services.AddOptionality();
|
||||
services.AddCoreLocalizationServices();
|
||||
services.AddBillingOperations();
|
||||
|
||||
|
Reference in New Issue
Block a user