Commit d56bcd0d authored by Christopher Cottier's avatar Christopher Cottier

added validations for billing address

parent e8059014
......@@ -5,17 +5,28 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class CreditCardAddress {
@NotBlank(message = "addressLine1 cannot be left blank")
private String addressLine1;
private String addressLine2;
@NotBlank(message = "cityName cannot be left blank")
private String cityName;
private String countryCode;
@NotBlank(message = "countryName cannot be left blank")
private String countryName;
@NotBlank(message = "postalCode cannot be left blank")
private String postalCode;
}
......@@ -17,7 +17,7 @@ public class CreditCardAmount {
@Pattern(regexp = "\\d+\\.\\d{2}", message="Value must be at dollar and cents value separated by '.'")
String value;
@NotBlank
@NotBlank(message = "currency cannot be left blank")
String currency;
}
......@@ -26,7 +26,7 @@ public class CreditCardData {
@Pattern(regexp = "\\d{3}", message = "cvc must be 3 digits")
String cvc;
@NotBlank
@NotBlank(message = "holderName cannot be left blank")
String holderName;
}
......@@ -26,7 +26,7 @@ public class CreditCardRequest {
@NotBlank(message="merchantAccount can't be blank")
String merchantAccount;
@Valid
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