Commit 75e1d74e authored by Jay Swain's avatar Jay Swain

Renewal banner has auto-renew specific messaging

The expring subscribable banner has messaging specific to auto-renew

part of: https://gitlab.com/gitlab-org/growth/product/-/issues/143
parent 85e08c21
---
title: Renewal banner has auto-renew specific messaging
merge_request: 28579
author:
type: added
...@@ -35,7 +35,11 @@ module Gitlab ...@@ -35,7 +35,11 @@ module Gitlab
def expired_subject def expired_subject
if subscribable.block_changes? if subscribable.block_changes?
if auto_renew?
_('Something went wrong with your automatic subscription renewal')
else
_('Your subscription has been downgraded') _('Your subscription has been downgraded')
end
else else
_('Your subscription expired!') _('Your subscription expired!')
end end
...@@ -44,8 +48,12 @@ module Gitlab ...@@ -44,8 +48,12 @@ module Gitlab
def expiring_subject def expiring_subject
remaining_days = pluralize(subscribable.remaining_days, 'day') remaining_days = pluralize(subscribable.remaining_days, 'day')
if auto_renew?
_('Your subscription will automatically renew in %{remaining_days}') % { remaining_days: remaining_days }
else
_('Your subscription will expire in %{remaining_days}') % { remaining_days: remaining_days } _('Your subscription will expire in %{remaining_days}') % { remaining_days: remaining_days }
end end
end
def expiration_blocking_message def expiration_blocking_message
return '' unless subscribable.will_block_changes? return '' unless subscribable.will_block_changes?
...@@ -56,25 +64,41 @@ module Gitlab ...@@ -56,25 +64,41 @@ module Gitlab
end end
def expired_message def expired_message
if subscribable.block_changes? return block_changes_message if subscribable.block_changes?
if namespace
_('You didn\'t renew your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} so it was downgraded to the free plan.') % { plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
else
_('You didn\'t renew your %{strong}%{plan_name}%{strong_close} subscription so it was downgraded to the GitLab Core Plan.') % { plan_name: plan_name, strong: strong, strong_close: strong_close }
end
else
remaining_days = pluralize((subscribable.block_changes_at - Date.today).to_i, 'day') remaining_days = pluralize((subscribable.block_changes_at - Date.today).to_i, 'day')
_('No worries, you can still use all the %{strong}%{plan_name}%{strong_close} features for now. You have %{remaining_days} to renew your subscription.') % { plan_name: plan_name, remaining_days: remaining_days, strong: strong, strong_close: strong_close } _('No worries, you can still use all the %{strong}%{plan_name}%{strong_close} features for now. You have %{remaining_days} to renew your subscription.') % { plan_name: plan_name, remaining_days: remaining_days, strong: strong, strong_close: strong_close }
end end
def block_changes_message
return namespace_block_changes_message if namespace
_('You didn\'t renew your %{strong}%{plan_name}%{strong_close} subscription so it was downgraded to the GitLab Core Plan.') % { plan_name: plan_name, strong: strong, strong_close: strong_close }
end end
def expiring_message def namespace_block_changes_message
if namespace if auto_renew?
_('Your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} will expire on %{strong}%{expires_on}%{strong_close}. After that, you will not to be able to create issues or merge requests as well as many other features.') % { expires_on: subscribable.expires_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name } support_link = '<a href="mailto:support@gitlab.com">support@gitlab.com</a>'.html_safe
_('We tried to automatically renew your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} on %{expires_on} but something went wrong so your subscription was downgraded to the free plan. Don\'t worry, your data is safe. We suggest you check your payment method and get in touch with our support team (%{support_link}). They\'ll gladly help with your subscription renewal.') % { plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name, support_link: support_link, expires_on: subscribable.expires_at.strftime("%Y-%m-%d") }
else else
_('You didn\'t renew your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} so it was downgraded to the free plan.') % { plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
end
end
def expiring_message
return namespace_expiring_message if namespace
_('Your %{strong}%{plan_name}%{strong_close} subscription will expire on %{strong}%{expires_on}%{strong_close}. After that, you will not to be able to create issues or merge requests as well as many other features.') % { expires_on: subscribable.expires_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close } _('Your %{strong}%{plan_name}%{strong_close} subscription will expire on %{strong}%{expires_on}%{strong_close}. After that, you will not to be able to create issues or merge requests as well as many other features.') % { expires_on: subscribable.expires_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close }
end end
def namespace_expiring_message
if auto_renew?
_('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: subscribable.expires_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
else
_('Your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} will expire on %{strong}%{expires_on}%{strong_close}. After that, you will not to be able to create issues or merge requests as well as many other features.') % { expires_on: subscribable.expires_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
end
end end
def notifiable? def notifiable?
...@@ -102,5 +126,9 @@ module Gitlab ...@@ -102,5 +126,9 @@ module Gitlab
def strong_close def strong_close
'</strong>'.html_safe '</strong>'.html_safe
end end
def auto_renew?
subscribable.try(:auto_renew?)
end
end end
end end
...@@ -66,8 +66,6 @@ describe Gitlab::ExpiringSubscriptionMessage do ...@@ -66,8 +66,6 @@ describe Gitlab::ExpiringSubscriptionMessage do
end end
it 'has a nice subject' do it 'has a nice subject' do
allow(subscribable).to receive(:will_block_changes?).and_return(false)
Timecop.freeze(today) do Timecop.freeze(today) do
expect(subject).to include('Your subscription has been downgraded') expect(subject).to include('Your subscription has been downgraded')
end end
...@@ -89,6 +87,24 @@ describe Gitlab::ExpiringSubscriptionMessage do ...@@ -89,6 +87,24 @@ describe Gitlab::ExpiringSubscriptionMessage do
expect(subject).to include("You didn't renew your Ultimate subscription for No Limit Records so it was downgraded to the free plan") expect(subject).to include("You didn't renew your Ultimate subscription for No Limit Records so it was downgraded to the free plan")
end end
end end
context 'is auto_renew' do
before do
allow(subscribable).to receive(:auto_renew?).and_return(true)
end
it 'has a nice subject' do
Timecop.freeze(today) do
expect(subject).to include('Something went wrong with your automatic subscription renewal')
end
end
it 'has an expiration blocking message' do
Timecop.freeze(today) do
expect(subject).to include("We tried to automatically renew your Ultimate subscription for No Limit Records on 2020-03-01 but something went wrong so your subscription was downgraded to the free plan. Don't worry, your data is safe. We suggest you check your payment method and get in touch with our support team (support@gitlab.com). They'll gladly help with your subscription renewal.")
end
end
end
end end
end end
...@@ -146,6 +162,22 @@ describe Gitlab::ExpiringSubscriptionMessage do ...@@ -146,6 +162,22 @@ describe Gitlab::ExpiringSubscriptionMessage do
expect(subject).to include('Your Ultimate subscription for No Limit Records will expire on 2020-03-09. After that, you will not to be able to create issues or merge requests as well as many other features.') expect(subject).to include('Your Ultimate subscription for No Limit Records will expire on 2020-03-09. After that, you will not to be able to create issues or merge requests as well as many other features.')
end end
end end
context 'is auto_renew' do
before do
allow(subscribable).to receive(:auto_renew?).and_return(true)
end
it 'has a nice subject' do
expect(subject).to include('Your subscription will automatically renew in 4 days')
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
end end
......
...@@ -19124,6 +19124,9 @@ msgstr "" ...@@ -19124,6 +19124,9 @@ msgstr ""
msgid "Something went wrong while updating your list settings" msgid "Something went wrong while updating your list settings"
msgstr "" msgstr ""
msgid "Something went wrong with your automatic subscription renewal"
msgstr ""
msgid "Something went wrong, unable to add %{project} to dashboard" msgid "Something went wrong, unable to add %{project} to dashboard"
msgstr "" msgstr ""
...@@ -23245,9 +23248,15 @@ msgstr "" ...@@ -23245,9 +23248,15 @@ msgstr ""
msgid "We sent you an email with reset password instructions" msgid "We sent you an email with reset password instructions"
msgstr "" msgstr ""
msgid "We tried to automatically renew your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} on %{expires_on} but something went wrong so your subscription was downgraded to the free plan. Don't worry, your data is safe. We suggest you check your payment method and get in touch with our support team (%{support_link}). They'll gladly help with your subscription renewal."
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 ""
...@@ -24174,6 +24183,9 @@ msgstr "" ...@@ -24174,6 +24183,9 @@ 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