mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-03-07 01:59:35 +00:00
Building off the foundation of using the Prices API, this PR adds the ability to create a one-time purchase plan for any product, which then can add a user to the specified plan group. Some things to be aware of: One-time purchases cannot have trials. One-time purchases use the Invoice API instead of Subscriptions. Invoices are created then charged immediately. Users should receive emails for these invoices directly from Stripe just like subscriptions.
30 lines
876 B
Ruby
30 lines
876 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 :hooks, only: [:create]
|
|
resources :plans, only: [:index], constraints: SubscriptionsUserConstraint.new
|
|
resources :products, only: [:index, :show]
|
|
resources :subscriptions, only: [:create]
|
|
|
|
get '/' => 'subscriptions#index', constraints: SubscriptionsUserConstraint.new
|
|
get '/:id' => 'subscriptions#index', constraints: SubscriptionsUserConstraint.new
|
|
end
|