mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: Update SubscriptionPlan method name to getPlanType
This commit is contained in:
@@ -39,7 +39,7 @@ RunCron(
|
||||
try {
|
||||
if (project.paymentProviderPlanId) {
|
||||
// get subscription detail.
|
||||
const planName: PlanType = SubscriptionPlan.getPlanSelect(
|
||||
const planName: PlanType = SubscriptionPlan.getPlanType(
|
||||
project.paymentProviderPlanId as string,
|
||||
);
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ describe("SubscriptionPlan", () => {
|
||||
expect(isValidPlanId).toBe(true);
|
||||
});
|
||||
});
|
||||
describe("getPlanSelect", () => {
|
||||
describe("getPlanType", () => {
|
||||
it("should return the plan name if valid planId is passed", () => {
|
||||
new SubscriptionPlan(
|
||||
monthlyPlanId,
|
||||
@@ -129,7 +129,7 @@ describe("SubscriptionPlan", () => {
|
||||
2,
|
||||
30,
|
||||
);
|
||||
const result: PlanType = SubscriptionPlan.getPlanSelect(
|
||||
const result: PlanType = SubscriptionPlan.getPlanType(
|
||||
monthlyPlanId,
|
||||
env,
|
||||
);
|
||||
@@ -140,7 +140,7 @@ describe("SubscriptionPlan", () => {
|
||||
.fn()
|
||||
.mockReturnValue(undefined);
|
||||
expect(() => {
|
||||
SubscriptionPlan.getPlanSelect("invalid-plan-id", env);
|
||||
SubscriptionPlan.getPlanType("invalid-plan-id", env);
|
||||
}).toThrow(BadDataException);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -157,7 +157,7 @@ export default class SubscriptionPlan {
|
||||
return Boolean(this.getSubscriptionPlanById(planId, env));
|
||||
}
|
||||
|
||||
public static getPlanSelect(
|
||||
public static getPlanType(
|
||||
planId: string,
|
||||
env?: JSONObject | undefined,
|
||||
): PlanType {
|
||||
|
||||
@@ -114,7 +114,7 @@ export class Service extends DatabaseService<Model> {
|
||||
throw new BadDataException("Plan is invalid.");
|
||||
}
|
||||
|
||||
data.data.planName = SubscriptionPlan.getPlanSelect(
|
||||
data.data.planName = SubscriptionPlan.getPlanType(
|
||||
data.data.paymentProviderPlanId,
|
||||
);
|
||||
|
||||
@@ -358,7 +358,7 @@ export class Service extends DatabaseService<Model> {
|
||||
paymentProviderMeteredSubscriptionId:
|
||||
subscription.meteredSubscriptionId,
|
||||
trialEndsAt: subscription.trialEndsAt || new Date(),
|
||||
planName: SubscriptionPlan.getPlanSelect(
|
||||
planName: SubscriptionPlan.getPlanType(
|
||||
updateBy.data.paymentProviderPlanId! as string,
|
||||
),
|
||||
},
|
||||
@@ -968,7 +968,7 @@ export class Service extends DatabaseService<Model> {
|
||||
throw new BadDataException("Project does not have any plans");
|
||||
}
|
||||
|
||||
const plan: PlanType = SubscriptionPlan.getPlanSelect(
|
||||
const plan: PlanType = SubscriptionPlan.getPlanType(
|
||||
project.paymentProviderPlanId,
|
||||
getAllEnvVars(),
|
||||
);
|
||||
|
||||
@@ -44,7 +44,7 @@ export default class ProjectUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
return SubscriptionPlan.getPlanSelect(
|
||||
return SubscriptionPlan.getPlanType(
|
||||
project.paymentProviderPlanId,
|
||||
getAllEnvVars(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user