1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-27 14:16:19 -05:00

[PM-18699] Add trial path to Stripe metadata (#5940)

* Add the market and product initiated change

* Resolve the failing test

* revert the change

* resolve the failing test

* Resolve the failing test

* revert the add skipstrial

* Revert add the new bool SkipTrial

* Revert the changes

* Revert the changes on the organizationsale

* remove the trailsource property

* Remove the CustomerSetup added

* Add the improved code change for trial metadata

* Revert the changes on GetSubscriptionSetup

* Assign the InitiationPath
This commit is contained in:
cyprain-okeke 2025-06-26 13:38:14 +01:00 committed by GitHub
parent 49816e0926
commit 7fd1ccb7a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 1 deletions

View File

@ -34,6 +34,7 @@ public class OrganizationSale
var subscriptionSetup = GetSubscriptionSetup(signup); var subscriptionSetup = GetSubscriptionSetup(signup);
subscriptionSetup.SkipTrial = signup.SkipTrial; subscriptionSetup.SkipTrial = signup.SkipTrial;
subscriptionSetup.InitiationPath = signup.InitiationPath;
return new OrganizationSale return new OrganizationSale
{ {

View File

@ -10,6 +10,7 @@ public class SubscriptionSetup
public required PasswordManager PasswordManagerOptions { get; set; } public required PasswordManager PasswordManagerOptions { get; set; }
public SecretsManager? SecretsManagerOptions { get; set; } public SecretsManager? SecretsManagerOptions { get; set; }
public bool SkipTrial = false; public bool SkipTrial = false;
public string? InitiationPath { get; set; }
public class PasswordManager public class PasswordManager
{ {

View File

@ -420,7 +420,11 @@ public class OrganizationBillingService(
Items = subscriptionItemOptionsList, Items = subscriptionItemOptionsList,
Metadata = new Dictionary<string, string> Metadata = new Dictionary<string, string>
{ {
["organizationId"] = organizationId.ToString() ["organizationId"] = organizationId.ToString(),
["trialInitiationPath"] = !string.IsNullOrEmpty(subscriptionSetup.InitiationPath) &&
subscriptionSetup.InitiationPath.Contains("trial from marketing website")
? "marketing-initiated"
: "product-initiated"
}, },
OffSession = true, OffSession = true,
TrialPeriodDays = subscriptionSetup.SkipTrial ? 0 : plan.TrialPeriodDays TrialPeriodDays = subscriptionSetup.SkipTrial ? 0 : plan.TrialPeriodDays