- Notifications
You must be signed in to change notification settings - Fork1.5k
[PM-28100] families 2019 email#6645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Changes from1 commit
244b8717f97444f999907a38635075ef19d3956e81b6bded9File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -116,4 +116,10 @@ Task<TestClock> GetTestClock( | ||
| TestClockGetOptions testClockGetOptions = null, | ||
| RequestOptions requestOptions = null, | ||
| CancellationToken cancellationToken = default); | ||
| Task<Coupon> GetCoupon( | ||
| string couponId, | ||
| CouponGetOptions couponGetOptions = null, | ||
| RequestOptions requestOptions = null, | ||
| CancellationToken cancellationToken = default); | ||
kdenney marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -9,6 +9,7 @@ | ||
| using Bit.Core.Billing.Payment.Queries; | ||
| using Bit.Core.Billing.Pricing; | ||
| using Bit.Core.Entities; | ||
| using Bit.Core.Models.Mail.Billing.Renewal.Families2019Renewal; | ||
| using Bit.Core.Models.Mail.Billing.Renewal.Families2020Renewal; | ||
| using Bit.Core.OrganizationFeatures.OrganizationSponsorships.FamiliesForEnterprise.Interfaces; | ||
| using Bit.Core.Platform.Mail.Mailer; | ||
| @@ -284,7 +285,7 @@ private async Task<bool> AlignOrganizationSubscriptionConcernsAsync( | ||
| { | ||
| await organizationRepository.ReplaceAsync(organization); | ||
| await stripeFacade.UpdateSubscription(subscription.Id, options); | ||
| await SendFamiliesRenewalEmailAsync(organization, familiesPlan, plan); | ||
| return true; | ||
| } | ||
| catch (Exception exception) | ||
| @@ -546,7 +547,18 @@ await mailService.SendInvoiceUpcoming( | ||
| private async Task SendFamiliesRenewalEmailAsync( | ||
| Organization organization, | ||
| Plan familiesPlan, | ||
| Plan planBeforeAlignment) | ||
| { | ||
| await (planBeforeAlignment switch | ||
| { | ||
| { Type: PlanType.FamiliesAnnually2025 } => SendFamilies2020RenewalEmailAsync(organization, familiesPlan), | ||
| { Type: PlanType.FamiliesAnnually2019 } => SendFamilies2019RenewalEmailAsync(organization, familiesPlan), | ||
| _ => throw new InvalidOperationException("Unsupported families plan in SendFamiliesRenewalEmailAsync().") | ||
| }); | ||
| } | ||
| private async Task SendFamilies2020RenewalEmailAsync(Organization organization, Plan familiesPlan) | ||
| { | ||
| var email = new Families2020RenewalMail | ||
| { | ||
| @@ -560,6 +572,38 @@ private async Task SendFamiliesRenewalEmailAsync( | ||
| await mailer.SendEmail(email); | ||
| } | ||
| private async Task SendFamilies2019RenewalEmailAsync(Organization organization, Plan familiesPlan) | ||
| { | ||
| var coupon = await stripeFacade.GetCoupon(CouponIDs.Milestone3SubscriptionDiscount); | ||
kdenney marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| if (coupon == null) | ||
| { | ||
| logger.LogWarning("Could not find coupon for sending families 2019 email with ID: {CouponID}", CouponIDs.Milestone3SubscriptionDiscount); | ||
| return; | ||
| } | ||
| if (coupon.PercentOff == null) | ||
| { | ||
| logger.LogWarning("The coupon for sending families 2019 email with ID: {CouponID} has a null PercentOff.", CouponIDs.Milestone3SubscriptionDiscount); | ||
| return; | ||
kdenney marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| } | ||
kdenney marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| var discountedAnnualRenewalPrice = familiesPlan.PasswordManager.BasePrice * (100 - coupon.PercentOff.Value) / 100; | ||
| var email = new Families2019RenewalMail | ||
| { | ||
| ToEmails = [organization.BillingEmail], | ||
| View = new Families2019RenewalMailView | ||
| { | ||
| BaseMonthlyRenewalPrice = (familiesPlan.PasswordManager.BasePrice / 12).ToString("C", new CultureInfo("en-US")), | ||
| BaseAnnualRenewalPrice = familiesPlan.PasswordManager.BasePrice.ToString("C", new CultureInfo("en-US")), | ||
| DiscountAmount = $"{coupon.PercentOff}%", | ||
| DiscountedAnnualRenewalPrice = discountedAnnualRenewalPrice.ToString("C", new CultureInfo("en-US")) | ||
| } | ||
| }; | ||
| await mailer.SendEmail(email); | ||
| } | ||
| private async Task SendPremiumRenewalEmailAsync( | ||
| User user, | ||
| PremiumPlan premiumPlan) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| <mjml> | ||
| <mj-head> | ||
| <mj-include path="../../../components/head.mjml"/> | ||
| </mj-head> | ||
| <!-- Blue Header Section--> | ||
| <mj-body css-class="border-fix"> | ||
| <mj-wrapper css-class="border-fix" padding="20px 20px 0px 20px"> | ||
| <mj-bw-simple-hero /> | ||
| </mj-wrapper> | ||
| <!-- Main Content Section --> | ||
| <mj-wrapper padding="0px 20px 0px 20px"> | ||
| <mj-section background-color="#fff" padding="15px 10px 10px 10px"> | ||
| <mj-column> | ||
| <mj-text font-size="16px" line-height="24px" padding="10px 15px 15px 15px"> | ||
| Your Bitwarden Families subscription renews in 15 days. The price is updating to {{BaseMonthlyRenewalPrice}}/month, billed annually | ||
| at {{BaseAnnualRenewalPrice}} + tax. | ||
| </mj-text> | ||
| <mj-text font-size="16px" line-height="24px" padding="10px 15px 15px 15px"> | ||
| As a long time Bitwarden customer, you will receive a one-time {{DiscountAmount}} loyalty discount for this renewal. | ||
| This renewal will now be billed annually at {{DiscountedAnnualRenewalPrice}} + tax. | ||
| </mj-text> | ||
| <mj-text font-size="16px" line-height="24px" padding="10px 15px"> | ||
| Questions? Contact | ||
| <a href="mailto:support@bitwarden.com" class="link">support@bitwarden.com</a> | ||
| </mj-text> | ||
| </mj-column> | ||
| </mj-section> | ||
| <mj-section background-color="#fff" padding="0 20px 20px 20px"> | ||
| </mj-section> | ||
| </mj-wrapper> | ||
| <!-- Learn More Section --> | ||
| <mj-wrapper padding="0px 20px 10px 20px"> | ||
| <mj-bw-learn-more-footer/> | ||
| </mj-wrapper> | ||
| <!-- Footer --> | ||
| <mj-include path="../../../components/footer.mjml"/> | ||
| </mj-body> | ||
| </mjml> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| using Bit.Core.Platform.Mail.Mailer; | ||
| namespace Bit.Core.Models.Mail.Billing.Renewal.Families2019Renewal; | ||
| public class Families2019RenewalMailView : BaseMailView | ||
| { | ||
| public required string BaseMonthlyRenewalPrice { get; set; } | ||
| public required string BaseAnnualRenewalPrice { get; set; } | ||
| public required string DiscountedAnnualRenewalPrice { get; set; } | ||
| public required string DiscountAmount { get; set; } | ||
| } | ||
| public class Families2019RenewalMail : BaseMail<Families2019RenewalMailView> | ||
| { | ||
| public override string Subject { get => "Your Bitwarden Families renewal is updating"; } | ||
| } |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.