2014-02-12 05:23:40 -05:00
|
|
|
AuthenticationController = require('../Authentication/AuthenticationController')
|
|
|
|
SubscriptionController = require('./SubscriptionController')
|
|
|
|
SubscriptionGroupController = require './SubscriptionGroupController'
|
2018-05-30 06:29:21 -04:00
|
|
|
TeamInvitesController = require './TeamInvitesController'
|
2014-02-12 05:23:40 -05:00
|
|
|
Settings = require "settings-sharelatex"
|
|
|
|
|
|
|
|
module.exports =
|
2017-07-20 08:51:11 -04:00
|
|
|
apply: (webRouter, privateApiRouter, publicApiRouter) ->
|
2014-02-12 05:23:40 -05:00
|
|
|
return unless Settings.enableSubscriptions
|
|
|
|
|
2015-06-30 09:38:32 -04:00
|
|
|
webRouter.get '/user/subscription/plans', SubscriptionController.plansPage
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2015-06-30 09:38:32 -04:00
|
|
|
webRouter.get '/user/subscription', AuthenticationController.requireLogin(), SubscriptionController.userSubscriptionPage
|
2014-10-10 10:44:53 -04:00
|
|
|
|
2015-06-30 09:38:32 -04:00
|
|
|
webRouter.get '/user/subscription/custom_account', AuthenticationController.requireLogin(), SubscriptionController.userCustomSubscriptionPage
|
2014-10-10 10:44:53 -04:00
|
|
|
|
2018-05-30 06:29:21 -04:00
|
|
|
webRouter.get '/user/subscription/new', AuthenticationController.requireLogin(), SubscriptionController.paymentPage
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2015-06-30 09:38:32 -04:00
|
|
|
webRouter.get '/user/subscription/thank-you', AuthenticationController.requireLogin(), SubscriptionController.successful_subscription
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
|
2015-06-30 09:38:32 -04:00
|
|
|
webRouter.get '/subscription/group', AuthenticationController.requireLogin(), SubscriptionGroupController.renderSubscriptionGroupAdminPage
|
|
|
|
webRouter.post '/subscription/group/user', AuthenticationController.requireLogin(), SubscriptionGroupController.addUserToGroup
|
|
|
|
webRouter.get '/subscription/group/export', AuthenticationController.requireLogin(), SubscriptionGroupController.exportGroupCsv
|
|
|
|
webRouter.delete '/subscription/group/user/:user_id', AuthenticationController.requireLogin(), SubscriptionGroupController.removeUserFromGroup
|
2017-06-08 07:12:08 -04:00
|
|
|
webRouter.delete '/subscription/group/email/:email', AuthenticationController.requireLogin(), SubscriptionGroupController.removeEmailInviteFromGroup
|
2016-02-19 07:27:01 -05:00
|
|
|
webRouter.delete '/subscription/group/user', AuthenticationController.requireLogin(), SubscriptionGroupController.removeSelfFromGroup
|
|
|
|
|
2018-05-30 06:29:21 -04:00
|
|
|
# Team invites
|
|
|
|
webRouter.post '/subscription/invites', AuthenticationController.requireLogin(),
|
|
|
|
TeamInvitesController.createInvite
|
|
|
|
webRouter.get '/subscription/invites/:token/', AuthenticationController.requireLogin(),
|
|
|
|
TeamInvitesController.viewInvite
|
|
|
|
webRouter.put '/subscription/invites/:token/', AuthenticationController.requireLogin(),
|
|
|
|
TeamInvitesController.acceptInvite
|
|
|
|
webRouter.delete '/subscription/invites/:token/', AuthenticationController.requireLogin(),
|
|
|
|
TeamInvitesController.revokeInvite
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2015-06-30 09:38:32 -04:00
|
|
|
webRouter.get '/user/subscription/:subscription_id/group/invited', AuthenticationController.requireLogin(), SubscriptionGroupController.renderGroupInvitePage
|
|
|
|
webRouter.post '/user/subscription/:subscription_id/group/begin-join', AuthenticationController.requireLogin(), SubscriptionGroupController.beginJoinGroup
|
|
|
|
webRouter.get '/user/subscription/:subscription_id/group/complete-join', AuthenticationController.requireLogin(), SubscriptionGroupController.completeJoin
|
|
|
|
webRouter.get '/user/subscription/:subscription_id/group/successful-join', AuthenticationController.requireLogin(), SubscriptionGroupController.renderSuccessfulJoinPage
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
#recurly callback
|
2017-07-20 08:51:11 -04:00
|
|
|
publicApiRouter.post '/user/subscription/callback', SubscriptionController.recurlyNotificationParser, SubscriptionController.recurlyCallback
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2014-08-27 12:51:10 -04:00
|
|
|
#user changes their account state
|
2015-06-30 09:38:32 -04:00
|
|
|
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
|
|
|
|
2015-12-08 13:23:28 -05:00
|
|
|
webRouter.put '/user/subscription/extend', AuthenticationController.requireLogin(), SubscriptionController.extendTrial
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2015-06-30 09:38:32 -04:00
|
|
|
webRouter.get "/user/subscription/upgrade-annual", AuthenticationController.requireLogin(), SubscriptionController.renderUpgradeToAnnualPlanPage
|
|
|
|
webRouter.post "/user/subscription/upgrade-annual", AuthenticationController.requireLogin(), SubscriptionController.processUpgradeToAnnualPlan
|
2014-08-27 12:51:10 -04:00
|
|
|
|
2018-05-16 11:31:28 -04:00
|
|
|
# Currently used in acceptance tests only, as a way to trigger the syncing logic
|
2018-05-17 11:58:58 -04:00
|
|
|
publicApiRouter.post "/user/:user_id/features/sync", AuthenticationController.httpAuth, SubscriptionController.refreshUserFeatures
|