mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 13:49:00 +02:00
895f52d41a
* Let users upgrade to group plans via subscription dashboard Users on an individual plan don't have a way to upgrade to a group subscription without contacting support. As a temporary measure, we're adding a way to do this by re-using the existing group plan modal from the plans pages, to allow users to configure and upgrade to a group plan directly. This is currently only available for USD, EUR, and GBP - since although we now support other currencies in Recurly, the group plans modal does not yet support them. The user however can not change currency here, their group subscription will be in the same currency as their current individual subscription. The group plan modal has been duplicated rather than extended, to keep this code seperate as it is potentially only a stopgap measure - and we don't want to be untangling the additional logic from the existing modal/template later down the line. GitOrigin-RevId: 10664bd19af2c3870dfe7e19fd0f9c5b7c877cc6
22 lines
546 B
JavaScript
22 lines
546 B
JavaScript
/**
|
|
* If the user changes to a less expensive plan, we shouldn't apply the change immediately.
|
|
* This is to avoid unintended/artifical credits on users Recurly accounts.
|
|
*/
|
|
function shouldPlanChangeAtTermEnd(oldPlan, newPlan) {
|
|
return getPlanPrice(oldPlan) > getPlanPrice(newPlan)
|
|
}
|
|
|
|
/**
|
|
* Group plans have their price in dollars, but individual plans store the price in cents
|
|
*/
|
|
function getPlanPrice(plan) {
|
|
if (plan.groupPlan) {
|
|
return plan.price * 100
|
|
}
|
|
return plan.price
|
|
}
|
|
|
|
module.exports = {
|
|
shouldPlanChangeAtTermEnd,
|
|
}
|