Chore: Remove dead code related to billing (#935)

- remove subscription model
- remove billing-related code
This commit is contained in:
Sojan Jose
2020-06-07 20:31:48 +05:30
committed by GitHub
parent 051871a3cd
commit 52d28105e4
84 changed files with 27 additions and 1240 deletions

View File

@@ -1,46 +0,0 @@
require 'rails_helper'
RSpec.describe 'Subscriptions API', type: :request do
let(:account) { create(:account) }
describe 'GET /api/v1/accounts/{account.id}/subscriptions' do
context 'when it is an unauthenticated user' do
it 'returns unauthorized' do
ENV['BILLING_ENABLED'] = 'true'
get "/api/v1/accounts/#{account.id}/subscriptions"
expect(response).to have_http_status(:unauthorized)
ENV['BILLING_ENABLED'] = nil
end
end
context 'when it is an authenticated user' do
let(:agent) { create(:user, account: account, role: :agent) }
it 'returns all subscriptions' do
ENV['BILLING_ENABLED'] = 'true'
get "/api/v1/accounts/#{account.id}/subscriptions",
headers: agent.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body)).to eq(account.subscription_data.as_json)
ENV['BILLING_ENABLED'] = nil
end
it 'throws 404 error if env variable is not set' do
ENV['BILLING_ENABLED'] = nil
get "/api/v1/accounts/#{account.id}/subscriptions",
headers: agent.create_new_auth_token,
as: :json
expect(response).to have_http_status(:not_found)
end
end
end
end

View File

@@ -1,15 +0,0 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
pricing_version: MyString
account_id: 1
expiry: 2017-04-24 22:47:08
billing_plan: MyString
stripe_customer_id: MyString
two:
pricing_version: MyString
account_id: 1
expiry: 2017-04-24 22:47:08
billing_plan: MyString
stripe_customer_id: MyString

View File

@@ -14,7 +14,6 @@ RSpec.describe Account do
it { is_expected.to have_many(:canned_responses).dependent(:destroy) }
it { is_expected.to have_many(:facebook_pages).class_name('::Channel::FacebookPage').dependent(:destroy) }
it { is_expected.to have_many(:web_widgets).class_name('::Channel::WebWidget').dependent(:destroy) }
it { is_expected.to have_one(:subscription).dependent(:destroy) }
it { is_expected.to have_many(:webhooks).dependent(:destroy) }
it { is_expected.to have_many(:notification_settings).dependent(:destroy) }
it { is_expected.to have_many(:events) }