This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post('/paynow', [parseUrl, parseJson], (req, res) => { | |
if (!req.body.amount || !req.body.email || !req.body.phone) { | |
res.status(400).send('Payment failed') | |
} else { | |
var params = {}; | |
params['MID'] = config.PaytmConfig.mid; | |
params['WEBSITE'] = config.PaytmConfig.website; | |
params['CHANNEL_ID'] = 'WEB'; | |
params['INDUSTRY_TYPE_ID'] = 'Retail'; | |
params['ORDER_ID'] = 'TEST_' + new Date().getTime(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post('/callback', (req, res) => { | |
var body = ''; | |
req.on('data', function (data) { | |
body += data; | |
}); | |
req.on('end', function () { | |
var html = ""; | |
var post_data = qs.parse(body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let body = '' | |
const orderId = 'TEST_' + new Date().getTime() | |
req.on('error', (err) => { | |
console.error(err.stack) | |
}).on('data', (chunk) => { | |
body += chunk | |
}).on('end', () => { | |
let data = qs.parse(body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let callbackResponse = '' | |
req.on('error', (err) => { | |
console.error(err.stack) | |
}).on('data', (chunk) => { | |
callbackResponse += chunk | |
}).on('end', () => { | |
let data = qs.parse(callbackResponse) | |
console.log(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const admin = require('firebase-admin') | |
// Initialize firebase admin SDK | |
admin.initializeApp({ | |
credential: admin.credential.cert(<path to your firebase credentials file>), | |
storageBucket: <firebaseprojectid>.appspot.com | |
}) | |
// Cloud storage | |
const bucket = admin.storage().bucket() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const multer = require('multer') | |
const app = express() | |
const upload = multer({ | |
storage: multer.memoryStorage() | |
}) | |
app.post('/upload', upload.single('file'), (req, res) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const multer = require('multer') | |
const firebase = require('./firebase') | |
const app = express() | |
const upload = multer({ | |
storage: multer.memoryStorage() | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div id="app"> | |
<input type="file" ref="file" v-on:change="handleUpload()"/> | |
<button v-on:click="uploadFile()">Upload</button> <br> | |
</div> | |
</template> | |
<script> | |
import axios from 'axios' | |
export default { |