disambiguate between displayPrice and recurlyPrice

GitOrigin-RevId: 38f4c51b9834c417824c0093096767f50e998cb8
This commit is contained in:
Tim Alby 2022-01-12 10:41:39 +01:00 committed by Copybot
parent e98084259a
commit 3dbd913d97
8 changed files with 31 additions and 29 deletions

View file

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

View file

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

View file

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

View file

@ -25,7 +25,7 @@ div(ng-controller="RecurlySubscriptionController")
p #{translate("contact_support_to_change_group_subscription")} p #{translate("contact_support_to_change_group_subscription")}
if (personalSubscription.recurly.trialEndsAtFormatted && personalSubscription.recurly.trial_ends_at > Date.now()) 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 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 include ./../_price_exceptions
p.pull-right p.pull-right
p p
@ -93,7 +93,7 @@ div(ng-controller="RecurlySubscriptionController")
div(ng-show="showDowngradeToStudent") div(ng-show="showDowngradeToStudent")
div(ng-controller="ChangePlanFormController") div(ng-controller="ChangePlanFormController")
p !{translate("interested_in_cheaper_plan",{price:'{{studentPrice}}'})} p !{translate("interested_in_cheaper_plan",{price:'{{studentDisplayPrice}}'})}
p p
button(type="submit", ng-click="downgradeToStudent()", ng-disabled='inflight').btn.btn-success #{translate("yes_move_me_to_student_plan")} button(type="submit", ng-click="downgradeToStudent()", ng-disabled='inflight').btn.btn-success #{translate("yes_move_me_to_student_plan")}
p p

View file

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

View file

@ -11,7 +11,7 @@ block content
.alert.alert-success .alert.alert-success
if (personalSubscription.recurly.trial_ends_at) 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 include ./_price_exceptions
p #{translate("to_modify_your_subscription_go_to")} p #{translate("to_modify_your_subscription_go_to")}
a(href="/user/subscription") #{translate("manage_subscription")}. a(href="/user/subscription") #{translate("manage_subscription")}.

View file

@ -143,7 +143,9 @@ export default App.controller(
$scope.trialLength = pricing.items.plan.trial.length $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.taxes = pricing.price.taxes
$scope.monthlyBilling = pricing.items.plan.period.length === 1 $scope.monthlyBilling = pricing.items.plan.period.length === 1

View file

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