Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #5

Open
wants to merge 80 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
1978c32
Add notification in order
nivedit06 Sep 19, 2024
6897d08
Add notification requirement file and change in register api
nivedit06 Sep 19, 2024
05a0d4d
Add firebase configuration
nivedit06 Sep 19, 2024
950ce15
Correct the notification error
nivedit06 Sep 19, 2024
08463a3
Change port to 3129
nivedit06 Sep 20, 2024
7728879
Edit the notification functionality and remove device token constraint
nivedit06 Sep 23, 2024
2fbf274
Update highlight and update api as per website need, add discount fun…
nivedit06 Sep 24, 2024
5ea82c2
Add token verififcation and update it, integrated increase and decrea…
nivedit06 Sep 25, 2024
c7f2efb
Update address check and verifytoken in address route
nivedit06 Sep 26, 2024
7fc97e5
sds
nivedit06 Sep 26, 2024
82d1de5
verifyToken removed
nivedit06 Sep 26, 2024
a449ffd
change route
nivedit06 Sep 26, 2024
2a79698
edit route
nivedit06 Sep 26, 2024
503a933
Add jwt required header file
nivedit06 Sep 26, 2024
0914374
Add remove cart updations according to app, add notification api to g…
nivedit06 Sep 26, 2024
2a9a5db
update api for pagination
nivedit06 Sep 27, 2024
ef80c53
Update order summary with necessary fields
nivedit06 Oct 4, 2024
78581de
Update the order summary api with discount cost display
nivedit06 Oct 4, 2024
2f7a7af
Change cart api to change quantity and add getProductFromCart api to …
nivedit06 Oct 7, 2024
c73546c
fix some bugs of routes
nivedit06 Oct 7, 2024
7891e20
add order summary, where data will be shown
nivedit06 Oct 7, 2024
4ed86e8
Integrated payment method for testing purpose with currency type as U…
nivedit06 Oct 10, 2024
16ae09c
add payment model updates and add paymentId in order model and instal…
nivedit06 Oct 10, 2024
9e2e85b
add require models and files for payment to be carried properly
nivedit06 Oct 10, 2024
4d74932
add env again
nivedit06 Oct 10, 2024
f70a76c
Add buyNow api to purchase specific product
nivedit06 Oct 11, 2024
212d6eb
Add the changes of the routes
nivedit06 Oct 11, 2024
914315f
fix dockerfile
Oct 11, 2024
65f525e
check webhooks
Oct 11, 2024
19ff777
Add the stripe changed working in createOrder api and save the paymen…
nivedit06 Oct 14, 2024
7197d3f
commit
nivedit06 Oct 14, 2024
093ecc5
Add token processing for website side payment
nivedit06 Oct 15, 2024
cfef5ab
Add token method for stripe payment instead of paymentIntent
nivedit06 Oct 16, 2024
65c2065
Change status to orderStatus to identify the status of the order
nivedit06 Oct 16, 2024
5010494
Add get discount by category api to fetch discounted product accordin…
nivedit06 Oct 16, 2024
bc738bb
Integrated paypal payment method according to token generation
nivedit06 Oct 22, 2024
2016a33
Add contact us functionality
nivedit06 Oct 23, 2024
901f052
commit
nivedit06 Oct 23, 2024
511ffc7
commit
nivedit06 Oct 23, 2024
bf31915
add onbehalfof field
nivedit06 Oct 23, 2024
03c279c
Add PaymentIntent method of payment for appside
nivedit06 Oct 23, 2024
062d7a2
Rectify order summary
nivedit06 Oct 23, 2024
13aceb2
Rectify the payment issue of paypal by adding the payerId
nivedit06 Oct 24, 2024
b7b6a51
add chage
Oct 28, 2024
323d3f3
Add review functionality
nivedit06 Dec 10, 2024
4e902f7
Solve the merge confict of sumup payment
nivedit06 Dec 10, 2024
4d32910
Add google auth code, voucher updations in get voucher and get order …
nivedit06 Dec 23, 2024
0a0fafa
Add fixes to routes
nivedit06 Dec 23, 2024
7b5d21c
Add fixes in get order summary
nivedit06 Dec 23, 2024
f845644
Change the order summary api
nivedit06 Dec 23, 2024
f62d50c
Add changes regarding the order summary and vouhcer application
nivedit06 Dec 23, 2024
56da93d
Add the order summary api changes and applly voucher changes
nivedit06 Dec 23, 2024
3a6949a
Fix route
nivedit06 Dec 23, 2024
ae8d2af
Add fixes in the order summary api
nivedit06 Dec 23, 2024
3b3c9c4
Add fixes in the apply voucher and connect it with order summary and …
nivedit06 Dec 24, 2024
a88004b
Add fixes in routes
nivedit06 Dec 24, 2024
80daacc
added tax functionality
nivedit06 Dec 24, 2024
8d82efc
added get all voucher api
nivedit06 Dec 24, 2024
46cb070
fixed tax calculation
nivedit06 Dec 24, 2024
d43c905
remove tax calculation from api
nivedit06 Dec 24, 2024
9add3f7
remove tax calculation from order summary and apply voucher api
nivedit06 Dec 24, 2024
1aba3e6
Tried fixing the google auth now working is operated from frontend, i…
nivedit06 Jan 2, 2025
f4c77d8
Fix the invoice controller functionality
nivedit06 Jan 2, 2025
622ab2f
Fix the invoice number regeneration
nivedit06 Jan 2, 2025
4b8ee3c
Fix the invoice address details and created get order by id
nivedit06 Jan 3, 2025
f4e7c86
Add tracking id
nivedit06 Jan 3, 2025
ba6bcf2
Modify the get voucher according to the active status and expiry date…
nivedit06 Jan 3, 2025
af51774
creds
nivedit06 Jan 3, 2025
1adcbe2
creds
nivedit06 Jan 3, 2025
3b82ded
changed log in time to 1m
nivedit06 Jan 3, 2025
fa95838
creds
nivedit06 Jan 3, 2025
508ced2
Add reset of voucher details after order is created
nivedit06 Jan 3, 2025
bc31b5f
Fix paymnet
nivedit06 Jan 6, 2025
cfccfd4
Fix paymnet
nivedit06 Jan 6, 2025
e900c5b
Fix paymnet
nivedit06 Jan 6, 2025
7d62122
added kubernetes menifest file
Jan 6, 2025
9091bfc
Fix payment
nivedit06 Jan 6, 2025
ad4639c
Merge branch 'development' of https://github.com/nivedit06/Ecom into …
nivedit06 Jan 6, 2025
094e51a
Add changes regarding the invoice and fetching delivery charges
nivedit06 Jan 8, 2025
6906c83
Add changes of the creds for mailing
nivedit06 Feb 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ const invoiceRoute = require('./routes/invoiceRoute');
const notificationRoute = require('./routes/notificationRoute');
const paymentRoute = require('./routes/paymentRoute');
const contactRoute = require('./routes/contactRoute');
const sumupRoutes=require('./controllers/sumuppayment');
const reviewRoute = require('./routes/reviewRoute');


