mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #4034 from overleaf/tm-pending-subscription-addons
Display correct information when pending subscription has addons GitOrigin-RevId: 7634ccf24788951507963b6d421fdb86e0dc38d5
This commit is contained in:
parent
73c47fa0e0
commit
f7b96e86a7
3 changed files with 46 additions and 12 deletions
|
@ -200,15 +200,6 @@ module.exports = {
|
|||
account: recurlySubscription.account,
|
||||
}
|
||||
if (recurlySubscription.pending_subscription) {
|
||||
const pendingSubscriptionTax =
|
||||
personalSubscription.recurly.taxRate *
|
||||
recurlySubscription.pending_subscription.unit_amount_in_cents
|
||||
personalSubscription.recurly.price = SubscriptionFormatters.formatPrice(
|
||||
recurlySubscription.pending_subscription.unit_amount_in_cents +
|
||||
addOnPrice +
|
||||
pendingSubscriptionTax,
|
||||
recurlySubscription.currency
|
||||
)
|
||||
const pendingPlan = PlansLocator.findLocalPlanInSettings(
|
||||
recurlySubscription.pending_subscription.plan.plan_code
|
||||
)
|
||||
|
@ -219,6 +210,44 @@ module.exports = {
|
|||
)
|
||||
)
|
||||
}
|
||||
let pendingAdditionalLicenses = 0
|
||||
let pendingAddOnTax = 0
|
||||
let pendingAddOnPrice = 0
|
||||
if (recurlySubscription.pending_subscription.subscription_add_ons) {
|
||||
if (
|
||||
pendingPlan.membersLimitAddOn &&
|
||||
Array.isArray(
|
||||
recurlySubscription.pending_subscription.subscription_add_ons
|
||||
)
|
||||
) {
|
||||
recurlySubscription.pending_subscription.subscription_add_ons.forEach(
|
||||
addOn => {
|
||||
if (addOn.add_on_code === pendingPlan.membersLimitAddOn) {
|
||||
pendingAddOnPrice +=
|
||||
addOn.quantity * addOn.unit_amount_in_cents
|
||||
pendingAdditionalLicenses += addOn.quantity
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
// Need to calculate tax ourselves as we don't get tax amounts for pending subs
|
||||
pendingAddOnTax =
|
||||
personalSubscription.recurly.taxRate * pendingAddOnPrice
|
||||
}
|
||||
const pendingSubscriptionTax =
|
||||
personalSubscription.recurly.taxRate *
|
||||
recurlySubscription.pending_subscription.unit_amount_in_cents
|
||||
personalSubscription.recurly.price = SubscriptionFormatters.formatPrice(
|
||||
recurlySubscription.pending_subscription.unit_amount_in_cents +
|
||||
pendingAddOnPrice +
|
||||
pendingAddOnTax +
|
||||
pendingSubscriptionTax,
|
||||
recurlySubscription.currency
|
||||
)
|
||||
const pendingTotalLicenses =
|
||||
(pendingPlan.membersLimit || 0) + pendingAdditionalLicenses
|
||||
personalSubscription.recurly.pendingAdditionalLicenses = pendingAdditionalLicenses
|
||||
personalSubscription.recurly.pendingTotalLicenses = pendingTotalLicenses
|
||||
personalSubscription.pendingPlan = pendingPlan
|
||||
} else {
|
||||
personalSubscription.recurly.price = SubscriptionFormatters.formatPrice(
|
||||
|
|
|
@ -8,9 +8,13 @@ div(ng-controller="RecurlySubscriptionController")
|
|||
when "active"
|
||||
p !{translate("currently_subscribed_to_plan", {planName: personalSubscription.plan.name}, ['strong'])}
|
||||
if (personalSubscription.pendingPlan)
|
||||
if (personalSubscription.pendingPlan.name != personalSubscription.plan.name)
|
||||
|
|
||||
| !{translate("your_plan_is_changing_at_term_end", {pendingPlanName: personalSubscription.pendingPlan.name}, ['strong'])}
|
||||
if (personalSubscription.recurly.additionalLicenses > 0)
|
||||
if (personalSubscription.recurly.pendingAdditionalLicenses > 0 || personalSubscription.recurly.additionalLicenses > 0)
|
||||
|
|
||||
| !{translate("pending_additional_licenses", {pendingAdditionalLicenses: personalSubscription.recurly.pendingAdditionalLicenses, pendingTotalLicenses: personalSubscription.recurly.pendingTotalLicenses}, ['strong', 'strong'])}
|
||||
else if (personalSubscription.recurly.additionalLicenses > 0)
|
||||
|
|
||||
| !{translate("additional_licenses", {additionalLicenses: personalSubscription.recurly.additionalLicenses, totalLicenses: personalSubscription.recurly.totalLicenses}, ['strong', 'strong'])}
|
||||
|
|
||||
|
|
|
@ -1021,6 +1021,7 @@
|
|||
"change_plan": "Change plan",
|
||||
"next_payment_of_x_collectected_on_y": "The next payment of <0>__paymentAmmount__</0> will be collected on <1>__collectionDate__</1>.",
|
||||
"additional_licenses": "Your subscription includes <0>__additionalLicenses__</0> additional license(s) for a total of <1>__totalLicenses__</1> licenses.",
|
||||
"pending_additional_licenses": "Your subscription is changing to include <0>__pendingAdditionalLicenses__</0> additional license(s) for a total of <1>__pendingTotalLicenses__</1> licenses.",
|
||||
"update_your_billing_details": "Update Your Billing Details",
|
||||
"subscription_canceled_and_terminate_on_x": " Your subscription has been canceled and will terminate on <0>__terminateDate__</0>. No further payments will be taken.",
|
||||
"your_subscription_has_expired": "Your subscription has expired.",
|
||||
|
|
Loading…
Reference in a new issue