add validation in request

This commit is contained in:
Mohd-Arham
2025-12-04 12:17:14 +05:30
parent 28708d1d74
commit 812aa3c2ff
9 changed files with 89 additions and 41 deletions
@@ -1,30 +1,42 @@
package com.billpaymentservice.bbps.dto.auth;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
public class VerifyOtpRequest {
private String mobile;
private String otp;
public VerifyOtpRequest() {
}
@NotNull(message = "Mobile number cannot be null.")
@Size(min = 10, max = 10, message = "Mobile number must be exactly 10 digits.")
@Pattern(regexp = "^[0-9]{10}$", message = "Mobile number must contain only digits.")
private String mobile;
public VerifyOtpRequest(String mobile, String otp) {
this.mobile = mobile;
this.otp = otp;
}
@NotNull(message = "OTP cannot be null.")
@Size(min = 6, max = 6, message = "OTP must be exactly 6 digits.")
@Pattern(regexp = "^[0-9]{6}$", message = "OTP must contain only 6 digits.")
private String otp;
public String getMobile() {
return mobile;
}
public VerifyOtpRequest() {
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public VerifyOtpRequest(String mobile, String otp) {
this.mobile = mobile;
this.otp = otp;
}
public String getOtp() {
return otp;
}
public String getMobile() {
return mobile;
}
public void setOtp(String otp) {
this.otp = otp;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getOtp() {
return otp;
}
public void setOtp(String otp) {
this.otp = otp;
}
}