Commit ada7968c authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'jejacks0n-auto-renew-on-gitlab-subscription' into 'master'

Add auto_renew to gitlab subscriptions

See merge request gitlab-org/gitlab!24896
parents 9d990969 c015afc9
# frozen_string_literal: true
class AddAutoRenewToGitlabSubscriptions < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
add_column :gitlab_subscription_histories, :auto_renew, :boolean
add_column :gitlab_subscriptions, :auto_renew, :boolean
end
end
......@@ -1912,6 +1912,7 @@ ActiveRecord::Schema.define(version: 2020_02_14_034836) do
t.bigint "gitlab_subscription_id", null: false
t.datetime_with_timezone "created_at"
t.date "trial_starts_on"
t.boolean "auto_renew"
t.index ["gitlab_subscription_id"], name: "index_gitlab_subscription_histories_on_gitlab_subscription_id"
end
......@@ -1927,6 +1928,7 @@ ActiveRecord::Schema.define(version: 2020_02_14_034836) do
t.integer "seats", default: 0
t.boolean "trial", default: false
t.date "trial_starts_on"
t.boolean "auto_renew"
t.index ["hosted_plan_id"], name: "index_gitlab_subscriptions_on_hosted_plan_id"
t.index ["namespace_id"], name: "index_gitlab_subscriptions_on_namespace_id", unique: true
end
......
---
title: Add auto_renew attribute to gitlab_subscriptions and expose via api
merge_request: 24896
author: jejacks0n
type: changed
......@@ -705,6 +705,7 @@ module EE
expose :plan_name, as: :code
expose :plan_title, as: :name
expose :trial
expose :auto_renew
expose :upgradable?, as: :upgradable
end
......
......@@ -40,6 +40,7 @@ module EE
optional :max_seats_used, type: Integer, default: 0, desc: 'The max number of active users detected in the last month'
optional :plan_code, type: String, desc: 'The code of the purchased plan'
optional :end_date, type: Date, desc: 'The date when subscription expires'
optional :auto_renew, type: Grape::API::Boolean, desc: 'Whether the subscription auto renews'
optional :trial, type: Grape::API::Boolean, desc: 'Whether the subscription is trial'
optional :trial_ends_on, type: Date, desc: 'The date when the trial expires'
optional :trial_starts_on, type: Date, desc: 'The date when the trial starts'
......
......@@ -42,6 +42,7 @@ module EE
hosted_plan_id: namespace.plan_id,
trial: namespace.trial_active?,
start_date: namespace.created_at.to_date,
auto_renew: false,
seats: 0,
created_at: now,
updated_at: now
......
......@@ -279,7 +279,7 @@ describe API::Namespaces do
do_get(owner)
expect(json_response.keys).to match_array(%w[plan usage billing])
expect(json_response['plan'].keys).to match_array(%w[name code trial upgradable])
expect(json_response['plan'].keys).to match_array(%w[name code trial upgradable auto_renew])
expect(json_response['plan']['name']).to eq('Silver')
expect(json_response['plan']['code']).to eq('silver')
expect(json_response['plan']['trial']).to eq(false)
......
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