Przeglądaj źródła

fixed change payment details page

also increased size of year field for firefox users
and removed unnded options in new plan page
Henry Oswald 10 lat temu
rodzic
commit
db8fb63bb5

+ 1 - 1
services/web/app/coffee/Features/Project/ProjectController.coffee

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

+ 4 - 16
services/web/app/coffee/Features/Subscription/SubscriptionController.coffee

@@ -48,7 +48,7 @@ module.exports = SubscriptionController =
 							subscription:
 							subscription:
 								plan_code : req.query.planCode
 								plan_code : req.query.planCode
 								currency: currency
 								currency: currency
-							account_code: user.id
+							account_code: user._id
 						}, (error, signature) ->
 						}, (error, signature) ->
 							return next(error) if error?
 							return next(error) if error?
 							res.render "subscriptions/new",
 							res.render "subscriptions/new",
@@ -64,19 +64,7 @@ module.exports = SubscriptionController =
 								showCouponField: req.query.scf
 								showCouponField: req.query.scf
 								showVatField: req.query.svf
 								showVatField: req.query.svf
 								couponCode:      req.query.cc or ""
 								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) ->
 	userSubscriptionPage: (req, res, next) ->
@@ -128,7 +116,7 @@ module.exports = SubscriptionController =
 					res.redirect "/user/subscription"
 					res.redirect "/user/subscription"
 				else
 				else
 					RecurlyWrapper.sign {
 					RecurlyWrapper.sign {
-						account_code: user.id
+						account_code: user._id
 					}, (error, signature) ->
 					}, (error, signature) ->
 						return next(error) if error?
 						return next(error) if error?
 						res.render "subscriptions/edit-billing-details",
 						res.render "subscriptions/edit-billing-details",
@@ -139,7 +127,7 @@ module.exports = SubscriptionController =
 							signature  : signature
 							signature  : signature
 							successURL : "#{Settings.siteUrl}/user/subscription/update"
 							successURL : "#{Settings.siteUrl}/user/subscription/update"
 							user       :
 							user       :
-								id : user.id
+								id : user._id
 
 
 	createSubscription: (req, res, next)->
 	createSubscription: (req, res, next)->
 		AuthenticationController.getLoggedInUser req, (error, user) ->
 		AuthenticationController.getLoggedInUser req, (error, user) ->

+ 1 - 1
services/web/app/views/subscriptions/new.jade

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

+ 2 - 10
services/web/test/UnitTests/coffee/Subscription/SubscriptionControllerTests.coffee

@@ -99,7 +99,7 @@ describe "SubscriptionController sanboxed", ->
 		describe "with a user with a subscription", ->
 		describe "with a user with a subscription", ->
 			beforeEach (done) ->
 			beforeEach (done) ->
 				@LimitationsManager.userHasSubscription.callsArgWith(1, null, true)
 				@LimitationsManager.userHasSubscription.callsArgWith(1, null, true)
-				@user.id = @activeRecurlySubscription.account.account_code
+				@user._id = @activeRecurlySubscription.account.account_code
 				@res.callback = done
 				@res.callback = done
 				@SubscriptionController.editBillingDetailsPage(@req, @res)
 				@SubscriptionController.editBillingDetailsPage(@req, @res)
 
 
@@ -110,7 +110,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/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", ->
 			beforeEach (done) ->
 			beforeEach (done) ->
@@ -140,14 +140,6 @@ describe "SubscriptionController sanboxed", ->
 						done()
 						done()
 					@SubscriptionController.paymentPage @req, @res
 					@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", ->
 		describe "with a user with subscription", ->
 			it "should redirect to the subscription dashboard", (done)->
 			it "should redirect to the subscription dashboard", (done)->
 				@LimitationsManager.userHasSubscription.callsArgWith(1, null, true)
 				@LimitationsManager.userHasSubscription.callsArgWith(1, null, true)