Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Component Sharing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gagandeep Singh Bhatia
Component Sharing
Commits
6616e7f4
Commit
6616e7f4
authored
Jul 02, 2024
by
Sonawane Amol Madhjuar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace CustomerExtrenalInfo.jsp
parent
d037a259
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
128 additions
and
104 deletions
+128
-104
Amol/VisionDIJSP/CustomerExtrenalInfo.jsp
Amol/VisionDIJSP/CustomerExtrenalInfo.jsp
+128
-104
No files found.
Amol/VisionDIJSP/CustomerExtrenalInfo.jsp
View file @
6616e7f4
...
...
@@ -6,36 +6,44 @@
<head>
<meta
charset=
"UTF-8"
>
<title>
Customer External Information
</title>
<script>
function
updateInputBox
()
{
var
selectedOption
=
document
.
getElementById
(
"
idType
"
).
value
;
document
.
getElementById
(
"
selectedIdType
"
).
value
=
selectedOption
;
}
function
getDetails
()
{
document
.
getElementById
(
"
detailsForm
"
).
submit
();
}
</script>
</head>
<body>
<%
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Customer Exterranl Info "
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Customer External Info "
);
System
.
out
.
println
(
"...@@@@@@@ In CustExtInfo.jsp @@@@@@@@..."
);
String
custCode
=
request
.
getParameter
(
"CUST_CODE"
);
String
selectedOption
=
request
.
getParameter
(
"idType"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"CustCode ["
+
custCode
+
"]"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Selected Option ["
+
selectedOption
+
"]"
);
UserInfoBean
userInfo
=
(
UserInfoBean
)
session
.
getAttribute
(
"USER_INFO"
);
DBAccessEJB
dbAccess
=
new
DBAccessEJB
();
String
infoResponse
=
null
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
"infoResponse1 :: "
+
infoResponse
);
// Check if custCode is present in the database
String
custCODE
=
dbAccess
.
getDBColumnValue
(
"CUST_EXT_INFO"
,
"CUST_CODE"
,
"CUST_CODE = '"
+
custCode
+
"'"
,
userInfo
.
getTransDB
());
BaseLogger
.
log
(
"3"
,
null
,
null
,
"CustCode present in CUST_EXT_INFO Table ["
+
custCODE
+
"]"
);
if
(
custCODE
!=
null
)
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Inside if block.."
);
// If custCode is present, get the INFO_RESPONSE from database
infoResponse
=
dbAccess
.
getDBColumnValue
(
"CUST_EXT_INFO"
,
"INFO_RESPONSE"
,
"CUST_CODE = '"
+
custCode
+
"'"
,
userInfo
.
getTransDB
());
BaseLogger
.
log
(
"3"
,
null
,
null
,
"
infoResponse
::===
>
[
" + infoResponse + "
]
");
} else {
BaseLogger.log("
3
", null, null, "
Inside
else
block
..
");
// If custCode is not present, call the API and store the response in database
String
panNumber
=
null
;
String
panVerificationResponse
=
null
;
if
(
"pan"
.
equals
(
selectedOption
))
{
panNumber
=
dbAccess
.
getDBColumnValue
(
"CUSTOMER"
,
"PAN_NO"
,
"CUST_CODE = '"
+
custCode
+
"'"
,
userInfo
.
getTransDB
());
if
(
panNumber
!=
null
&&
!
panNumber
.
isEmpty
())
{
panVerificationResponse
=
dbAccess
.
getDBColumnValue
(
"CUST_EXT_INFO"
,
"INFO_RESPONSE"
,
"CUST_CODE = '"
+
custCode
+
"' AND INFO_TYPE = 'Pan Verification'"
,
userInfo
.
getTransDB
());
if
(
panVerificationResponse
==
null
)
{
// Call the API if panVerificationResponse is null
try
{
String apiUrl = "
https:
//sandboxapi.atlas.vayana.com/AtlasApi/v1.0/aadhaar/udyam/registration
/verification";
String
apiUrl
=
"https://sandboxapi.atlas.vayana.com/AtlasApi/v1.0/aadhaar/udyam
/verification"
;
URL
url
=
new
URL
(
apiUrl
);
HttpURLConnection
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
conn
.
setRequestMethod
(
"GET"
);
...
...
@@ -49,8 +57,8 @@
}
in
.
close
();
info
Response
=
apiResponse
.
toString
();
BaseLogger
.
log
(
"3"
,
null
,
null
,
"API Response: "
+
info
Response
);
panVerification
Response
=
apiResponse
.
toString
();
BaseLogger
.
log
(
"3"
,
null
,
null
,
"API Response for PAN Verification: "
+
panVerification
Response
);
// Store the API response in the database
Connection
connection
=
null
;
...
...
@@ -58,10 +66,11 @@
try
{
ConnDriver
connDriver
=
new
ConnDriver
();
connection
=
connDriver
.
getConnectDB
(
userInfo
.
getTransDB
());
String
insertQuery
=
"INSERT INTO CUST_EXT_INFO (CUST_CODE, INFO_RESPONSE) VALUES (
?, ?)"
;
String
insertQuery
=
"INSERT INTO CUST_EXT_INFO (CUST_CODE, INFO_TYPE, INFO_RESPONSE) VALUES (?,
?, ?)"
;
pstmt
=
connection
.
prepareStatement
(
insertQuery
);
pstmt
.
setString
(
1
,
custCode
);
pstmt
.
setString
(
2
,
infoResponse
);
pstmt
.
setString
(
2
,
"Pan Verification"
);
pstmt
.
setString
(
3
,
panVerificationResponse
);
pstmt
.
executeUpdate
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
...
...
@@ -82,21 +91,36 @@
}
}
}
catch
(
Exception
e
)
{
out
.
println
(
"Error calling API: "
+
e
.
getMessage
());
out
.
println
(
"Error calling API for PAN Verification: "
+
e
.
getMessage
());
}
}
}
}
%>
<h1>
Customer External Information
</h1>
<%-- Check if infoResponse is not null and parse JSON --%>
<%
BaseLogger
.
log
(
"3"
,
null
,
null
,
"infoResponse2 :: "
+
infoResponse
);
if
(
infoResponse
!=
null
||
!
infoResponse
.
trim
().
isEmpty
())
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Inside the If Block :: "
+
infoResponse
);
%>
<h2>
JSON Data
</h2>
<form
id=
"detailsForm"
method=
"post"
action=
""
>
<label
for=
"idType"
>
Choose an ID type:
</label>
<select
id=
"idType"
name=
"idType"
onchange=
"updateInputBox()"
>
<option
value=
"pan"
<%=
"pan"
.
equals
(
selectedOption
)
?
"selected"
:
""
%>>
Pan
</option>
<option
value=
"aadharno"
<%=
"aadharno"
.
equals
(
selectedOption
)
?
"selected"
:
""
%>>
Aadharno
</option>
<option
value=
"udyogno"
<%=
"udyogno"
.
equals
(
selectedOption
)
?
"selected"
:
""
%>>
Udyog no
</option>
</select>
<input
type=
"hidden"
name=
"CUST_CODE"
value=
"
<%=
custCode
%>
"
>
<br><br>
<label
for=
"selectedIdType"
>
Selected ID Type:
</label>
<input
type=
"text"
id=
"selectedIdType"
name=
"selectedIdType"
readonly
value=
"
<%=
selectedOption
!=
null
?
selectedOption
:
""
%>
"
>
<br><br>
<button
type=
"button"
onclick=
"getDetails()"
>
Get Details
</button>
</form>
<%
if
(
"pan"
.
equals
(
selectedOption
))
{
%>
<h2>
PAN Number
</h2>
<p><%=
panNumber
!=
null
?
panNumber
:
"No PAN number found for the given customer code."
%></p>
<%
if
(
panVerificationResponse
!=
null
&&
!
panVerificationResponse
.
isEmpty
())
{
%>
<h2>
Pan Verification Info Response
</h2>
<table
id=
"jsonData"
>
<thead>
<tr>
...
...
@@ -105,9 +129,8 @@ if (infoResponse != null || !infoResponse.trim().isEmpty()) {
</tr>
</thead>
<tbody>
<%-- Parse JSON response using JavaScript --%>
<script>
var
jsonData
=
<%=
info
Response
.
replaceAll
(
"\""
,
"\\\""
)
%>
;
var
jsonData
=
<%=
panVerification
Response
.
replaceAll
(
"\""
,
"\\\""
)
%>
;
function
createTableFromJson
(
data
,
parentElement
)
{
for
(
var
key
in
data
)
{
...
...
@@ -137,8 +160,9 @@ if (infoResponse != null || !infoResponse.trim().isEmpty()) {
</script>
</tbody>
</table>
<%
}
else
{
%>
<p>
No data available.
</p>
<%
}
else
{
%>
<p>
No Pan Verification response found for the given customer code.
</p>
<%
}
%>
<%
}
%>
</body>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment