Skip to content

Commit

Permalink
Merge pull request #7 from hmrc/APSR-903
Browse files Browse the repository at this point in the history
APSR-903 adding IV override for individuals
  • Loading branch information
lburgos authored Nov 29, 2018
2 parents eedd47f + 4ae8959 commit 626328e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/uk/gov/hmrc/models/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,13 @@ case class GrantWithoutConsent(scopes: Set[String]) extends OverrideFlag {
val overrideType = OverrideType.GRANT_WITHOUT_TAXPAYER_CONSENT
}

object OverrideType extends Enumeration {
val PERSIST_LOGIN_AFTER_GRANT, GRANT_WITHOUT_TAXPAYER_CONSENT, SUPPRESS_IV_FOR_AGENTS, SUPPRESS_IV_FOR_ORGANISATIONS = Value
case class SuppressIvForIndividuals() extends OverrideFlag {
val overrideType = OverrideType.SUPPRESS_IV_FOR_INDIVIDUALS
}

object OverrideType extends Enumeration {
val PERSIST_LOGIN_AFTER_GRANT, GRANT_WITHOUT_TAXPAYER_CONSENT, SUPPRESS_IV_FOR_AGENTS, SUPPRESS_IV_FOR_ORGANISATIONS, SUPPRESS_IV_FOR_INDIVIDUALS = Value
}

case class ApplicationWithUpliftRequest(id: UUID,
name: String,
Expand Down
4 changes: 4 additions & 0 deletions app/uk/gov/hmrc/models/JsonFormatters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ object JsonFormatters {
Writes { _ => Json.obj() })
private implicit val formatSuppressIvForAgents = Json.format[SuppressIvForAgents]
private implicit val formatSuppressIvForOrganisations = Json.format[SuppressIvForOrganisations]
private implicit val formatSuppressIvForIndividuals = Format[SuppressIvForIndividuals](
Reads { _ => JsSuccess(SuppressIvForIndividuals()) },
Writes { _ => Json.obj() })

implicit val formatOverride = Union.from[OverrideFlag]("overrideType")
.and[GrantWithoutConsent](GRANT_WITHOUT_TAXPAYER_CONSENT.toString)
.and[PersistLogin](PERSIST_LOGIN_AFTER_GRANT.toString)
.and[SuppressIvForAgents](SUPPRESS_IV_FOR_AGENTS.toString)
.and[SuppressIvForOrganisations](SUPPRESS_IV_FOR_ORGANISATIONS.toString)
.and[SuppressIvForIndividuals](SUPPRESS_IV_FOR_INDIVIDUALS.toString)
.format

implicit val formatTotp = Json.format[TOTP]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class ThirdPartyApplicationComponentSpec extends BaseFeatureSpec {

Given("A third party application")
val originalOverrides: Set[OverrideFlag] = Set(PersistLogin(), GrantWithoutConsent(Set("scope")),
SuppressIvForAgents(Set("scope")), SuppressIvForOrganisations(Set("scope")))
SuppressIvForAgents(Set("scope")), SuppressIvForOrganisations(Set("scope")), SuppressIvForIndividuals())
val application = createApplication(access = standardAccess.copy(overrides = originalOverrides))
When("I request to update the application")
val newApplicationName = "My Renamed Application"
Expand Down

0 comments on commit 626328e

Please sign in to comment.