Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
HasuraNodeComponent
Commits
a7b85eb9
Commit
a7b85eb9
authored
1 year ago
by
Ankit
Browse files
Options
Download
Patches
Plain Diff
v2
parent
4b0c7e62
main
UAT
icici-easypay-endpoint
1 merge request
!19
v2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
index.js
+57
-1
index.js
with
57 additions
and
1 deletion
+57
-1
index.js
+
57
−
1
View file @
a7b85eb9
import
express
from
"
express
"
;
import
{
createProxyMiddleware
}
from
"
http-proxy-middleware
"
;
import
endpoints
from
"
./endpoints/endpoints.js
"
;
import
easyPay
from
"
./utils/easypay.js
"
import
easyPay
from
"
./utils/easypay.js
"
;
import
axios
from
"
axios
"
;
const
app
=
express
();
app
.
use
(
express
.
json
());
...
...
@@ -54,6 +56,60 @@ app.post("/payment/generatelink", (req, res) => {
);
res
.
status
(
200
).
send
(
response
);
}
catch
(
err
)
{
console
.
log
(
err
);
res
.
status
(
500
).
send
({
message
:
"
Some Error Occured
"
});
}
});
//payment handlers
app
.
post
(
"
/payment/v2/generatelink
"
,
async
(
req
,
res
)
=>
{
const
payload
=
req
.
body
;
try
{
const
response
=
await
easyPay
.
generatePayload
(
payload
,
process
.
env
.
environment
===
"
prod
"
?
true
:
true
);
//make api call to insert data
//create payload
const
date
=
new
Date
();
let
data
=
{
object
:
{
created_by
:
payload
.
created_by
,
invoice_date
:
payload
.
mandatoryFields
.
invoiceDate
,
invoice_id
:
payload
.
mandatoryFields
.
invoiceId
,
invoice_time
:
payload
.
mandatoryFields
.
invoiceId
,
payer_id
:
payload
.
mandatoryFields
.
payerId
,
payer_type
:
payload
.
mandatoryFields
.
payerType
,
payment_mode
:
payload
.
paymode
,
reference_no
:
response
.
referenceNo
,
transaction_amount
:
payload
.
mandatoryFields
.
transactionAmount
,
transaction_date
:
date
.
getDay
()
+
"
-
"
+
date
.
getMonth
()
+
"
-
"
+
date
.
getFullYear
(),
transaction_status
:
"
UNPAID
"
,
transaction_time
:
date
.
getHours
()
+
"
:
"
+
date
.
getMinutes
(),
},
}
//insert into hasura
let
config
=
{
method
:
"
put
"
,
maxBodyLength
:
Infinity
,
url
:
"
https://uphrh.in/api/api/rest/saveTransactionRecord
"
,
headers
:
{
Authorization
:
"
Bearer
"
+
process
.
env
.
Authorization
,
},
data
:
data
,
};
await
axios
.
request
(
config
)
res
.
status
(
200
).
send
(
response
);
}
catch
(
err
)
{
console
.
log
(
err
);
res
.
status
(
500
).
send
({
message
:
"
Some Error Occured
"
});
}
});
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets