-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added simulated-bankapi & Some Bug fixes
- Loading branch information
1 parent
8836269
commit 82e193e
Showing
10 changed files
with
146 additions
and
17 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "simulatad-bankapi", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"dev": "esbuild src/index.ts --bundle --platform=node --outdir=dist && node dist/index.js" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"description": "", | ||
"dependencies": { | ||
"express": "^4.19.2", | ||
"uuid": "^10.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/uuid": "^10.0.0" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
import axios from 'axios'; | ||
import express from 'express'; | ||
import { v4 as uuidv4 } from 'uuid'; | ||
const app = express(); | ||
var cors = require('cors') | ||
app.use(express.json()); | ||
app.use(cors()) | ||
app.post("/api/v1/hdfc/transfer", async(req, res) => { | ||
|
||
const token = uuidv4(); | ||
console.log(token); | ||
console.log(req.body); | ||
// webhook request | ||
try{ | ||
const transferStatusChange = await axios.post("http://localhost:3300/hdfcwebhook", { | ||
token:req.body.token, | ||
userId: req.body.userId, | ||
amount: req.body.amount | ||
}) | ||
|
||
if(transferStatusChange.status === 200){ | ||
res.status(200).json({ | ||
message: "Transfer Completed" | ||
}) | ||
} | ||
else{ | ||
res.status(411).json({ | ||
message: "Error while processing transfer" | ||
}) | ||
} | ||
}catch(e){ | ||
console.error(e); | ||
res.status(411).json({ | ||
message: "Error while processing transfer" | ||
}) | ||
} | ||
}) | ||
|
||
app.listen(3301, ()=>{ | ||
console.log("Server started at 3301"); | ||
}) |
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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