overleaf/services/web/app/coffee/Features/Subscription/SubscriptionRouter.coffee

50 lines
3.1 KiB
CoffeeScript
Raw Normal View History

2014-02-12 05:23:40 -05:00
AuthenticationController = require('../Authentication/AuthenticationController')
SubscriptionController = require('./SubscriptionController')
SubscriptionGroupController = require './SubscriptionGroupController'
DomainLicenceController = require './DomainLicenceController'
TeamInvitesController = require './TeamInvitesController'
2014-02-12 05:23:40 -05:00
Settings = require "settings-sharelatex"
module.exports =
apply: (webRouter, privateApiRouter, publicApiRouter) ->
2014-02-12 05:23:40 -05:00
return unless Settings.enableSubscriptions
2018-08-27 11:23:11 -04:00
webRouter.get '/user/subscription/plans', SubscriptionController.plansPage
2014-02-12 05:23:40 -05:00
webRouter.get '/user/subscription', AuthenticationController.requireLogin(), SubscriptionController.userSubscriptionPage
2014-10-10 10:44:53 -04:00
webRouter.get '/user/subscription/new', AuthenticationController.requireLogin(), SubscriptionController.paymentPage
2014-02-12 05:23:40 -05:00
webRouter.get '/user/subscription/thank-you', AuthenticationController.requireLogin(), SubscriptionController.successful_subscription
2014-02-12 05:23:40 -05:00
2018-10-11 13:56:14 -04:00
webRouter.get '/subscription/group', AuthenticationController.requireLogin(), SubscriptionGroupController.redirectToSubscriptionGroupAdminPage
webRouter.delete '/subscription/group/user', AuthenticationController.requireLogin(), SubscriptionGroupController.removeSelfFromGroup
# Team invites
webRouter.get '/subscription/invites/:token/', AuthenticationController.requireLogin(),
TeamInvitesController.viewInvite
webRouter.put '/subscription/invites/:token/', AuthenticationController.requireLogin(),
TeamInvitesController.acceptInvite
2014-02-12 05:23:40 -05:00
# Routes to join a domain licence team
webRouter.get '/user/subscription/domain/join', AuthenticationController.requireLogin(), DomainLicenceController.join
webRouter.post '/user/subscription/domain/join', AuthenticationController.requireLogin(), DomainLicenceController.createInvite
2014-02-12 05:23:40 -05:00
#recurly callback
publicApiRouter.post '/user/subscription/callback', SubscriptionController.recurlyNotificationParser, SubscriptionController.recurlyCallback
2014-02-12 05:23:40 -05:00
#user changes their account state
webRouter.post '/user/subscription/create', AuthenticationController.requireLogin(), SubscriptionController.createSubscription
webRouter.post '/user/subscription/update', AuthenticationController.requireLogin(), SubscriptionController.updateSubscription
webRouter.post '/user/subscription/cancel', AuthenticationController.requireLogin(), SubscriptionController.cancelSubscription
webRouter.post '/user/subscription/reactivate', AuthenticationController.requireLogin(), SubscriptionController.reactivateSubscription
2014-02-12 05:23:40 -05:00
webRouter.put '/user/subscription/extend', AuthenticationController.requireLogin(), SubscriptionController.extendTrial
2014-02-12 05:23:40 -05:00
webRouter.get "/user/subscription/upgrade-annual", AuthenticationController.requireLogin(), SubscriptionController.renderUpgradeToAnnualPlanPage
webRouter.post "/user/subscription/upgrade-annual", AuthenticationController.requireLogin(), SubscriptionController.processUpgradeToAnnualPlan
# Currently used in acceptance tests only, as a way to trigger the syncing logic
publicApiRouter.post "/user/:user_id/features/sync", AuthenticationController.httpAuth, SubscriptionController.refreshUserFeatures