mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-02-27 14:29:39 +00:00
Previously, when a user canceled a subscription, the access would revoke immediately on Discourse vs. at the end of the billing period. This commit changes the behavior to remove membership at the end of the billing period using Stripe's `cancel_at_period_end` attribute on the Subscription object. This commit now requires the setup of webhooks for subscription processing to occur correctly.
32 lines
936 B
Ruby
32 lines
936 B
Ruby
# frozen_string_literal: true
|
|
require_dependency "subscriptions_user_constraint"
|
|
|
|
DiscourseSubscriptions::Engine.routes.draw do
|
|
# TODO: namespace this
|
|
scope 'admin' do
|
|
get '/' => 'admin#index'
|
|
end
|
|
|
|
namespace :admin do
|
|
resources :plans
|
|
resources :subscriptions, only: [:index, :destroy]
|
|
resources :products
|
|
end
|
|
|
|
namespace :user do
|
|
resources :payments, only: [:index]
|
|
resources :subscriptions, only: [:index, :destroy]
|
|
end
|
|
|
|
resources :customers, only: [:create]
|
|
resources :plans, only: [:index], constraints: SubscriptionsUserConstraint.new
|
|
resources :products, only: [:index, :show]
|
|
resources :subscriptions, only: [:create]
|
|
|
|
post '/subscriptions/finalize' => 'subscriptions#finalize'
|
|
|
|
post '/hooks' => 'hooks#create'
|
|
get '/' => 'subscriptions#index', constraints: SubscriptionsUserConstraint.new
|
|
get '/:id' => 'subscriptions#index', constraints: SubscriptionsUserConstraint.new
|
|
end
|