@@ -79,6 +80,7 @@ app.use('/api/invoices', invoiceRoute);
app.use('/api/notification', notificationRoute);
app.use('/api/payment', paymentRoute);
app.use('/api/contact', contactRoute);
app.use('/api/sumup', sumupRoutes);
app.use('/api/review', reviewRoute);

app.get('/', (req, res) => {
65 changes: 65 additions & 0 deletions controllers/sumuppayment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const express = require('express');
const axios = require('axios');
const router = express.Router();

router.get('/payment-success', (req, res) => {
res.send('Payment successful! Thank you for your purchase.');
});

async function getAccessToken() {
const response = await axios.post('https://api.sumup.com/token', {
grant_type: 'client_credentials',
client_id: 'cc_classic_auXtwtSxa6ZYrzlvzEbzGHixFDq53',
client_secret: 'cc_sk_classic_wFABgcwuvnaZ0WfSB7BFqfW2IhHiREF5Qd8MfYJzXInZjNBBnY'
});
return response.data.access_token;
}

router.post('/create-payment', async (req, res) => {
try {
const accessToken = await getAccessToken();

// Payment data
const paymentData = {
amount: 1000,
currency: 'USD',
description: 'test',
pay_to_email: 'ts@yopmail.com',
merchant_code: 'M92TZYGT',
checkout_reference: `ref_${Date.now()}_${Math.random().toString(36).substring(2, 15)}`,
redirect_url: 'http://localhost:3129/api/sumup/payment-success',
purpose: 'CHECKOUT',
skip_success_screen: true,
payment_type: 'card'
};

const paymentResponse = await axios.post('https://api.sumup.com/v0.1/checkouts', paymentData, {
headers: {
Authorization: `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});
console.log(paymentResponse.data);


if (paymentResponse.data && paymentResponse.data.checkout_url) {
const paymentUrl = paymentResponse.data.checkout_url;
return res.status(200).json({ success: true, paymentUrl });
} else {
return res.status(200).json({
success: false,
message: 'Payment is pending. Awaiting user action.',
details: paymentResponse.data
});
}
} catch (error) {
if (error.response) {
console.error('Error data:', error.response.data);
return res.status(error.response.status).json(error.response.data);
} else {
console.error('Error message:', error.message);
return res.status(500).json({ message: 'Internal Server Error' });
}
}
});
module.exports = router;
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
"body-parser": "^1.20.2",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"dotenv": "^16.4.4",
"dotenv": "^16.4.5",
"express": "^4.18.2",
"express-async-handler": "^1.2.0",
"express-fileupload": "^1.5.1",