Commit 2e733ba4 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch 'jh-member_overage_mailer' into 'master'

Add SubscriptionMailer for seat overages

See merge request gitlab-org/gitlab!79088
parents d45f4217 570016c1
# frozen_string_literal: true
module GitlabSubscriptions
class SeatUsageMailer < ApplicationMailer
helper EmailsHelper
layout 'mailer'
def exceeded_purchased_seats(user:, subscription_name:, seat_overage:)
@customer_name = user.name
@subscription_name = subscription_name
@seat_overage = seat_overage
mail(
to: user.email,
subject: s_('SubscriptionEmail|Additional charges for your GitLab subscription')
)
end
end
end
# frozen_string_literal: true
module GitlabSubscriptions
class SeatUsageMailerPreview < ActionMailer::Preview
def exceeded_purchased_seats
::GitlabSubscriptions::SeatUsageMailer.exceeded_purchased_seats(
user: User.first,
subscription_name: 'A-123456',
seat_overage: 5
)
end
end
end
%p
= s_('SubscriptionEmail|Dear %{customer_name},') % { customer_name: @customer_name }
%p
= html_escape(s_("SubscriptionEmail|You have exceeded the number of seats in your GitLab subscription %{subscription_name} by %{seat_quantity}. Even if you've exceeded the seats in your subscription, you can continue to add users, and GitLab will bill you a prorated amount for any seat overages on a quarterly basis.")) % { subscription_name: "<strong>#{@subscription_name}</strong>".html_safe, seat_quantity: "<strong>#{@seat_overage}</strong>".html_safe }
%p
= html_escape(s_('SubscriptionEmail|You can find more information about the quarterly reconciliation process in %{doc_link_start}our documentation%{doc_link_end}.')) % { doc_link_start: '<a href="https://docs.gitlab.com/ee/subscriptions/quarterly_reconciliation.html#quarterly-reconciliation-process">'.html_safe, doc_link_end: '</a>'.html_safe }
%p
= html_escape(s_("SubscriptionEmail|%{doc_link_start}Please reach out if you have questions%{doc_link_end}, and we'll be happy to assist.")) % { doc_link_start: "<a href=\"#{Gitlab::Saas.customer_license_support_url}\">".html_safe, doc_link_end: "</a>".html_safe}
%p
= s_("SubscriptionEmail|Thank you for your business!")
%p
= s_("SubscriptionEmail|GitLab Billing Team")
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe GitlabSubscriptions::SeatUsageMailer do
include EmailSpec::Matchers
describe '#exceeded_purchased_seats' do
context 'when supplied valid args' do
let_it_be(:user) { create(:user, name: 'John Doe') }
subject do
described_class.exceeded_purchased_seats(user: user, subscription_name: 'A-123456', seat_overage: 5)
end
it { is_expected.to have_subject 'Additional charges for your GitLab subscription' }
it { is_expected.to have_body_text "Dear John Doe," }
it { is_expected.to have_body_text "your GitLab subscription <strong>A-123456</strong> by <strong>5</strong>" }
end
end
end
...@@ -34441,6 +34441,27 @@ msgstr "" ...@@ -34441,6 +34441,27 @@ msgstr ""
msgid "SubscriptionBanner|Upload new license" msgid "SubscriptionBanner|Upload new license"
msgstr "" msgstr ""
msgid "SubscriptionEmail|%{doc_link_start}Please reach out if you have questions%{doc_link_end}, and we'll be happy to assist."
msgstr ""
msgid "SubscriptionEmail|Additional charges for your GitLab subscription"
msgstr ""
msgid "SubscriptionEmail|Dear %{customer_name},"
msgstr ""
msgid "SubscriptionEmail|GitLab Billing Team"
msgstr ""
msgid "SubscriptionEmail|Thank you for your business!"
msgstr ""
msgid "SubscriptionEmail|You can find more information about the quarterly reconciliation process in %{doc_link_start}our documentation%{doc_link_end}."
msgstr ""
msgid "SubscriptionEmail|You have exceeded the number of seats in your GitLab subscription %{subscription_name} by %{seat_quantity}. Even if you've exceeded the seats in your subscription, you can continue to add users, and GitLab will bill you a prorated amount for any seat overages on a quarterly basis."
msgstr ""
msgid "SubscriptionTable|Add seats" msgid "SubscriptionTable|Add seats"
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