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
userManagement
Commits
5445c515
Unverified
Commit
5445c515
authored
1 year ago
by
Mahesh Maney R
Committed by
GitHub
1 year ago
Browse files
Options
Download
Patches
Plain Diff
Update UserService.java
parent
65c1279f
main
UAT_quick_fix_keycloak
UPHRH_8164_ErrorHandling
dev
dev_stable
devops-patch
feature_update_fee
github/fork/jaypratapsingh1/test_changes
keycloak_logs
payment-webhook
rahu_error_message_fix
uat
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/com/tarento/upsmf/userManagement/services/UserService.java
+35
-2
...om/tarento/upsmf/userManagement/services/UserService.java
with
35 additions
and
2 deletions
+35
-2
src/main/java/com/tarento/upsmf/userManagement/services/UserService.java
+
35
−
2
View file @
5445c515
...
@@ -12,8 +12,8 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
...
@@ -12,8 +12,8 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
java.net.
URI
;
import
java.net.
*
;
import
java.n
et.URISyntaxException
;
import
java.n
io.charset.StandardCharsets
;
@Component
@Component
public
class
UserService
{
public
class
UserService
{
...
@@ -90,4 +90,37 @@ public class UserService {
...
@@ -90,4 +90,37 @@ public class UserService {
ResponseEntity
<
JsonNode
>
result
=
restTemplate
.
postForEntity
(
uri
,
httpEntity
,
JsonNode
.
class
);
ResponseEntity
<
JsonNode
>
result
=
restTemplate
.
postForEntity
(
uri
,
httpEntity
,
JsonNode
.
class
);
return
result
;
return
result
;
}
}
public
ResponseEntity
<
JsonNode
>
sendOTP
(
int
phoneNumber
)
throws
URISyntaxException
{
logger
.
info
(
"sending otp..."
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"Content-Type"
,
"application/json; charset=utf8"
);
headers
.
add
(
"Accept"
,
"application/json"
);
HttpClient
httpClient
=
HttpClientBuilder
.
create
().
build
();
HttpComponentsClientHttpRequestFactory
requestFactory
=
new
HttpComponentsClientHttpRequestFactory
(
httpClient
);
restTemplate
.
setRequestFactory
(
requestFactory
);
String
baseUrl
=
""
;
String
username
=
""
;
String
password
=
""
;
String
senderId
=
""
;
String
message
=
"Hello abc, Your OTP is 1234 sfasa, Lucknow"
;
String
destMobileNo
=
""
;
String
msgType
=
"TXT"
;
String
response
=
"Y"
;
String
payload
=
"username="
+
URLEncoder
.
encode
(
username
,
StandardCharsets
.
UTF_8
)
+
"&pass="
+
URLEncoder
.
encode
(
password
,
StandardCharsets
.
UTF_8
)
+
"&senderid="
+
URLEncoder
.
encode
(
senderId
,
StandardCharsets
.
UTF_8
)
+
"&message="
+
URLEncoder
.
encode
(
message
,
StandardCharsets
.
UTF_8
)
+
"&dest_mobileno="
+
URLEncoder
.
encode
(
String
.
valueOf
(
phoneNumber
),
StandardCharsets
.
UTF_8
)
+
"&msgtype="
+
URLEncoder
.
encode
(
msgType
,
StandardCharsets
.
UTF_8
)
+
"&response="
+
URLEncoder
.
encode
(
response
,
StandardCharsets
.
UTF_8
);
HttpEntity
<
String
>
httpEntity
=
new
HttpEntity
<>(
payload
,
headers
);
ResponseEntity
<
JsonNode
>
result
=
restTemplate
.
exchange
(
baseUrl
,
HttpMethod
.
GET
,
httpEntity
,
JsonNode
.
class
);
return
result
;
}
}
}
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