Commit 314f8285 authored by Jay Swain's avatar Jay Swain

Subscription banner doesn't display for auto-renew

Customers with auto-renew enabled for their subscription should not
receive the expiring subscription banner because it may cause them to
cancel their subscription.

part of:
https://gitlab.com/gitlab-org/growth/product/-/issues/1576
parent 6ac803ea
---
title: Expired subscription banner doesn't display for auto-renew
merge_request: 37127
author:
type: changed
...@@ -49,11 +49,7 @@ module Gitlab ...@@ -49,11 +49,7 @@ module Gitlab
end end
def expiring_subject def expiring_subject
if auto_renew? _('Your subscription will expire in %{remaining_days}.') % { remaining_days: remaining_days_formatted }
_('Your subscription will automatically renew in %{remaining_days}.') % { remaining_days: remaining_days_formatted }
else
_('Your subscription will expire in %{remaining_days}.') % { remaining_days: remaining_days_formatted }
end
end end
def expiration_blocking_message def expiration_blocking_message
...@@ -93,17 +89,13 @@ module Gitlab ...@@ -93,17 +89,13 @@ module Gitlab
end end
def namespace_expiring_message def namespace_expiring_message
if auto_renew? message = []
_('We will automatically renew your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} on %{strong}%{expires_on}%{strong_close}. There\'s nothing that you need to do, we\'ll let you know when the renewal is complete. Need more seats, a higher plan or just want to review your payment method?') % { expires_on: expires_at_or_cutoff_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
else
message = []
message << _('Your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} will expire on %{strong}%{expires_on}%{strong_close}.') % { expires_on: expires_at_or_cutoff_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name } message << _('Your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} will expire on %{strong}%{expires_on}%{strong_close}.') % { expires_on: expires_at_or_cutoff_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
message << expiring_features_message message << expiring_features_message
message.join(' ') message.join(' ')
end
end end
def expiring_features_message def expiring_features_message
...@@ -126,6 +118,8 @@ module Gitlab ...@@ -126,6 +118,8 @@ module Gitlab
end end
def require_notification? def require_notification?
return false if expiring_auto_renew?
auto_renew_choice_exists? && expired_subscribable_within_notification_window? auto_renew_choice_exists? && expired_subscribable_within_notification_window?
end end
...@@ -133,6 +127,10 @@ module Gitlab ...@@ -133,6 +127,10 @@ module Gitlab
auto_renew? != nil auto_renew? != nil
end end
def expiring_auto_renew?
auto_renew? && !expired_but_within_cutoff?
end
def expired_subscribable_within_notification_window? def expired_subscribable_within_notification_window?
return true unless expired_but_within_cutoff? return true unless expired_but_within_cutoff?
......
...@@ -197,16 +197,8 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do ...@@ -197,16 +197,8 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do
context 'is auto_renew' do context 'is auto_renew' do
let(:auto_renew) { true } let(:auto_renew) { true }
it 'has a nice subject' do it 'returns nil' do
Timecop.freeze(today) do expect(subject).to be nil
expect(subject).to include('Your subscription will automatically renew in 2 days.')
end
end
it 'has an expiration blocking message' do
Timecop.freeze(today) do
expect(subject).to include("We will automatically renew your Ultimate subscription for No Limit Records on 2020-03-09. There's nothing that you need to do, we'll let you know when the renewal is complete. Need more seats, a higher plan or just want to review your payment method?")
end
end end
end end
end end
......
...@@ -26575,9 +26575,6 @@ msgstr "" ...@@ -26575,9 +26575,6 @@ msgstr ""
msgid "We want to be sure it is you, please confirm you are not a robot." msgid "We want to be sure it is you, please confirm you are not a robot."
msgstr "" msgstr ""
msgid "We will automatically renew your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} on %{strong}%{expires_on}%{strong_close}. There's nothing that you need to do, we'll let you know when the renewal is complete. Need more seats, a higher plan or just want to review your payment method?"
msgstr ""
msgid "We've found no vulnerabilities" msgid "We've found no vulnerabilities"
msgstr "" msgstr ""
...@@ -27621,9 +27618,6 @@ msgstr "" ...@@ -27621,9 +27618,6 @@ msgstr ""
msgid "Your subscription has been downgraded." msgid "Your subscription has been downgraded."
msgstr "" msgstr ""
msgid "Your subscription will automatically renew in %{remaining_days}."
msgstr ""
msgid "Your subscription will expire in %{remaining_days}." msgid "Your subscription will expire in %{remaining_days}."
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment