-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
45 lines (40 loc) · 908 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const callAPI = require("./callAPI");
exports.handler = async (event) => {
try {
const body = event.body;
const resp = await callAPI({
method: "POST",
uri: "https://cb-nonprod.kotak.com/neobank/api/initsdk",
body: body,
json: true,
headers: {
"Content-Type": "application/json",
},
});
const firstSuccess = {
...resp.body,
};
if (firstSuccess.statusCode === 200) {
const resp = await callAPI({
method: "POST",
uri: "https://cb-nonprod.kotak.com/neobank/api/initsdk",
body: body,
json: true,
headers: {
"Content-Type": "application/json",
},
});
return {
...resp.body,
};
} else {
return firstSuccess;
}
} catch (e) {
console.log(e);
return {
code: 500,
message: "Internal Server Error",
};
}
};