payments
parent
8be2634c15
commit
f56246a524
|
@ -28,6 +28,7 @@
|
|||
"pino-pretty": "^10.3.1",
|
||||
"react-microsoft-clarity": "^1.2.0",
|
||||
"sequelize": "^6.35.2",
|
||||
"stripe": "^14.16.0",
|
||||
"swagger-jsdoc": "^6.2.8",
|
||||
"swagger-ui-express": "^5.0.0",
|
||||
"uuid": "^9.0.1",
|
||||
|
@ -2784,6 +2785,18 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/stripe": {
|
||||
"version": "14.16.0",
|
||||
"resolved": "https://registry.npmjs.org/stripe/-/stripe-14.16.0.tgz",
|
||||
"integrity": "sha512-1gOr2LzafWV84cPIO5Md/QPh4XVPLKULVuRpBVOV3Plq3seiHmg/eeOktX+hDl8jpNZuORHYaUJGrNqrABLwdg==",
|
||||
"dependencies": {
|
||||
"@types/node": ">=8.1.0",
|
||||
"qs": "^6.11.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.*"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-color": {
|
||||
"version": "8.1.1",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
"pino-pretty": "^10.3.1",
|
||||
"react-microsoft-clarity": "^1.2.0",
|
||||
"sequelize": "^6.35.2",
|
||||
"stripe": "^14.16.0",
|
||||
"swagger-jsdoc": "^6.2.8",
|
||||
"swagger-ui-express": "^5.0.0",
|
||||
"uuid": "^9.0.1",
|
||||
|
|
|
@ -9,6 +9,7 @@ import session from "express-session";
|
|||
import useragent from "express-useragent";
|
||||
|
||||
import calendarRoutes from "./src/routes/calendarRoutes";
|
||||
import paymentRoutes from "./src/routes/paymentRoutes";
|
||||
import storeRoutes from "./src/routes/storeRoutes";
|
||||
import storeServicesRoutes from "./src/routes/storeServicesRoutes";
|
||||
import userRoutes from "./src/routes/userRoutes";
|
||||
|
@ -18,7 +19,7 @@ dotenv.config();
|
|||
|
||||
import swaggerJsDoc from "swagger-jsdoc";
|
||||
import syncModels from "./src/models/index";
|
||||
import logger, { initLogHandler, userLogger } from "./src/logger/logger";
|
||||
import logger, { initLogHandler } from "./src/logger/logger";
|
||||
import passport from "passport";
|
||||
import rabbitmq from "./src/rabbitmq/rabbitmq";
|
||||
import { GOOGLE_CALLBACK_URL } from "./src/utils/constants";
|
||||
|
@ -111,6 +112,7 @@ app.use(useragent.express());
|
|||
|
||||
app.use(bodyParser.json());
|
||||
app.use("/api/v1/calendar", calendarRoutes);
|
||||
app.use("/api/v1/payment", paymentRoutes);
|
||||
app.use("/api/v1/store", storeRoutes);
|
||||
app.use("/api/v1/store/services", storeServicesRoutes);
|
||||
app.use("/api/v1/user", userRoutes);
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { Request, Response } from "express";
|
||||
import Stripe from "stripe";
|
||||
|
||||
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string);
|
||||
|
||||
export async function CreatePaymentIntent(req: Request, res: Response) {
|
||||
const paymentIntent = await stripe.paymentIntents.create({
|
||||
amount: 1,
|
||||
currency: "eur",
|
||||
});
|
||||
|
||||
res.send({
|
||||
clientSecret: paymentIntent.client_secret,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
import express from "express";
|
||||
const router = express.Router();
|
||||
|
||||
import * as paymentController from "../controllers/paymentController";
|
||||
|
||||
router.post("/create-payment-intent", paymentController.CreatePaymentIntent);
|
||||
|
||||
export default router;
|
Loading…
Reference in New Issue