✨ redeploy
This commit is contained in:
parent
ed46eddf29
commit
eae6aece6c
@ -2,7 +2,7 @@ import authHandler from "@App/middlewares/AuthHandler";
|
||||
import ruleHandler from "@App/middlewares/RulesHandler";
|
||||
// import roleHandler from "@App/middlewares/RolesHandler";
|
||||
import ApiController from "@Common/system/controller-pattern/ApiController";
|
||||
import { Controller, Get, Post} from "@ControllerPattern/index";
|
||||
import { Controller, Get, Post } from "@ControllerPattern/index";
|
||||
import StripeService from "@Services/common/StripeService/StripeService";
|
||||
import { validateOrReject } from "class-validator";
|
||||
import { Request, Response } from "express";
|
||||
@ -28,13 +28,13 @@ export default class StripeController extends ApiController {
|
||||
//add office id to request body
|
||||
req.body.office = { uid: officeId };
|
||||
|
||||
const frequency : EPaymentFrequency = req.body.frequency;
|
||||
if(!frequency || !Object.values(EPaymentFrequency).includes(frequency)) {
|
||||
const frequency: EPaymentFrequency = req.body.frequency;
|
||||
if (!frequency || !Object.values(EPaymentFrequency).includes(frequency)) {
|
||||
this.httpBadRequest(response, "Invalid frequency");
|
||||
return;
|
||||
}
|
||||
|
||||
//init Subscription resource with request body values
|
||||
|
||||
//init Subscription resource with request body valuess
|
||||
const subscriptionEntity = Subscription.hydrate<Subscription>(req.body, { strategy: "excludeAll" });
|
||||
|
||||
await validateOrReject(subscriptionEntity, { groups: ["createSubscription"], forbidUnknownValues: false });
|
||||
@ -42,7 +42,6 @@ export default class StripeController extends ApiController {
|
||||
const stripeSession = await this.stripeService.createCheckoutSession(subscriptionEntity, frequency);
|
||||
|
||||
this.httpCreated(response, stripeSession);
|
||||
|
||||
} catch (error) {
|
||||
this.httpInternalError(response, error);
|
||||
return;
|
||||
@ -70,7 +69,6 @@ export default class StripeController extends ApiController {
|
||||
@Get("/api/v1/admin/stripe/:uid/client-portal", [authHandler, ruleHandler])
|
||||
protected async getClientPortalSession(req: Request, response: Response) {
|
||||
try {
|
||||
|
||||
const uid = req.params["uid"];
|
||||
if (!uid) {
|
||||
this.httpBadRequest(response, "No uid provided");
|
||||
@ -95,7 +93,7 @@ export default class StripeController extends ApiController {
|
||||
return;
|
||||
}
|
||||
|
||||
const customer = await this.stripeService.getCustomerBySubscription(uid);
|
||||
const customer = await this.stripeService.getCustomerBySubscription(uid);
|
||||
this.httpSuccess(response, customer);
|
||||
} catch (error) {
|
||||
this.httpInternalError(response, error);
|
||||
|
Loading…
x
Reference in New Issue
Block a user