mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Redirect to working update billing details end point that shows a nice message
This commit is contained in:
parent
861022aff0
commit
bcc8bfbe6c
4 changed files with 12 additions and 3 deletions
|
@ -97,7 +97,7 @@ module.exports = SubscriptionController =
|
||||||
groupSubscriptions: groupSubscriptions
|
groupSubscriptions: groupSubscriptions
|
||||||
subscriptionTabActive: true
|
subscriptionTabActive: true
|
||||||
user:user
|
user:user
|
||||||
|
saved_billing_details: req.query.saved_billing_details?
|
||||||
|
|
||||||
userCustomSubscriptionPage: (req, res, next)->
|
userCustomSubscriptionPage: (req, res, next)->
|
||||||
AuthenticationController.getLoggedInUser req, (error, user) ->
|
AuthenticationController.getLoggedInUser req, (error, user) ->
|
||||||
|
@ -131,9 +131,12 @@ module.exports = SubscriptionController =
|
||||||
currency: "USD"
|
currency: "USD"
|
||||||
subdomain: Settings.apis.recurly.subdomain
|
subdomain: Settings.apis.recurly.subdomain
|
||||||
signature : signature
|
signature : signature
|
||||||
successURL : "#{Settings.siteUrl}/user/subscription/update"
|
successURL : "#{Settings.siteUrl}/user/subscription/billing-details/update"
|
||||||
user :
|
user :
|
||||||
id : user._id
|
id : user._id
|
||||||
|
|
||||||
|
updateBillingDetails: (req, res, next) ->
|
||||||
|
res.redirect "/user/subscription?saved_billing_details=true"
|
||||||
|
|
||||||
createSubscription: (req, res, next)->
|
createSubscription: (req, res, next)->
|
||||||
AuthenticationController.getLoggedInUser req, (error, user) ->
|
AuthenticationController.getLoggedInUser req, (error, user) ->
|
||||||
|
|
|
@ -16,6 +16,7 @@ module.exports =
|
||||||
|
|
||||||
webRouter.get '/user/subscription/new', AuthenticationController.requireLogin(), SubscriptionController.paymentPage
|
webRouter.get '/user/subscription/new', AuthenticationController.requireLogin(), SubscriptionController.paymentPage
|
||||||
webRouter.get '/user/subscription/billing-details/edit', AuthenticationController.requireLogin(), SubscriptionController.editBillingDetailsPage
|
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
|
webRouter.get '/user/subscription/thank-you', AuthenticationController.requireLogin(), SubscriptionController.successful_subscription
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,11 @@ block content
|
||||||
.container(ng-controller="UserSubscriptionController")
|
.container(ng-controller="UserSubscriptionController")
|
||||||
.row
|
.row
|
||||||
.col-md-8.col-md-offset-2
|
.col-md-8.col-md-offset-2
|
||||||
|
if saved_billing_details
|
||||||
|
.alert.alert-success
|
||||||
|
i.fa.fa-check
|
||||||
|
|
|
||||||
|
| #{translate("your_billing_details_were_saved")}
|
||||||
.card(ng-if="view == 'overview'")
|
.card(ng-if="view == 'overview'")
|
||||||
.page-header
|
.page-header
|
||||||
h1 #{translate("your_subscription")}
|
h1 #{translate("your_subscription")}
|
||||||
|
|
|
@ -109,7 +109,7 @@ describe "SubscriptionController sanboxed", ->
|
||||||
|
|
||||||
it "should set the correct variables for the template", ->
|
it "should set the correct variables for the template", ->
|
||||||
should.exist @res.renderedVariables.signature
|
should.exist @res.renderedVariables.signature
|
||||||
@res.renderedVariables.successURL.should.equal "#{@settings.siteUrl}/user/subscription/update"
|
@res.renderedVariables.successURL.should.equal "#{@settings.siteUrl}/user/subscription/billing-details/update"
|
||||||
@res.renderedVariables.user.id.should.equal @user._id
|
@res.renderedVariables.user.id.should.equal @user._id
|
||||||
|
|
||||||
describe "with a user without subscription", ->
|
describe "with a user without subscription", ->
|
||||||
|
|
Loading…
Reference in a new issue