Commit dc9c50d7 authored by Ammar Alakkad's avatar Ammar Alakkad Committed by Vitaly Slobodin

Use plan name instead of plan code in new subscription app

parent 062788e5
......@@ -5,7 +5,7 @@ import { STEPS, TAX_RATE } from '../constants';
const parsePlanData = (planData) =>
JSON.parse(planData).map((plan) => ({
value: plan.id,
text: capitalizeFirstCharacter(plan.code),
text: capitalizeFirstCharacter(plan.name),
pricePerUserPerYear: plan.price_per_year,
}));
......
......@@ -34,7 +34,7 @@ module SubscriptionsHelper
FetchSubscriptionPlansService.new(plan: :free).execute
.map(&:symbolize_keys)
.reject { |plan_data| plan_data[:free] }
.map { |plan_data| plan_data.slice(:id, :code, :price_per_year, :deprecated) }
.map { |plan_data| plan_data.slice(:id, :code, :price_per_year, :deprecated, :name) }
end
def subscription_available_plans
......
---
title: Use plan name instead of plan code in new subscription app
merge_request: 52414
author:
type: other
......@@ -11,9 +11,9 @@ describe('Order Summary', () => {
let wrapper;
const availablePlans = [
{ id: 'firstPlanId', code: 'bronze', price_per_year: 48 },
{ id: 'secondPlanId', code: 'silver', price_per_year: 228 },
{ id: 'thirdPlanId', code: 'gold', price_per_year: 1188 },
{ id: 'firstPlanId', code: 'bronze', price_per_year: 48, name: 'bronze plan' },
{ id: 'secondPlanId', code: 'silver', price_per_year: 228, name: 'silver plan' },
{ id: 'thirdPlanId', code: 'gold', price_per_year: 1188, name: 'gold plan' },
];
const initialData = {
......
......@@ -14,8 +14,8 @@ describe('Subscription Details', () => {
let wrapper;
const availablePlans = [
{ id: 'firstPlanId', code: 'bronze', price_per_year: 48 },
{ id: 'secondPlanId', code: 'silver', price_per_year: 228 },
{ id: 'firstPlanId', code: 'bronze', price_per_year: 48, name: 'bronze' },
{ id: 'secondPlanId', code: 'silver', price_per_year: 228, name: 'silver' },
];
const groupData = [
......
......@@ -6,8 +6,8 @@ constants.TAX_RATE = 0;
describe('projectsSelector default state', () => {
const availablePlans = [
{ id: 'firstPlanId', code: 'bronze', price_per_year: 48 },
{ id: 'secondPlanId', code: 'silver', price_per_year: 228 },
{ id: 'firstPlanId', code: 'bronze', price_per_year: 48, name: 'Bronze Plan' },
{ id: 'secondPlanId', code: 'silver', price_per_year: 228, name: 'silver Plan' },
];
const groupData = [
......@@ -38,8 +38,8 @@ describe('projectsSelector default state', () => {
describe('availablePlans', () => {
it('sets the availablePlans to the provided parsed availablePlans', () => {
expect(state.availablePlans).toEqual([
{ value: 'firstPlanId', text: 'Bronze', pricePerUserPerYear: 48 },
{ value: 'secondPlanId', text: 'Silver', pricePerUserPerYear: 228 },
{ value: 'firstPlanId', text: 'Bronze Plan', pricePerUserPerYear: 48 },
{ value: 'secondPlanId', text: 'Silver Plan', pricePerUserPerYear: 228 },
]);
});
......
......@@ -45,7 +45,7 @@ RSpec.describe SubscriptionsHelper do
it { is_expected.to include(setup_for_company: 'false') }
it { is_expected.to include(full_name: 'First Last') }
it { is_expected.to include(available_plans: '[{"id":"bronze_id","code":"bronze","price_per_year":48.0}]') }
it { is_expected.to include(available_plans: '[{"id":"bronze_id","code":"bronze","price_per_year":48.0,"name":"Bronze Plan"}]') }
it { is_expected.to include(plan_id: 'bronze_id') }
it { is_expected.to include(namespace_id: group.id.to_s) }
it { is_expected.to include(group_data: %Q{[{"id":#{group.id},"name":"My Namespace","users":1}]}) }
......@@ -78,7 +78,7 @@ RSpec.describe SubscriptionsHelper do
}
end
it { is_expected.to include(available_plans: '[{"id":"bronze_id","code":"bronze","price_per_year":48.0,"deprecated":true}]') }
it { is_expected.to include(available_plans: '[{"id":"bronze_id","code":"bronze","price_per_year":48.0,"deprecated":true,"name":"Bronze Plan"}]') }
end
context 'when ff purchase_deprecated_plans is enabled' do
......@@ -86,7 +86,7 @@ RSpec.describe SubscriptionsHelper do
stub_feature_flags(hide_deprecated_billing_plans: true)
end
it { is_expected.to include(available_plans: '[{"id":"bronze_id","code":"bronze","price_per_year":48.0}]') }
it { is_expected.to include(available_plans: '[{"id":"bronze_id","code":"bronze","price_per_year":48.0,"name":"Bronze Plan"}]') }
context 'when bronze_plan is deprecated' do
let(:bronze_plan) do
......
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