Commit d56bcd0d authored by Christopher Cottier's avatar Christopher Cottier

added validations for billing address

parent e8059014
...@@ -5,17 +5,28 @@ import lombok.Getter; ...@@ -5,17 +5,28 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import javax.validation.constraints.NotBlank;
@Getter @Getter
@Setter @Setter
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class CreditCardAddress { public class CreditCardAddress {
@NotBlank(message = "addressLine1 cannot be left blank")
private String addressLine1; private String addressLine1;
private String addressLine2; private String addressLine2;
@NotBlank(message = "cityName cannot be left blank")
private String cityName; private String cityName;
private String countryCode; private String countryCode;
@NotBlank(message = "countryName cannot be left blank")
private String countryName; private String countryName;
@NotBlank(message = "postalCode cannot be left blank")
private String postalCode; private String postalCode;
} }
...@@ -17,7 +17,7 @@ public class CreditCardAmount { ...@@ -17,7 +17,7 @@ public class CreditCardAmount {
@Pattern(regexp = "\\d+\\.\\d{2}", message="Value must be at dollar and cents value separated by '.'") @Pattern(regexp = "\\d+\\.\\d{2}", message="Value must be at dollar and cents value separated by '.'")
String value; String value;
@NotBlank @NotBlank(message = "currency cannot be left blank")
String currency; String currency;
} }
...@@ -26,7 +26,7 @@ public class CreditCardData { ...@@ -26,7 +26,7 @@ public class CreditCardData {
@Pattern(regexp = "\\d{3}", message = "cvc must be 3 digits") @Pattern(regexp = "\\d{3}", message = "cvc must be 3 digits")
String cvc; String cvc;
@NotBlank @NotBlank(message = "holderName cannot be left blank")
String holderName; String holderName;
} }
...@@ -26,7 +26,7 @@ public class CreditCardRequest { ...@@ -26,7 +26,7 @@ public class CreditCardRequest {
@NotBlank(message="merchantAccount can't be blank") @NotBlank(message="merchantAccount can't be blank")
String merchantAccount; String merchantAccount;
@Valid
CreditCardAddress billingAddress; CreditCardAddress billingAddress;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment