Henry Oswald 11 лет назад
Родитель
Сommit
fa1ec44e22

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

@@ -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")
 
 
 

+ 8 - 6
services/web/public/coffee/main/new-subscription.coffee

@@ -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