- fixed new payment page so it uses correct plan and currency

- submit button is disabled while processing
- removed test data
This commit is contained in:
Henry Oswald 2014-12-28 17:16:21 +00:00
parent ecb71d5bbf
commit 7f979e77db
2 changed files with 18 additions and 14 deletions

View file

@ -135,7 +135,7 @@ block content
input.form-control(type='text', ng-blur="applyCoupon()", ng-model="data.coupon")
.form-group
button.btn.btn-success(ng-click="submit()") #{translate("submit")}
button.btn.btn-success(ng-click="submit()", ng-disabled="processing") #{translate("submit")}

View file

@ -15,23 +15,25 @@ define [
$scope.paymentMethod = "credit_card"
$scope.data =
number: "4111111111111111"
month: "02"
year: "2015"
cvv: "111"
first_name: "h"
last_name: "o"
postal_code: "se153tt"
address1 : "7 somewhere"
address2 : "7 somewhere"
city:"london"
country:"GB"
number: ""
month: ""
year: ""
cvv: ""
first_name: ""
last_name: ""
postal_code: ""
address1 : ""
address2 : ""
city:""
country:""
$scope.validation =
correctCardNumber : true
correctExpiry: true
correctCvv:true
$scope.processing = false
recurly.configure window.recurlyApiKey
pricing = recurly.Pricing()
@ -77,15 +79,17 @@ define [
_csrf: window.csrfToken
recurly_token_id:recurly_token_id.id
subscriptionDetails:
currencyCode:"USD"
plan_code:"student"
currencyCode:pricing.items.currency
plan_code:pricing.items.plan.code
$http.post("/user/subscription/create", postData)
.success (data, status, headers)->
window.location.href = "/user/subscription/thank-you"
.error (data, status, headers)->
$scope.processing = false
$scope.genericError = "Something went wrong processing the request"
$scope.submit = ->
$scope.processing = true
if $scope.paymentMethod == 'paypal'
opts = { description: $scope.planName }
recurly.paypal opts, completeSubscription