Browse Source

disambiguate between displayPrice and recurlyPrice

GitOrigin-RevId: 38f4c51b9834c417824c0093096767f50e998cb8
Tim Alby 4 năm trước cách đây
mục cha
commit
3dbd913d97

+ 2 - 2
services/web/app/src/Features/Subscription/SubscriptionViewModelBuilder.js

@@ -252,7 +252,7 @@ function buildUsersSubscriptionViewModel(user, callback) {
           const pendingSubscriptionTax =
             personalSubscription.recurly.taxRate *
             recurlySubscription.pending_subscription.unit_amount_in_cents
-          personalSubscription.recurly.price =
+          personalSubscription.recurly.displayPrice =
             SubscriptionFormatters.formatPrice(
               recurlySubscription.pending_subscription.unit_amount_in_cents +
                 pendingAddOnPrice +
@@ -268,7 +268,7 @@ function buildUsersSubscriptionViewModel(user, callback) {
             pendingTotalLicenses
           personalSubscription.pendingPlan = pendingPlan
         } else {
-          personalSubscription.recurly.price =
+          personalSubscription.recurly.displayPrice =
             SubscriptionFormatters.formatPrice(
               recurlySubscription.unit_amount_in_cents + addOnPrice + tax,
               recurlySubscription.currency

+ 5 - 5
services/web/app/views/subscriptions/_modal_group_upgrade.pug

@@ -7,10 +7,10 @@ script(type="text/ng-template", id="groupPlanModalUpgradeTemplate")
 			.row
 				.col-md-6.text-center
 					.circle.circle-lg
-						| {{ displayPrice.total }}
+						| {{ recurlyPrice.total }}
 						span.small / year
 						br
-						span.circle-subtext {{displayPricePerUser}} per user
+						span.circle-subtext {{perUserDisplayPrice}} per user
 					ul.list-unstyled
 						li Each user will have access to:
 						li  
@@ -53,9 +53,9 @@ script(type="text/ng-template", id="groupPlanModalUpgradeTemplate")
 								| The educational discount is available for groups of 10 or more
 	.modal-footer
 		.text-center
-			p(ng-show="displayPrice.includesTax") Total:
-				strong  {{ displayPrice.total }}
-				|  ({{displayPrice.subtotal}} + {{displayPrice.tax}} tax) per year
+			p(ng-show="recurlyPrice.includesTax") Total:
+				strong  {{ recurlyPrice.total }}
+				|  ({{recurlyPrice.subtotal}} + {{recurlyPrice.tax}} tax) per year
 			p
 				strong Your new subscription will be billed immediately to your current payment method.
 			hr.thin

+ 2 - 2
services/web/app/views/subscriptions/dashboard/_change_plans_mixins.pug

@@ -5,9 +5,9 @@ mixin printPlan(plan)
 				strong(ng-non-bindable) #{plan.name}
 			td
 				if (plan.annual)
-					| {{price}} / #{translate("year")}
+					| {{displayPrice}} / #{translate("year")}
 				else
-					| {{price}} / #{translate("month")}
+					| {{displayPrice}} / #{translate("month")}
 			td
 				if (typeof(personalSubscription.planCode) != "undefined" && plan.planCode == personalSubscription.planCode.split("_")[0])
 					if (personalSubscription.pendingPlan)

+ 2 - 2
services/web/app/views/subscriptions/dashboard/_personal_subscription_recurly.pug

@@ -25,7 +25,7 @@ div(ng-controller="RecurlySubscriptionController")
 					p #{translate("contact_support_to_change_group_subscription")}
 				if (personalSubscription.recurly.trialEndsAtFormatted && personalSubscription.recurly.trial_ends_at > Date.now())
 					p You're on a free trial which ends on <strong ng-non-bindable>#{personalSubscription.recurly.trialEndsAtFormatted}</strong>
-				p !{translate("next_payment_of_x_collectected_on_y", {paymentAmmount: personalSubscription.recurly.price, collectionDate: personalSubscription.recurly.nextPaymentDueAt}, ['strong', 'strong'])}
+				p !{translate("next_payment_of_x_collectected_on_y", {paymentAmmount: personalSubscription.recurly.displayPrice, collectionDate: personalSubscription.recurly.nextPaymentDueAt}, ['strong', 'strong'])}
 				include ./../_price_exceptions
 				p.pull-right
 				p
@@ -93,7 +93,7 @@ div(ng-controller="RecurlySubscriptionController")
 
 		div(ng-show="showDowngradeToStudent")
 			div(ng-controller="ChangePlanFormController")
-				p !{translate("interested_in_cheaper_plan",{price:'{{studentPrice}}'})}
+				p !{translate("interested_in_cheaper_plan",{price:'{{studentDisplayPrice}}'})}
 				p
 					button(type="submit", ng-click="downgradeToStudent()", ng-disabled='inflight').btn.btn-success #{translate("yes_move_me_to_student_plan")}
 				p

+ 3 - 3
services/web/app/views/subscriptions/new.pug

@@ -45,8 +45,8 @@ block content
 										span !{translate("first_few_days_free", {trialLen:'{{trialLength}}'})}
 										span(ng-if="coupon.discountMonths && coupon.discountRate") &nbsp; -  {{coupon.discountMonths}} #{translate("month")}s {{coupon.discountRate}}% Off
 
-									div(ng-if="price")
-										- var priceVars = { price: "{{ availableCurrencies[currencyCode]['symbol'] }}{{ price.total }}"};
+									div(ng-if="recurlyPrice")
+										- var priceVars = { price: "{{ availableCurrencies[currencyCode]['symbol'] }}{{ recurlyPrice.total }}"};
 										span(ng-if="!coupon.singleUse && monthlyBilling")
 											| !{translate("x_price_per_month", priceVars, ['strong'] )}
 										span(ng-if="!coupon.singleUse && !monthlyBilling")
@@ -272,7 +272,7 @@ block content
 											div.price-breakdown(
 												ng-show="taxes.length"
 											)
-												- var priceBreakdownVars = { total: "{{ availableCurrencies[currencyCode]['symbol'] }}{{ price.total }}", subtotal: "{{availableCurrencies[currencyCode]['symbol']}}{{ price.subtotal }}", tax: "{{availableCurrencies[currencyCode]['symbol']}}{{ price.tax }}" };
+												- var priceBreakdownVars = { total: "{{ availableCurrencies[currencyCode]['symbol'] }}{{ recurlyPrice.total }}", subtotal: "{{availableCurrencies[currencyCode]['symbol']}}{{ recurlyPrice.subtotal }}", tax: "{{availableCurrencies[currencyCode]['symbol']}}{{ recurlyPrice.tax }}" };
 												hr.thin
 												span
 													| Total:

+ 1 - 1
services/web/app/views/subscriptions/successful_subscription.pug

@@ -11,7 +11,7 @@ block content
 
 						.alert.alert-success
 							if (personalSubscription.recurly.trial_ends_at)
-								p !{translate("next_payment_of_x_collectected_on_y", {paymentAmmount: personalSubscription.recurly.price, collectionDate: personalSubscription.recurly.nextPaymentDueAt}, ['strong', 'strong'])}
+								p !{translate("next_payment_of_x_collectected_on_y", {paymentAmmount: personalSubscription.recurly.displayPrice, collectionDate: personalSubscription.recurly.nextPaymentDueAt}, ['strong', 'strong'])}
 								include ./_price_exceptions
 							p #{translate("to_modify_your_subscription_go_to")} 
 								a(href="/user/subscription")  #{translate("manage_subscription")}.

+ 3 - 1
services/web/frontend/js/main/new-subscription.js

@@ -143,7 +143,9 @@ export default App.controller(
         $scope.trialLength = pricing.items.plan.trial.length
       }
 
-      $scope.price = $scope.trialLength ? pricing.price.next : pricing.price.now
+      $scope.recurlyPrice = $scope.trialLength
+        ? pricing.price.next
+        : pricing.price.now
       $scope.taxes = pricing.price.taxes
       $scope.monthlyBilling = pricing.items.plan.period.length === 1
 

+ 13 - 13
services/web/frontend/js/main/subscription-dashboard.js

@@ -157,28 +157,28 @@ App.controller(
       const { taxRate } = subscription.recurly
       const { usage, plan_code, currency, size } = $scope.selected
       $scope.discountEligible = size >= 10
-      const pricePlaceholder = { total: '...' }
-      let pricePerUserPlaceholder = '...'
+      const recurlyPricePlaceholder = { total: '...' }
+      let perUserDisplayPricePlaceholder = '...'
       const currencySymbol = $scope.options.currencySymbols[currency]
       if (taxRate === 0) {
         const basePrice = $scope.groupPlans[usage][plan_code][currency][size]
-        pricePlaceholder.total = `${currencySymbol}${basePrice}`
-        pricePerUserPlaceholder = getPricePerUser(
+        recurlyPricePlaceholder.total = `${currencySymbol}${basePrice}`
+        perUserDisplayPricePlaceholder = getPricePerUser(
           basePrice,
           currencySymbol,
           size
         )
       }
-      $scope.displayPrice = pricePlaceholder // Placeholder while we talk to recurly
-      $scope.displayPricePerUser = pricePerUserPlaceholder // Placeholder while we talk to recurly
+      $scope.recurlyPrice = recurlyPricePlaceholder // Placeholder while we talk to recurly
+      $scope.perUserDisplayPrice = perUserDisplayPricePlaceholder // Placeholder while we talk to recurly
       const recurlyPlanCode = `group_${plan_code}_${size}_${usage}`
       RecurlyPricing.loadDisplayPriceWithTax(
         recurlyPlanCode,
         currency,
         taxRate
       ).then(price => {
-        $scope.displayPrice = price
-        $scope.displayPricePerUser = getPricePerUser(
+        $scope.recurlyPrice = price
+        $scope.perUserDisplayPrice = getPricePerUser(
           price.totalValue,
           currencySymbol,
           size
@@ -237,10 +237,10 @@ App.controller(
       const planCode = plan.planCode
       const subscription = getMeta('ol-subscription')
       const { currency, taxRate } = subscription.recurly
-      $scope.price = '...' // Placeholder while we talk to recurly
+      $scope.displayPrice = '...' // Placeholder while we talk to recurly
       RecurlyPricing.loadDisplayPriceWithTax(planCode, currency, taxRate).then(
-        price => {
-          $scope.price = price.total
+        recurlyPrice => {
+          $scope.displayPrice = recurlyPrice.total
         }
       )
     })
@@ -383,10 +383,10 @@ App.controller(
     }
 
     const { currency, taxRate } = subscription.recurly
-    $scope.studentPrice = '...' // Placeholder while we talk to recurly
+    $scope.studentDisplayPrice = '...' // Placeholder while we talk to recurly
     RecurlyPricing.loadDisplayPriceWithTax('student', currency, taxRate).then(
       price => {
-        $scope.studentPrice = price.total
+        $scope.studentDisplayPrice = price.total
       }
     )