From 354c2fd704927f56b2bf2857c577597eab5bd1ea Mon Sep 17 00:00:00 2001 From: Bhumika Bhatt <115869626+Bhumika1312@users.noreply.github.com> Date: Sun, 23 Jun 2024 18:49:22 +0530 Subject: [PATCH] Made required changes --- New_APIs/Payment_API/.gitignore | 5 +++++ New_APIs/Payment_API/package-lock.json | 17 +++++++++++++++++ New_APIs/Payment_API/package.json | 1 + New_APIs/Payment_API/server.js | 5 +++-- 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 New_APIs/Payment_API/.gitignore diff --git a/New_APIs/Payment_API/.gitignore b/New_APIs/Payment_API/.gitignore new file mode 100644 index 0000000..953162b --- /dev/null +++ b/New_APIs/Payment_API/.gitignore @@ -0,0 +1,5 @@ +# Node modules +node_modules/ + +# Environment variables +.env diff --git a/New_APIs/Payment_API/package-lock.json b/New_APIs/Payment_API/package-lock.json index 046817e..1db0959 100644 --- a/New_APIs/Payment_API/package-lock.json +++ b/New_APIs/Payment_API/package-lock.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "body-parser": "^1.20.2", + "dotenv": "^16.4.5", "express": "^4.19.2", "open": "^10.1.0", "paypal-rest-sdk": "^1.8.1" @@ -213,6 +214,17 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -980,6 +992,11 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" }, + "dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==" + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", diff --git a/New_APIs/Payment_API/package.json b/New_APIs/Payment_API/package.json index 11b05e5..1ca9f5f 100644 --- a/New_APIs/Payment_API/package.json +++ b/New_APIs/Payment_API/package.json @@ -11,6 +11,7 @@ "license": "ISC", "dependencies": { "body-parser": "^1.20.2", + "dotenv": "^16.4.5", "express": "^4.19.2", "open": "^10.1.0", "paypal-rest-sdk": "^1.8.1" diff --git a/New_APIs/Payment_API/server.js b/New_APIs/Payment_API/server.js index 114d524..f75ed93 100644 --- a/New_APIs/Payment_API/server.js +++ b/New_APIs/Payment_API/server.js @@ -2,6 +2,7 @@ const express = require('express'); const paypal = require('paypal-rest-sdk'); const bodyParser = require('body-parser'); const path = require('path'); +require('dotenv').config(); const app = express(); const port = 3000; @@ -13,8 +14,8 @@ app.use(express.static(path.join(__dirname, 'public'))); paypal.configure({ 'mode': 'sandbox', // sandbox or live - 'client_id': 'AVA7iFWZrxVJy-aEyxLLpq5udhboqo365fKwKfVNLK13ICJth7Hdubkh8fACoFwu8TkjaV6LMrSl--4x', - 'client_secret': 'EMHXSvPOnUCkjoVDGKY-lE3jbszWS1kbak_fZMdmIBRxQSmVy0m05Ym4OxfbYRdV_8nGymoh-J_8pgs0' + 'client_id': process.env.PAYPAL_CLIENT_ID, + 'client_secret': process.env.PAYPAL_CLIENT_SECRET }); app.post('/pay', (req, res) => {