refactor(server): config system (#11081)
This commit is contained in:
@@ -5,17 +5,18 @@ import Stripe from 'stripe';
|
||||
import { z } from 'zod';
|
||||
|
||||
import {
|
||||
Config,
|
||||
EventBus,
|
||||
InternalServerError,
|
||||
InvalidCheckoutParameters,
|
||||
Mutex,
|
||||
Runtime,
|
||||
SubscriptionAlreadyExists,
|
||||
SubscriptionPlanNotFound,
|
||||
TooManyRequest,
|
||||
URLHelper,
|
||||
} from '../../../base';
|
||||
import { EarlyAccessType, FeatureService } from '../../../core/features';
|
||||
import { StripeFactory } from '../stripe';
|
||||
import {
|
||||
CouponType,
|
||||
KnownStripeInvoice,
|
||||
@@ -53,15 +54,15 @@ export const UserSubscriptionCheckoutArgs = z.object({
|
||||
@Injectable()
|
||||
export class UserSubscriptionManager extends SubscriptionManager {
|
||||
constructor(
|
||||
stripe: Stripe,
|
||||
stripeProvider: StripeFactory,
|
||||
db: PrismaClient,
|
||||
private readonly runtime: Runtime,
|
||||
private readonly config: Config,
|
||||
private readonly feature: FeatureService,
|
||||
private readonly event: EventBus,
|
||||
private readonly url: URLHelper,
|
||||
private readonly mutex: Mutex
|
||||
) {
|
||||
super(stripe, db);
|
||||
super(stripeProvider, db);
|
||||
}
|
||||
|
||||
async filterPrices(
|
||||
@@ -588,7 +589,7 @@ export class UserSubscriptionManager extends SubscriptionManager {
|
||||
{ proEarlyAccess, proSubscribed, onetime }: PriceStrategyStatus
|
||||
) {
|
||||
if (lookupKey.recurring === SubscriptionRecurring.Lifetime) {
|
||||
return this.runtime.fetch('plugins.payment/showLifetimePrice');
|
||||
return this.config.payment.showLifetimePrice;
|
||||
}
|
||||
|
||||
if (lookupKey.variant === SubscriptionVariant.Onetime) {
|
||||
|
||||
Reference in New Issue
Block a user