Skip to content

[PM-38567] Migration Renewal Copy Dynamic Update#7921

Open
sbrown-livefront wants to merge 7 commits into
mainfrom
billing/pm-38567/migration-renewal-copy-dynamic-update
Open

[PM-38567] Migration Renewal Copy Dynamic Update#7921
sbrown-livefront wants to merge 7 commits into
mainfrom
billing/pm-38567/migration-renewal-copy-dynamic-update

Conversation

@sbrown-livefront

@sbrown-livefront sbrown-livefront commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-38567

📔 Objective

The migration renewal email (BusinessPlanRenewal2020MigrationMail, from PM-37070) already lists a cohort's proactive discount in its summary of charges, but nothing explains why the customer is seeing it. Per marketing's request, this adds a dynamically-inserted sentence that calls out the loyalty discount only when the cohort provides a proactive discount.

Implementation notes:

  • The Discount record resolved in UpcomingInvoiceHandler now carries its CouponId and Months (DurationInMonths), populated from the coupon already fetched during discount resolution — no extra Stripe call. The email path filters the resolved discounts for the cohort's proactive coupon to get its month span.
  • New view-model members: ProactiveDiscountMonths, ShowProactiveDiscountCopy (gate, true only for a positive month span), and ProactiveDiscountDurationPhrase ("next month" / "next N months").
  • Email template: edited the MJML source (business-plan-renewal-2020-migration.mjml), regenerated the .html.hbs via npm run build:minify, and updated the hand-authored .text.hbs. The conditional sentence (and its punctuation) lives inline in the always-rendered notice paragraph.

Tests: Added handler coverage for the repeating / once / forever / unresolved / no-coupon cases, and view-model tests for the gate and phrase.

📸 Screenshots

Annual Teams Subscription with 12 Month Cohort Coupon

image

Monthly Teams Subscription with 6 Month Cohort Coupon

image

@sbrown-livefront sbrown-livefront self-assigned this Jul 2, 2026
@sbrown-livefront sbrown-livefront added the ai-review Request a Claude code review label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the addition of conditional proactive-discount copy to the BusinessPlanRenewal2020Migration renewal email. The Discount record now carries CouponId and Months populated from the already-fetched Stripe coupon, and the mail view exposes ProactiveDiscountMonths, a ShowProactiveDiscountCopy gate, and a ProactiveDiscountDurationPhrase. The proactive coupon is resolved via cohort.ProactiveDiscountCouponCode, so the FirstOrDefault match in the mailer is guaranteed to align, and Stripe's DurationInMonths (populated only for repeating coupons) correctly suppresses the copy for once/forever, unresolved, and no-coupon cases. Handler and view-model tests cover these paths.

No blocking or actionable findings.

Code Review Details

No findings. Logic is correct across the resolved edge cases (null/empty coupon code, unresolvable coupon, coupons with neither PercentOff nor AmountOff), and the private-sealed Discount record's positional change has no external consumers. The .html.hbs regeneration matches the MJML/text source edits.

@sbrown-livefront sbrown-livefront added the t:feature Change Type - Feature Development label Jul 2, 2026
@sbrown-livefront sbrown-livefront marked this pull request as ready for review July 2, 2026 21:55
@sbrown-livefront sbrown-livefront requested a review from a team as a code owner July 2, 2026 21:55
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 61.36%. Comparing base (e899a9c) to head (b2f31f9).

Files with missing lines Patch % Lines
...Services/Implementations/UpcomingInvoiceHandler.cs 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7921   +/-   ##
=======================================
  Coverage   61.35%   61.36%           
=======================================
  Files        2236     2236           
  Lines       98547    98555    +8     
  Branches     8911     8914    +3     
=======================================
+ Hits        60468    60476    +8     
+ Misses      35943    35942    -1     
- Partials     2136     2137    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant