Skip to content

Commit

Permalink
DLS-3964 Updated stub for bars check (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinharris43 authored Jul 16, 2021
1 parent e300757 commit 4190684
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ object BARSController {

case class BankDetails(sortCode: String, accountNumber: String)

case class BARSResponse(accountNumberWithSortCodeIsValid: Boolean, sortCodeIsPresentOnEISCD: String)
case class BARSResponse(accountNumberWithSortCodeIsValid: String, sortCodeIsPresentOnEISCD: String)

implicit val reads: Reads[BankDetails] = Json.reads[BankDetails]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ trait BankDetailsBehaviour {

def getBankProfile(bankDetails: BankDetails): Profile = {
val accountNumberWithSortCodeIsValid = bankDetails match {
case BankDetails(_, accountNumber) if accountNumber.startsWith("9") => Some(false)
case BankDetails(_, accountNumber) if accountNumber.startsWith("9") => Some("no")
case BankDetails(_, accountNumber) if accountNumber.startsWith("5") => None
case BankDetails(sortCode, _) if !validateSortCode(sortCode) => Some(false)
case BankDetails(_, accountNumber) if !validateAccountNumber(accountNumber) => Some(false)
case _ => Some(true)
case BankDetails(sortCode, _) if !validateSortCode(sortCode) => Some("no")
case BankDetails(_, accountNumber) if !validateAccountNumber(accountNumber) => Some("no")
case _ => Some("yes")
}

val sortCodeIsPresentOnEISCD =
Expand Down
2 changes: 1 addition & 1 deletion conf/prod.routes
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GET /hmrc-healthcheck uk.gov.hmrc.helptosavestub
GET /pay-as-you-earn/02.00.00/individuals/:nino uk.gov.hmrc.helptosavestub.controllers.PayePersonalDetailsController.getPayeDetails(nino)

# Bank Account Reputation Service (BARS)
POST /validateBankDetails uk.gov.hmrc.helptosavestub.controllers.BARSController.validateBankDetails
POST /v2/validateBankDetails uk.gov.hmrc.helptosavestub.controllers.BARSController.validateBankDetails

GET /admin/metrics com.kenshoo.play.metrics.MetricsController.metrics
-> /help-to-save-stub app.Routes
Expand Down

0 comments on commit 4190684

Please sign in to comment.