Issue
public ResponseEntity<?> validatePayment(@PathVariable String paymentService,@PathVariable String invoicenumber,HttpServletRequest request) {
try {
String otp = request.getHeader(otp);
if(otp == null)
{
return ResponseEntityMapper.toResponseEntity("Please enter OTP" ,HttpStatus.FORBIDDEN);
Payments response = paymentsServices.validatePayment(paymentService,invoicenumber,otp);
return ResponseEntityMapper.toResponseEntity(response, HttpStatus.OK);
} catch (Exception e) {
e.printStackTrace();
return ResponseEntityMapper.toResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
Solution
looks like you need to assign the result of the getHeader
to your variable.
e.g.
public ResponseEntity<?> validatePayment(@PathVariable String paymentService, @PathVariable String invoicenumber, HttpServletRequest request) {
try {
String otp = request.getHeader(<the name of your header goes here>)
if (otp == null)
Answered By - jeremyt