mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 13:21:37 +02:00
Remove the obsolete update-billing-details page
This commit is contained in:
@@ -143,40 +143,6 @@ module.exports = SubscriptionController =
|
||||
title: "your_subscription"
|
||||
subscription: subscription
|
||||
|
||||
|
||||
editBillingDetailsPage: (req, res, next) ->
|
||||
user = AuthenticationController.getSessionUser(req)
|
||||
LimitationsManager.userHasSubscription user, (err, hasSubscription, subscription)->
|
||||
return next(err) if err?
|
||||
if !hasSubscription
|
||||
res.redirect "/user/subscription"
|
||||
else
|
||||
RecurlyWrapper.getSubscription subscription.recurlySubscription_id,
|
||||
includeAccount: true,
|
||||
(err, usersSubscription)->
|
||||
return next(err) if err?
|
||||
account = usersSubscription.account
|
||||
hostedLoginToken = account.hosted_login_token
|
||||
if !hostedLoginToken
|
||||
err = new Error('no hosted_login_token on recurly account')
|
||||
return next(err)
|
||||
subdomain = Settings?.apis?.recurly?.subdomain
|
||||
if !subdomain
|
||||
err = new Error('recurly subdomain not configured')
|
||||
return next(err)
|
||||
link = "https://" +
|
||||
subdomain +
|
||||
".recurly.com/account/billing_info/edit?ht=" +
|
||||
hostedLoginToken
|
||||
res.render "subscriptions/edit-billing-details",
|
||||
title: "update_billing_details"
|
||||
hostedBillingDetailsPageLink: link
|
||||
user:
|
||||
id: user._id
|
||||
|
||||
updateBillingDetails: (req, res, next) ->
|
||||
res.redirect "/user/subscription?saved_billing_details=true"
|
||||
|
||||
createSubscription: (req, res, next)->
|
||||
user = AuthenticationController.getSessionUser(req)
|
||||
recurly_token_id = req.body.recurly_token_id
|
||||
|
||||
@@ -15,8 +15,6 @@ module.exports =
|
||||
|
||||
|
||||
webRouter.get '/user/subscription/new', AuthenticationController.requireLogin(), SubscriptionController.paymentPage
|
||||
webRouter.get '/user/subscription/billing-details/edit', AuthenticationController.requireLogin(), SubscriptionController.editBillingDetailsPage
|
||||
webRouter.post '/user/subscription/billing-details/update', AuthenticationController.requireLogin(), SubscriptionController.updateBillingDetails
|
||||
|
||||
webRouter.get '/user/subscription/thank-you', AuthenticationController.requireLogin(), SubscriptionController.successful_subscription
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
extends ../layout
|
||||
|
||||
|
||||
block content
|
||||
.content.content-alt
|
||||
.container
|
||||
.row
|
||||
.col-md-6.col-md-offset-3
|
||||
.card
|
||||
.page-header
|
||||
h1.text-centered #{translate("update_your_billing_details")}
|
||||
div.text-center
|
||||
a.btn.btn-primary.btn-lg(
|
||||
href=hostedBillingDetailsPageLink
|
||||
target="_blank"
|
||||
) #{translate('open_your_billing_details_page')}
|
||||
@@ -119,41 +119,6 @@ describe "SubscriptionController", ->
|
||||
@UserGetter.getUser.callCount.should.equal 0
|
||||
done()
|
||||
|
||||
|
||||
describe "editBillingDetailsPage", ->
|
||||
describe "with a user with a subscription", ->
|
||||
beforeEach (done) ->
|
||||
@settings.apis.recurly.subdomain = 'test'
|
||||
@userSub = {account: {hosted_login_token: 'abcd'}}
|
||||
@LimitationsManager.userHasSubscription
|
||||
.callsArgWith(1, null, true, @activeRecurlySubscription)
|
||||
@RecurlyWrapper.getSubscription = sinon.stub()
|
||||
.callsArgWith(2, null, @userSub)
|
||||
@user._id = @activeRecurlySubscription.account.account_code
|
||||
@res.callback = done
|
||||
@SubscriptionController.editBillingDetailsPage(@req, @res)
|
||||
|
||||
it "should render the edit billing details page", ->
|
||||
@res.rendered.should.equal true
|
||||
@res.renderedTemplate.should.equal "subscriptions/edit-billing-details"
|
||||
|
||||
it "should set the correct variables for the template", ->
|
||||
should.exist @res.renderedVariables.hostedBillingDetailsPageLink
|
||||
@res.renderedVariables.hostedBillingDetailsPageLink.should.equal(
|
||||
"https://test.recurly.com/account/billing_info/edit?ht=abcd"
|
||||
)
|
||||
@res.renderedVariables.user.id.should.equal @user._id
|
||||
|
||||
describe "with a user without subscription", ->
|
||||
beforeEach (done) ->
|
||||
@res.callback = done
|
||||
@LimitationsManager.userHasSubscription.callsArgWith(1, null, false)
|
||||
@SubscriptionController.reactivateSubscription @req, @res
|
||||
|
||||
it "should redirect to the subscription dashboard", ->
|
||||
@res.redirected.should.equal true
|
||||
@res.redirectedTo.should.equal "/user/subscription"
|
||||
|
||||
describe "paymentPage", ->
|
||||
beforeEach ->
|
||||
@req.headers = {}
|
||||
|
||||
Reference in New Issue
Block a user