diff options
author | Bjørn Christian Seime <bjorncs@vespa.ai> | 2023-10-30 11:06:02 +0100 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@vespa.ai> | 2023-10-30 11:08:45 +0100 |
commit | 14cfb5a6e86846fd156367673379e819dd6a28d2 (patch) | |
tree | 594d441e61f281c3d378b82626ddb9281ee0fd7b | |
parent | 1abe5ce96b8708c781edeab654c2347157cdc4b0 (diff) |
Remove trial notification on two days before expiration
6 files changed, 4 insertions, 671 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirer.java index 27830e755b2..1e261f78db3 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirer.java @@ -30,7 +30,6 @@ import java.util.stream.Collectors; import static com.yahoo.vespa.hosted.controller.persistence.TrialNotifications.State.EXPIRED; import static com.yahoo.vespa.hosted.controller.persistence.TrialNotifications.State.EXPIRES_IMMEDIATELY; -import static com.yahoo.vespa.hosted.controller.persistence.TrialNotifications.State.EXPIRES_SOON; import static com.yahoo.vespa.hosted.controller.persistence.TrialNotifications.State.MID_CHECK_IN; import static com.yahoo.vespa.hosted.controller.persistence.TrialNotifications.State.SIGNED_UP; import static com.yahoo.vespa.hosted.controller.persistence.TrialNotifications.State.UNKNOWN; @@ -100,7 +99,6 @@ public class CloudTrialExpirer extends ControllerMaintainer { * Trial plan notification states. Transition to a new state triggers a notification/email * - SIGNED_UP: Tenant has signed up for trial * - MID_CHECK_IN: Tenant is halfway through trial (7 days) - * - EXPIRES_SOON: Tenant has 2 days left of trial * - EXPIRES_IMMEDIATELY: Tenant has 1 day left of trial * - EXPIRED: Tenant has expired */ @@ -138,12 +136,8 @@ public class CloudTrialExpirer extends ControllerMaintainer { && !List.of(EXPIRES_IMMEDIATELY, EXPIRED).contains(state)) { updatedStatus.add(updatedStatus(tenant, now, EXPIRES_IMMEDIATELY)); notifyExpiresImmediately(tenant); - } else if ("trial".equals(plan) && ageInDays >= 12 - && !List.of(EXPIRES_SOON, EXPIRES_IMMEDIATELY, EXPIRED).contains(state)) { - updatedStatus.add(updatedStatus(tenant, now, EXPIRES_SOON)); - notifyExpiresSoon(tenant); } else if ("trial".equals(plan) && ageInDays >= 7 - && !List.of(MID_CHECK_IN, EXPIRES_SOON, EXPIRES_IMMEDIATELY, EXPIRED).contains(state)) { + && !List.of(MID_CHECK_IN, EXPIRES_IMMEDIATELY, EXPIRED).contains(state)) { updatedStatus.add(updatedStatus(tenant, now, MID_CHECK_IN)); notifyMidCheckIn(tenant); } else { @@ -169,11 +163,6 @@ public class CloudTrialExpirer extends ControllerMaintainer { queueNotification(tenant, consoleMsg, "How is your Vespa Cloud trial going?", MailTemplating.Template.TRIAL_MIDWAY_CHECKIN); } - private void notifyExpiresSoon(Tenant tenant) { - var consoleMsg = "Your Vespa Cloud trial expires in **2** days. [Manage plan](%s)".formatted(billingUrl(tenant)); - queueNotification(tenant, consoleMsg, "Your Vespa Cloud trial expires in 2 days", MailTemplating.Template.TRIAL_EXPIRES_SOON); - } - private void notifyExpiresImmediately(Tenant tenant) { var consoleMsg = "Your Vespa Cloud trial expires **tomorrow**. [Manage plan](%s)".formatted(billingUrl(tenant)); queueNotification(tenant, consoleMsg, "Your Vespa Cloud trial expires tomorrow", MailTemplating.Template.TRIAL_EXPIRES_IMMEDIATELY); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/MailTemplating.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/MailTemplating.java index 0581284e39b..642840bf2b3 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/MailTemplating.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/MailTemplating.java @@ -26,7 +26,7 @@ public class MailTemplating { public enum Template { MAIL("mail"), DEFAULT_MAIL_CONTENT("default-mail-content"), NOTIFICATION_MESSAGE("notification-message"), MAIL_VERIFICATION("mail-verification"), TRIAL_SIGNED_UP("trial-signed-up"), TRIAL_MIDWAY_CHECKIN("trial-midway-checkin"), - TRIAL_EXPIRES_SOON("trial-expires-soon"), TRIAL_EXPIRES_IMMEDIATELY("trial-expires-immediately"), TRIAL_EXPIRED("trial-expired") + TRIAL_EXPIRES_IMMEDIATELY("trial-expires-immediately"), TRIAL_EXPIRED("trial-expired") ; public static Optional<Template> fromId(String id) { diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/TrialNotifications.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/TrialNotifications.java index a205e6c4173..cf6923b1e2c 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/TrialNotifications.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/TrialNotifications.java @@ -21,7 +21,7 @@ public record TrialNotifications(List<Status> tenants) { public TrialNotifications { tenants = List.copyOf(tenants); } public record Status(TenantName tenant, State state, Instant lastUpdate) {} - public enum State { SIGNED_UP, MID_CHECK_IN, EXPIRES_SOON, EXPIRES_IMMEDIATELY, EXPIRED, UNKNOWN } + public enum State { SIGNED_UP, MID_CHECK_IN, EXPIRES_IMMEDIATELY, EXPIRED, UNKNOWN } public Slime toSlime() { var slime = new Slime(); diff --git a/controller-server/src/main/resources/mail/trial-expires-soon.vm b/controller-server/src/main/resources/mail/trial-expires-soon.vm deleted file mode 100644 index b1e04ea8969..00000000000 --- a/controller-server/src/main/resources/mail/trial-expires-soon.vm +++ /dev/null @@ -1,3 +0,0 @@ -<p> - Your Vespa Cloud trial expires in 2 days. Please reach out to us if you have any questions or feedback. -</p>
\ No newline at end of file diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java index f5af8987a51..02d0a020cd2 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java @@ -124,15 +124,8 @@ public class CloudTrialExpirerTest { assertEquals(expectedConsoleNotification, notification.title()); assertLastEmail(mailer, notification); - expectedConsoleNotification = "Your Vespa Cloud trial expires in **2** days. [Manage plan](https://console.tld/tenant/trial-tenant/account/billing)"; - clock.advance(Duration.ofDays(5)); - assertEquals(0.0, expirer.maintain()); - notification = lastAccountLevelNotification(tenant); - assertEquals(expectedConsoleNotification, notification.title()); - assertLastEmail(mailer, notification); - expectedConsoleNotification = "Your Vespa Cloud trial expires **tomorrow**. [Manage plan](https://console.tld/tenant/trial-tenant/account/billing)"; - clock.advance(Duration.ofDays(1)); + clock.advance(Duration.ofDays(6)); assertEquals(0.0, expirer.maintain()); notification = lastAccountLevelNotification(tenant); assertEquals(expectedConsoleNotification, notification.title()); diff --git a/controller-server/src/test/resources/mail/trial-expires-soon.html b/controller-server/src/test/resources/mail/trial-expires-soon.html deleted file mode 100644 index 17c59240cc4..00000000000 --- a/controller-server/src/test/resources/mail/trial-expires-soon.html +++ /dev/null @@ -1,646 +0,0 @@ -<!DOCTYPE html> -<html - xmlns="http://www.w3.org/1999/xhtml" - xmlns:v="urn:schemas-microsoft-com:vml" - xmlns:o="urn:schemas-microsoft-com:office:office" -> - <head> - <title></title> - <!--[if !mso]><!--> - <meta http-equiv="X-UA-Compatible" content="IE=edge" /> - <!--<![endif]--> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta name="viewport" content="width=device-width,initial-scale=1" /> - <style type="text/css"> - #outlook a { - padding: 0; - } - - body { - margin: 0; - padding: 0; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; - } - - table, - td { - border-collapse: collapse; - mso-table-lspace: 0pt; - mso-table-rspace: 0pt; - } - - img { - border: 0; - height: auto; - line-height: 100%; - outline: none; - text-decoration: none; - -ms-interpolation-mode: bicubic; - } - - p { - display: block; - margin: 13px 0; - } - </style> - <!--[if mso]> - <noscript> - <xml> - <o:OfficeDocumentSettings> - <o:AllowPNG /> - <o:PixelsPerInch>96</o:PixelsPerInch> - </o:OfficeDocumentSettings> - </xml> - </noscript> - <![endif]--> - <!--[if lte mso 11]> - <style type="text/css"> - .mj-outlook-group-fix { - width: 100% !important; - } - </style> - <![endif]--> - <!--[if !mso]><!--> - <link - href="https://fonts.googleapis.com/css?family=Open Sans" - rel="stylesheet" - type="text/css" - /> - <style type="text/css"> - @import url(https://fonts.googleapis.com/css?family=Open Sans); - </style> - <!--<![endif]--> - <style type="text/css"> - @media only screen and (min-width: 480px) { - .mj-column-per-100 { - width: 100% !important; - max-width: 100%; - } - } - </style> - <style media="screen and (min-width:480px)"> - .moz-text-html .mj-column-per-100 { - width: 100% !important; - max-width: 100%; - } - </style> - <style type="text/css"> - [owa] .mj-column-per-100 { - width: 100% !important; - max-width: 100%; - } - </style> - <style type="text/css"> - @media only screen and (max-width: 480px) { - table.mj-full-width-mobile { - width: 100% !important; - } - - td.mj-full-width-mobile { - width: auto !important; - } - } - </style> - </head> - - <body style="word-spacing: normal; background-color: #f2f7fa"> - <div style="background-color: #f2f7fa"> - <!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:600px;" width="600" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]--> - <div style="margin: 0px auto; max-width: 600px"> - <table - align="center" - border="0" - cellpadding="0" - cellspacing="0" - role="presentation" - style="width: 100%" - > - <tbody> - <tr> - <td - style=" - direction: ltr; - font-size: 0px; - padding: 20px 0px 20px 0px; - padding-bottom: 0px; - padding-top: 0px; - text-align: center; - " - > - <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]--> - <div - class="mj-column-per-100 mj-outlook-group-fix" - style=" - font-size: 0px; - text-align: left; - direction: ltr; - display: inline-block; - vertical-align: top; - width: 100%; - " - > - <table - border="0" - cellpadding="0" - cellspacing="0" - role="presentation" - style="vertical-align: top" - width="100%" - > - <tbody> - <tr> - <td - align="left" - style=" - font-size: 0px; - padding: 0px 0px 0px 25px; - padding-top: 0px; - padding-bottom: 0px; - word-break: break-word; - " - > - <div - style=" - font-family: Open Sans, Helvetica, Arial, - sans-serif; - font-size: 11px; - line-height: 22px; - text-align: left; - color: #797e82; - " - > - <br /> - </div> - </td> - </tr> - </tbody> - </table> - </div> - <!--[if mso | IE]></td></tr></table><![endif]--> - </td> - </tr> - </tbody> - </table> - </div> - <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:600px;" width="600" bgcolor="#ffffff" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]--> - <div - style=" - background: #ffffff; - background-color: #ffffff; - margin: 0px auto; - max-width: 600px; - " - > - <table - align="center" - border="0" - cellpadding="0" - cellspacing="0" - role="presentation" - style="background: #ffffff; background-color: #ffffff; width: 100%" - > - <tbody> - <tr> - <td - style=" - direction: ltr; - font-size: 0px; - padding: 20px 0; - padding-bottom: 0px; - padding-left: 0px; - padding-right: 0px; - padding-top: 0px; - text-align: center; - " - > - <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]--> - <div - class="mj-column-per-100 mj-outlook-group-fix" - style=" - font-size: 0px; - text-align: left; - direction: ltr; - display: inline-block; - vertical-align: top; - width: 100%; - " - > - <table - border="0" - cellpadding="0" - cellspacing="0" - role="presentation" - style="vertical-align: top" - width="100%" - > - <tbody> - <tr> - <td - align="center" - style=" - font-size: 0px; - padding: 10px 25px; - padding-top: 0px; - padding-right: 0px; - padding-bottom: 40px; - padding-left: 0px; - word-break: break-word; - " - > - <p - style=" - border-top: solid 8px #005a8e; - font-size: 1px; - margin: 0px auto; - width: 100%; - " - ></p> - <!--[if mso | IE - ]><table - align="center" - border="0" - cellpadding="0" - cellspacing="0" - style=" - border-top: solid 8px #005a8e; - font-size: 1px; - margin: 0px auto; - width: 600px; - " - role="presentation" - width="600px" - > - <tr> - <td style="height: 0; line-height: 0"> - - </td> - </tr> - </table><! - [endif]--> - </td> - </tr> - <tr> - <td - align="center" - style=" - font-size: 0px; - padding: 10px 25px; - padding-top: 0px; - padding-bottom: 0px; - word-break: break-word; - " - > - <table - border="0" - cellpadding="0" - cellspacing="0" - role="presentation" - style=" - border-collapse: collapse; - border-spacing: 0px; - " - > - <tbody> - <tr> - <td style="width: 121px"> - <img - alt="" - height="auto" - src="https://data.vespa.oath.cloud/assets/vespa-cloud-logo.png" - style=" - border: none; - display: block; - outline: none; - text-decoration: none; - height: auto; - width: 100%; - font-size: 13px; - " - width="121" - /> - </td> - </tr> - </tbody> - </table> - </td> - </tr> - </tbody> - </table> - </div> - <!--[if mso | IE]></td></tr></table><![endif]--> - </td> - </tr> - </tbody> - </table> - </div> - <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:600px;" width="600" bgcolor="#ffffff" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]--> - <div - style=" - background: #ffffff; - background-color: #ffffff; - margin: 0px auto; - max-width: 600px; - " - > - <table - align="center" - border="0" - cellpadding="0" - cellspacing="0" - role="presentation" - style="background: #ffffff; background-color: #ffffff; width: 100%" - > - <tbody> - <tr> - <td - style=" - direction: ltr; - font-size: 0px; - padding: 20px 0px 20px 0px; - padding-bottom: 70px; - padding-top: 30px; - text-align: center; - " - > - <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]--> - <div - class="mj-column-per-100 mj-outlook-group-fix" - style=" - font-size: 0px; - text-align: left; - direction: ltr; - display: inline-block; - vertical-align: top; - width: 100%; - " - > - <table - border="0" - cellpadding="0" - cellspacing="0" - role="presentation" - style="vertical-align: top" - width="100%" - > - -<tbody> -<tr> - <td - align="left" - style=" - font-size: 0px; - padding: 0px 25px 0px 25px; - padding-top: 0px; - padding-right: 50px; - padding-bottom: 0px; - padding-left: 50px; - word-break: break-word; - " - > - <div - style=" - font-family: Open Sans, Helvetica, Arial, - sans-serif; - font-size: 13px; - line-height: 22px; - text-align: left; - color: #797e82; - " - > - <h1 - style=" - text-align: center; - color: #000000; - line-height: 32px; - " - > - Your Vespa Cloud trial expires in 2 days - </h1> - </div> - </td> -</tr> -<tr> - <td - align="left" - style=" - font-size: 0px; - padding: 0px 25px 0px 25px; - padding-top: 0px; - padding-right: 50px; - padding-bottom: 0px; - padding-left: 50px; - word-break: break-word; - " - > - <div - style=" - font-family: Open Sans, Helvetica, Arial, - sans-serif; - font-size: 13px; - line-height: 22px; - text-align: left; - color: #797e82; - " - > - -<p> - Your Vespa Cloud trial expires in 2 days. Please reach out to us if you have any questions or feedback. -</p> - </div> - </td> -</tr> -<tr> - <td - align="center" - vertical-align="middle" - style=" - font-size: 0px; - padding: 10px 25px; - padding-top: 20px; - padding-bottom: 20px; - word-break: break-word; - " - > - <table - border="0" - cellpadding="0" - cellspacing="0" - role="presentation" - style="border-collapse: separate; line-height: 100%" - > - <tbody> - <tr> - <td - align="center" - bgcolor="#005A8E" - role="presentation" - style=" - border: none; - border-radius: 100px; - cursor: auto; - mso-padding-alt: 15px 25px 15px 25px; - background: #005a8e; - " - valign="middle" - > - <a - href="https://console.tld/tenant/trial-tenant" - style=" - display: inline-block; - background: #005a8e; - color: #ffffff; - font-family: Open Sans, Helvetica, Arial, - sans-serif; - font-size: 13px; - font-weight: normal; - line-height: 120%; - margin: 0; - text-decoration: none; - text-transform: none; - padding: 15px 25px 15px 25px; - mso-padding-alt: 0px; - border-radius: 100px; - " - target="_blank" - ><b style="font-weight: 700" - ><b style="font-weight: 700" - >Go to Console</b - ></b - ></a - > - </td> - </tr> - </tbody> - </table> - </td> -</tr> -</tbody> - </table> - </div> - <!--[if mso | IE]></td></tr></table><![endif]--> - </td> - </tr> - </tbody> - </table> - </div> - <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:600px;" width="600" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]--> - <div style="margin: 0px auto; max-width: 600px"> - <table - align="center" - border="0" - cellpadding="0" - cellspacing="0" - role="presentation" - style="width: 100%" - > - <tbody> - <tr> - <td - style=" - direction: ltr; - font-size: 0px; - padding: 20px 0px 20px 0px; - padding-bottom: 0px; - padding-top: 20px; - text-align: center; - " - > - <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]--> - <div - class="mj-column-per-100 mj-outlook-group-fix" - style=" - font-size: 0px; - text-align: left; - direction: ltr; - display: inline-block; - vertical-align: top; - width: 100%; - " - > - <table - border="0" - cellpadding="0" - cellspacing="0" - role="presentation" - style="vertical-align: top" - width="100%" - > - <tbody> - <tr> - <td - align="center" - style=" - font-size: 0px; - padding: 0px 20px 0px 20px; - padding-top: 0px; - padding-bottom: 0px; - word-break: break-word; - " - > - <div - style=" - font-family: Open Sans, Helvetica, Arial, - sans-serif; - font-size: 11px; - line-height: 22px; - text-align: center; - color: #797e82; - " - > - <p style="margin: 10px 0"> - <a - target="_blank" - rel="noopener noreferrer" - style="color: #005a8e" - href="https://legal.yahoo.com/xw/en/yahoo/privacy/topic/b2bprivacypolicy/index.html" - ><span style="color: #005a8e" - >Yahoo Privacy Policy</span - ></a - ><span style="color: #797e82" - > | </span - ><a - target="_blank" - rel="noopener noreferrer" - style="color: #005a8e" - href="https://console.tld/terms-of-service-trial.html" - ><span style="color: #005a8e" - >Terms of Service</span - ></a - ><span style="color: #797e82" - > | </span - ><a - target="_blank" - rel="noopener noreferrer" - style="color: #005a8e" - href="https://console.tld/support" - ><span style="color: #005a8e">Support</span></a - > - </p> - <p style="margin: 10px 0"> - <a - target="_blank" - rel="noopener noreferrer" - style="color: inherit; text-decoration: none" - href="https://console.tld/tenant/trial-tenant/account/notifications" - >Click - <span style="color: #005a8e"><u>here</u></span> - to manage your notifications setting.</a - ><br /> - </p> - </div> - </td> - </tr> - </tbody> - </table> - </div> - <!--[if mso | IE]></td></tr></table><![endif]--> - </td> - </tr> - </tbody> - </table> - </div> - <!--[if mso | IE]></td></tr></table><![endif]--> - </div> - </body> -</html> |