2014-10-13 12:28:00 -04:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App)->
|
|
|
|
|
2014-10-15 11:21:45 -04:00
|
|
|
App.controller "NewSubscriptionController", ($scope, MultiCurrencyPricing, abTestManager)->
|
2014-10-13 12:28:00 -04:00
|
|
|
|
|
|
|
$scope.currencyCode = MultiCurrencyPricing.currencyCode
|
|
|
|
$scope.plans = MultiCurrencyPricing.plans
|
|
|
|
|
2014-10-15 11:21:45 -04:00
|
|
|
|
|
|
|
if MultiCurrencyPricing.currencyCode != "USD"
|
|
|
|
currencyBuckets = [
|
|
|
|
{ bucketName:"eu-eu", currency:MultiCurrencyPricing.currencyCode}
|
|
|
|
{ bucketName:"eu-usd", currency:"USD"}
|
|
|
|
]
|
|
|
|
multiCurrencyBucket = abTestManager.getABTestBucket "multi_currency", currencyBuckets
|
|
|
|
$scope.currencyCode = multiCurrencyBucket.currency
|
|
|
|
abTestManager.processTestWithStep("multi_currency_editor", multiCurrencyBucket.bucketName, 0)
|
|
|
|
|
|
|
|
|
2014-10-13 12:28:00 -04:00
|
|
|
$scope.changeCurrency = (newCurrency)->
|
|
|
|
window.location = "/user/subscription/new?planCode=#{window.plan_code}¤cy=#{newCurrency}"
|