add validation in request
This commit is contained in:
@@ -1,19 +1,28 @@
|
||||
package com.billpaymentservice.bbps.dto.auth;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
public class LoginRequest {
|
||||
private String mobile;
|
||||
|
||||
public LoginRequest() {}
|
||||
@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 LoginRequest(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
public LoginRequest() {
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
public LoginRequest(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,31 @@ package com.billpaymentservice.bbps.dto.auth;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.request.BaseClass;
|
||||
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class RegisterRequest extends BaseClass {
|
||||
|
||||
@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 10 digits.")
|
||||
private String mobile;
|
||||
|
||||
@NotNull(message = "Name cannot be null.")
|
||||
@Size(min = 2, max = 100, message = "Name must be between 2 and 100 characters.")
|
||||
private String name;
|
||||
|
||||
@NotNull(message = "Email cannot be null.")
|
||||
@Email(message = "Email must be a valid email address.")
|
||||
private String email;
|
||||
|
||||
@NotNull(message = "Registration token cannot be null.")
|
||||
private String registrationToken;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.billpaymentservice.bbps.dto.request;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.billpaymentservice.bbps.dto.request;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -7,9 +9,16 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public class ComplaintRequestDTO extends BaseClass {
|
||||
|
||||
private String ticketDescription; // Complaint description that the user enters
|
||||
private String ticketDisposition; // Complaint disposition
|
||||
private String ticketDispositionCode; // Type of complaint
|
||||
private String txnId; // Transaction ID (optional)
|
||||
@NotBlank(message = "Ticket description cannot be null.")
|
||||
private String ticketDescription;
|
||||
|
||||
@NotBlank(message = "Ticket disposition cannot be null.")
|
||||
private String ticketDisposition;
|
||||
|
||||
@NotBlank(message = "Ticket disposition code cannot be null.")
|
||||
private String ticketDispositionCode;
|
||||
|
||||
@NotBlank(message = "Transaction ID cannot be null.")
|
||||
private String txnId;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.billpaymentservice.bbps.dto.response;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.TicketDetailsDTO;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -9,9 +10,13 @@ public class TicketCheckStatusResponse {
|
||||
|
||||
private String refId;
|
||||
private TicketDetailsDTO ticketDetails;
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String message;
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String remarks;
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String status;
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String statusCode;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user