fe
This commit is contained in:
1 parent
6bca0ed00b
commit
7b207f2ccb
15 files changed
+204
-15
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import type { Request, Response, NextFunction } from "express";
|
||||
import BillingService, {
|
||||
type IBillingService,
|
||||
} from "@/services/system/BillingService.js";
|
||||
|
||||
export interface IBillingController {
|
||||
listPlans: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
||||
subscribePlan: (
|
||||
req: Request,
|
||||
res: Response,
|
||||
next: NextFunction
|
||||
) => Promise<void>;
|
||||
}
|
||||
|
||||
class BillingController implements IBillingController {
|
||||
private billingService: IBillingService;
|
||||
constructor(billingService: IBillingService) {
|
||||
this.billingService = billingService;
|
||||
}
|
||||
|
||||
listPlans = async (_req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
const plans = await this.billingService.listPlans();
|
||||
res.json({ message: "OK", data: plans });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
subscribePlan = async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
res.json({
|
||||
message: "OK",
|
||||
data: { redirectUrl: "https://www.google.com" },
|
||||
});
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default BillingController;
|
||||
@@ -14,4 +14,5 @@ export { default as RecoveryController } from "./RecoveryController.js";
|
||||
export { default as ProfileController } from "./ProfileController.js";
|
||||
export { default as IncidentsController } from "./IncidentsController.js";
|
||||
export { default as SettingsController } from "./SettingsController.js";
|
||||
export { default as BillingController } from "./BillingController.js";
|
||||
export { default as StripeController } from "./StripeController.js";
|
||||
Reference in new issue
Block a user