Skip to content

Commit

Permalink
Merge pull request #225 from hmrc/PODS-9894
Browse files Browse the repository at this point in the history
Pods 9894
  • Loading branch information
PavelVjalicin authored Oct 17, 2024
2 parents 4f97d5d + b7fbcf5 commit 22cba53
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions app/forms/mappings/Formatters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import scala.util.{Failure, Success, Try}

trait Formatters extends Transforms with Constraints {
private[mappings] val decimalFormat = new DecimalFormat("0.00")
private[mappings] val postcodeRegexp = """^[A-Z]{1,2}[0-9][0-9A-Z]?\s?[0-9][A-Z]{2}$"""
private[mappings] val numericRegexp = """^-?(\-?)(\d*)(\.?)(\d*)$"""
private[mappings] val decimalRegexp = """^-?(\d*\.\d*)$"""
private[mappings] val decimal2DPRegexp = """^-?(\d*\.\d{2})$"""
Expand Down Expand Up @@ -58,7 +57,7 @@ trait Formatters extends Transforms with Constraints {
val maxLengthNonUKPostcode = 10

(postCode, country, requiredKey) match {
case (Some(zip), Some("GB"), _) if zip.matches(postcodeRegexp) => Right(Some(postCodeValidTransform(zip)))
case (Some(zip), Some("GB"), _) if zip.matches(regexPostcode) => Right(Some(postCodeValidTransform(zip)))
case (Some(_), Some("GB"), _) => Left(Seq(FormError(key, invalidKey)))
case (Some(zip), Some(_), _) if zip.length <= maxLengthNonUKPostcode => Right(Some(zip))
case (Some(_), Some(_), _) => Left(Seq(FormError(key, nonUkLengthKey)))
Expand Down
4 changes: 2 additions & 2 deletions conf/messages.en
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,8 @@ individual.phone.hint = We will only use this to contact you about pension schem
individual.phone.error.required = Enter your phone number

individual.postcode.title = Which address can we use to contact you?
individual.postcode.error.required = Enter a postcode
individual.postcode.error.invalid = Enter a postcode in the correct format.
individual.postcode.error.required = Enter the postcode
individual.postcode.error.invalid = Enter a full UK postcode

individual.addressList.error.required = Select your contact address
individual.addressList.title = Select the contact address for the individual
Expand Down

0 comments on commit 22cba53

Please sign in to comment.