fixed change payment details page

also increased size of year field for firefox users
and removed unnded options in new plan page
This commit is contained in:
Henry Oswald 2016-03-31 11:53:59 +01:00
parent 059d3432c2
commit db8fb63bb5
4 changed files with 8 additions and 28 deletions

View file

@ -240,7 +240,7 @@ module.exports = ProjectController =
bodyClasses: ["editor"]
project_id : project._id
user : {
id : user.id
id : user_id
email : user.email
first_name : user.first_name
last_name : user.last_name

View file

@ -48,7 +48,7 @@ module.exports = SubscriptionController =
subscription:
plan_code : req.query.planCode
currency: currency
account_code: user.id
account_code: user._id
}, (error, signature) ->
return next(error) if error?
res.render "subscriptions/new",
@ -64,19 +64,7 @@ module.exports = SubscriptionController =
showCouponField: req.query.scf
showVatField: req.query.svf
couponCode: req.query.cc or ""
subscriptionFormOptions: JSON.stringify
acceptedCards: ['discover', 'mastercard', 'visa']
target : "#subscribeForm"
signature : signature
planCode : req.query.planCode
successURL : "#{Settings.siteUrl}/user/subscription/create?_csrf=#{req.session._csrf}"
accountCode : user.id
enableCoupons: true
acceptPaypal: true
account :
firstName : user.first_name
lastName : user.last_name
email : user.email
userSubscriptionPage: (req, res, next) ->
@ -128,7 +116,7 @@ module.exports = SubscriptionController =
res.redirect "/user/subscription"
else
RecurlyWrapper.sign {
account_code: user.id
account_code: user._id
}, (error, signature) ->
return next(error) if error?
res.render "subscriptions/edit-billing-details",
@ -139,7 +127,7 @@ module.exports = SubscriptionController =
signature : signature
successURL : "#{Settings.siteUrl}/user/subscription/update"
user :
id : user.id
id : user._id
createSubscription: (req, res, next)->
AuthenticationController.getLoggedInUser req, (error, user) ->

View file

@ -108,7 +108,7 @@ block content
option(value="10") 10
option(value="11") 11
option(value="12") 12
.col-md-3
.col-md-4
.form-group(ng-class="validation.correctExpiry == false || validation.errorFields.year ? 'has-error' : ''")
select.form-control(data-recurly='year', ng-change="validateExpiry()", ng-model='data.year')
option(value="", disabled, selected) Year

View file

@ -99,7 +99,7 @@ describe "SubscriptionController sanboxed", ->
describe "with a user with a subscription", ->
beforeEach (done) ->
@LimitationsManager.userHasSubscription.callsArgWith(1, null, true)
@user.id = @activeRecurlySubscription.account.account_code
@user._id = @activeRecurlySubscription.account.account_code
@res.callback = done
@SubscriptionController.editBillingDetailsPage(@req, @res)
@ -110,7 +110,7 @@ describe "SubscriptionController sanboxed", ->
it "should set the correct variables for the template", ->
should.exist @res.renderedVariables.signature
@res.renderedVariables.successURL.should.equal "#{@settings.siteUrl}/user/subscription/update"
@res.renderedVariables.user.id.should.equal @user.id
@res.renderedVariables.user.id.should.equal @user._id
describe "with a user without subscription", ->
beforeEach (done) ->
@ -140,14 +140,6 @@ describe "SubscriptionController sanboxed", ->
done()
@SubscriptionController.paymentPage @req, @res
it "should set the successURL", (done)->
@req.session._csrf = @csrfToken = "mock-csrf-token"
@res.render = (page, opts)=>
url = JSON.parse(opts.subscriptionFormOptions).successURL
url.should.equal("#{@settings.siteUrl}/user/subscription/create?_csrf=#{@csrfToken}")
done()
@SubscriptionController.paymentPage @req, @res
describe "with a user with subscription", ->
it "should redirect to the subscription dashboard", (done)->
@LimitationsManager.userHasSubscription.callsArgWith(1, null, true)