[PM-38574] feat: Set trialInitiationPath for sales-assisted trials - #8272
[PM-38574] feat: Set trialInitiationPath for sales-assisted trials#8272cyprain-okeke wants to merge 5 commits into
Conversation
Sales-assisted trial orgs previously fell through to "marketing-initiated" in Stripe subscription metadata, leaving the warnings API unable to distinguish invoice-billed prospects. Map the sales-assisted InitiationPath sent by the client to a dedicated "sales-assisted" metadata value and expose IsSalesAssisted on FreeTrialWarning for PM-38575/PM-38885 to consume.
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the Code Review DetailsNo findings. |
…or-sales-assisted-trials
| public const string TrialInitiationPathMarketingInitiated = "marketing-initiated"; | ||
| public const string TrialInitiationPathProductInitiated = "product-initiated"; | ||
| public const string TrialInitiationPathSalesAssisted = "sales-assisted"; |
There was a problem hiding this comment.
♻️ DEBT: These are metadata values, not keys — this file already has a convention for that.
Details and fix
MetadataKeys holds Stripe metadata key names. The values carried under a key live in their own sibling class in this same file — see PurchasableReferences (documented as "the stable, plan-agnostic values carried in MetadataKeys.PurchasableReference") and CancellationOrigins for MetadataKeys.CancellationOrigin.
/// <summary>
/// The values carried in <see cref="MetadataKeys.TrialInitiationPath"/>.
/// </summary>
public static class TrialInitiationPaths
{
public const string MarketingInitiated = "marketing-initiated";
public const string ProductInitiated = "product-initiated";
public const string SalesAssisted = "sales-assisted";
}That also reads better at the call sites, where trialInitiationPath == MetadataKeys.TrialInitiationPathSalesAssisted currently compares a value against something named as a key.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8272 +/- ##
=======================================
Coverage 63.66% 63.67%
=======================================
Files 2467 2467
Lines 105693 105702 +9
Branches 9551 9554 +3
=======================================
+ Hits 67294 67304 +10
+ Misses 36083 36082 -1
Partials 2316 2316 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…or-sales-assisted-trials
…sisted-trials' of https://github.com/bitwarden/server into billing/pm-38574/set-trial-initiation-path-for-sales-assisted-trials
sbrown-livefront
left a comment
There was a problem hiding this comment.
Great refactor with the other magic strings. Thanks! ✅
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-38574
📔 Objective
Sales-assisted trial organizations (PM-38388/PM-38389) currently fall through to
marketing-initiatedin Stripe subscription metadata, so the warnings API cannot distinguish invoice-billed prospects from self-serve trials.InitiationPathvalue ("Sales assisted trial from admin portal") totrialInitiationPath = "sales-assisted"in subscription metadata; the existingmarketing-initiated/product-initiatedvalues are promoted toStripeConstants.MetadataKeysalongside it.IsSalesAssistedtoFreeTrialWarning, populated from subscription metadata inGetOrganizationWarningsQuery. PM-38575 (hide payment modal) and PM-38885 (banner copy) consume this on the client.InitiationPathenum and the metadata values persist in Stripe.Notes for reviewers:
sales-initiated; Product confirmed that is a typo —sales-assistedis the intended value.isSalesAssistedtofalsewhen the field is absent.Sibling PR: bitwarden/clients#22757