فهرست منبع

only setup recurly once for subscription dashboard and apply async to make sure updates on pricing are applied

Henry Oswald 11 سال پیش
والد
کامیت
79e7f82a36
1فایلهای تغییر یافته به همراه8 افزوده شده و 3 حذف شده
  1. 8 3
      services/web/public/coffee/main/subscription-dashboard.coffee

+ 8 - 3
services/web/public/coffee/main/subscription-dashboard.coffee

@@ -2,7 +2,10 @@ define [
 	"base"
 ], (App)->
 	SUBSCRIPTION_URL = "/user/subscription/update"
-	recurly.configure window.recurlyApiKey
+
+	setupReturly = _.once ->
+		recurly?.configure window.recurlyApiKey
+
 
 	App.controller "CurrenyDropdownController", ($scope, MultiCurrencyPricing, $q)->
 
@@ -14,7 +17,7 @@ define [
 
 
 	App.controller "ChangePlanFormController", ($scope, $modal, MultiCurrencyPricing)->
-
+		setupReturly()
 		
 		taxRate = window.taxRate
 
@@ -41,7 +44,9 @@ define [
 			pricing = recurly.Pricing()
 			pricing.plan(planCode, { quantity: 1 }).done (price)->
 				totalPriceExTax = parseFloat(price.next.total)
-				$scope.prices[planCode] = $scope.currencySymbol + (totalPriceExTax + (totalPriceExTax * taxRate))
+				$scope.$evalAsync () ->
+					$scope.prices[planCode] = $scope.currencySymbol + (totalPriceExTax + (totalPriceExTax * taxRate))
+
 			price = ""