coupons work

This commit is contained in:
Henry Oswald 2014-12-22 14:06:39 +00:00
parent a47b25d4b2
commit fa1ec44e22
2 changed files with 9 additions and 7 deletions

View file

@ -46,7 +46,7 @@ block content
h2.pull-right {{price}}
span.pull-right every {{billingCycleType}}
input(type='text', data-recurly='coupon')
input(type='text', ng-blur="applyCoupon()", ng-model="data.coupon")

View file

@ -8,13 +8,12 @@ define [
$scope.currencyCode = MultiCurrencyPricing.currencyCode
$scope.plans = MultiCurrencyPricing.plans
$scope.changeCurrency = (newCurrency)->
$scope.currencyCode = newCurrency
updatePlan()
$scope.switchToStudent = ()->
window.location = "/user/subscription/new?planCode=student&currency=#{$scope.currencyCode}"
__api_key = recurlyCreds.apiKey
configured = false
$scope.error = false
@ -37,11 +36,14 @@ define [
$scope.planName = "no yet set"
updatePlan = ->
pricing.plan(window.plan_code, { quantity: 1 }).currency($scope.currencyCode).done()
pricing.plan(window.plan_code, { quantity: 1 }).currency($scope.currencyCode).done()
updatePlan()
$scope.applyCoupon = ->
pricing.coupon($scope.data.coupon).done()
$scope.changeCurrency = (newCurrency)->
$scope.currencyCode = newCurrency
pricing.currency(newCurrency).done()
pricing.on "change", =>
$scope.planName = pricing.items.plan.name