NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

// const express = require("express");
// const axios = require("axios");
// const jwt = require("jsonwebtoken");
// const crypto = require("crypto");
// const jose = require("jose");
// const moment = require("moment");
// const cors = require("cors");

// const app = express();
// const port = 3000;
// app.use(cors());
// app.use(express.json());


// // App credentials
// const secret = "MQhOGAptQclonkWOZTqgBpmrnwsIjrRt";
// const clientid = "bizstnduat";
// const mercid = "BIZSTNDUAT";

// const generateJWSToken = async (user_agent, ip) => {
// try {
// const header = {
// alg: "HS256",
// clientid: clientid,
// };

// const payload = {
// mercid: mercid,
// orderid: `BS_${new Date().valueOf()}`,
// amount: "300.00",
// order_date: "" + moment().format("YYYY-MM-DDTHH:mm:ssZ") + "",
// currency: "356",
// ru: "https://bscdev-rec.bslearning.in/payment-redirect",
// itemcode: "DIRECT",
// mandate_required: "N",
// customer: null,
// device: {
// init_channel: "internet",
// ip,
// user_agent,
// // user_agent:
// // "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
// // "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Mobile Safari/537.36",
// },
// };

// const secretKey = crypto.createSecretKey(Buffer.from(secret, "utf-8"));
// const token = await new jose.SignJWT(payload)
// .setProtectedHeader(header)
// .sign(secretKey);
// console.log(token);

// return token;
// } catch (error) {
// console.log(error);
// }
// };

// // API to generate JWS-HMAC signature
// app.get("/api", async (req, res) => {
// try {
// const headers = {
// "content-type": "application/jose",
// accept: "application/jose",
// "bd-timestamp": new Date().valueOf(),
// "bd-traceid": `${new Date().valueOf()}ABD1K`,
// };

// const data = await generateJWSToken(req.headers["user-agent"], req.ip);
// // console.log(data);
// const response = await axios.post(
// "https://pguat.billdesk.io/payments/ve1_2/orders/create",
// data,
// { headers }
// );
// console.log(response.data);
// const decodedJWT = await jose.decodeJwt(response.data);
// res.status(200).json(decodedJWT);
// } catch (error) {
// console.log(error);
// res.status(200).json({ response: error.response, error });
// }
// });

// app.listen(port, () => {
// console.log(`Server is running on http://localhost:${port}`);
// });

const express = require("express");
const axios = require("axios");
const jwt = require("jsonwebtoken");
const crypto = require("crypto");
const jose = require("jose");
const moment = require("moment");
const cors = require("cors");

const app = express();
const port = 3001;
app.use(cors());
app.use(express.json());

// App credentials
const secret = "MQhOGAptQclonkWOZTqgBpmrnwsIjrRt";
const clientid = "bizstnduat";
const mercid = "BIZSTNDUAT";

const generateJWSToken = async (user_agent, ip) => {
try {
const header = {
alg: "HS256",
clientid: clientid,
};

const payload = {
mercid: mercid,
orderid: `BS_${new Date().valueOf()}`,
amount: "300.00",
order_date: "" + moment().format("YYYY-MM-DDTHH:mm:ssZ") + "",
currency: "356",
ru: "https://bscdev-rec.bslearning.in/payment-redirect",
itemcode: "DIRECT",
mandate_required: "N",
customer: null,
device: {
init_channel: "internet",
ip,
user_agent,
},
additional_info: {
additional_info1: `1`,
additional_info2: `2`,
additional_info3: `3`,
}
};

const secretKey = crypto.createSecretKey(Buffer.from(secret, "utf-8"));
const token = await new jose.SignJWT(payload)
.setProtectedHeader(header)
.sign(secretKey);
console.log(token);

return token;
} catch (error) {
console.log(error);
}
};

// API to generate JWS-HMAC signature
app.get("/api", async (req, res) => {
try {
const headers = {
"content-type": "application/jose",
accept: "application/jose",
"bd-timestamp": new Date().valueOf(),
"bd-traceid": `${new Date().valueOf()}ABD1K`,
};

const data = await generateJWSToken(req.headers["user-agent"], req.ip);
const response = await axios.post(
"https://pguat.billdesk.io/payments/ve1_2/orders/create",
data,
{ headers }
);
console.log(response.data);
const decodedJWT = await jose.decodeJwt(response.data);
res.status(200).json(decodedJWT);
} catch (error) {
console.log(error);
res.status(200).json({
response: error.response ? {
status: error.response.status,
data: error.response.data
} : null,
message: error.message
});
}
});

app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`);
});
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.