Skip to content

Commit c2de9fd

Browse files
committed
MTDSA-30457 removed VOLUNTARY_CLASS2_CANNOT_BE_CHANGED error
1 parent dc6ed19 commit c2de9fd

12 files changed

+37
-23
lines changed

app/v1/services/DeleteDisclosuresService.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class DeleteDisclosuresService @Inject() (connector: DeleteDisclosuresConnector)
4141
"INVALID_TAX_YEAR" -> TaxYearFormatError,
4242
"INVALID_CORRELATIONID" -> InternalError,
4343
"NO_DATA_FOUND" -> NotFoundError,
44-
"VOLUNTARY_CLASS2_CANNOT_BE_CHANGED" -> RuleVoluntaryClass2CannotBeChangedError,
4544
"SERVER_ERROR" -> InternalError,
4645
"SERVICE_UNAVAILABLE" -> InternalError
4746
)

app/v2/services/DeleteDisclosuresService.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class DeleteDisclosuresService @Inject() (connector: DeleteDisclosuresConnector)
4141
"INVALID_TAX_YEAR" -> TaxYearFormatError,
4242
"INVALID_CORRELATIONID" -> InternalError,
4343
"NO_DATA_FOUND" -> NotFoundError,
44-
"VOLUNTARY_CLASS2_CANNOT_BE_CHANGED" -> RuleVoluntaryClass2CannotBeChangedError,
4544
"OUTSIDE_AMENDMENT_WINDOW" -> RuleOutsideAmendmentWindowError,
4645
"SERVER_ERROR" -> InternalError,
4746
"SERVICE_UNAVAILABLE" -> InternalError

it/test/v1/DeleteDisclosuresControllerIfsISpec.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ class DeleteDisclosuresControllerIfsISpec extends IntegrationBaseSpec {
131131
(BAD_REQUEST, "INVALID_TAX_YEAR", BAD_REQUEST, TaxYearFormatError),
132132
(BAD_REQUEST, "INVALID_CORRELATIONID", INTERNAL_SERVER_ERROR, errors.InternalError),
133133
(NOT_FOUND, "NO_DATA_FOUND", NOT_FOUND, NotFoundError),
134-
(UNPROCESSABLE_ENTITY, "VOLUNTARY_CLASS2_CANNOT_BE_CHANGED", BAD_REQUEST, RuleVoluntaryClass2CannotBeChangedError),
135134
(INTERNAL_SERVER_ERROR, "SERVER_ERROR", INTERNAL_SERVER_ERROR, errors.InternalError),
136135
(SERVICE_UNAVAILABLE, "SERVICE_UNAVAILABLE", INTERNAL_SERVER_ERROR, errors.InternalError)
137136
)

it/test/v2/DeleteDisclosuresControllerHipISpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package v2
1818

19-
import api.models.errors.{MtdError, NinoFormatError, NotFoundError, RuleOutsideAmendmentWindow, RuleTaxYearNotSupportedError, RuleTaxYearRangeInvalidError, TaxYearFormatError}
19+
import api.models.errors.{MtdError, NinoFormatError, NotFoundError, RuleOutsideAmendmentWindowError, RuleTaxYearNotSupportedError, RuleTaxYearRangeInvalidError, TaxYearFormatError}
2020
import api.services.{AuditStub, AuthStub, DownstreamStub, MtdIdLookupStub}
2121
import api.support.IntegrationBaseSpec
2222
import com.github.tomakehurst.wiremock.stubbing.StubMapping
@@ -128,7 +128,7 @@ class DeleteDisclosuresControllerHipISpec extends IntegrationBaseSpec {
128128
(BAD_REQUEST, "1215", BAD_REQUEST, NinoFormatError),
129129
(BAD_REQUEST, "1117", BAD_REQUEST, TaxYearFormatError),
130130
(NOT_FOUND, "5010", NOT_FOUND, NotFoundError),
131-
(UNPROCESSABLE_ENTITY, "4200", BAD_REQUEST, RuleOutsideAmendmentWindow),
131+
(UNPROCESSABLE_ENTITY, "4200", BAD_REQUEST, RuleOutsideAmendmentWindowError),
132132
(UNPROCESSABLE_ENTITY, "5000", BAD_REQUEST, RuleTaxYearNotSupportedError)
133133
)
134134
input.foreach(args => (serviceErrorTest _).tupled(args))

it/test/v2/DeleteDisclosuresControllerIfsISpec.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ class DeleteDisclosuresControllerIfsISpec extends IntegrationBaseSpec {
131131
(BAD_REQUEST, "INVALID_TAX_YEAR", BAD_REQUEST, TaxYearFormatError),
132132
(BAD_REQUEST, "INVALID_CORRELATIONID", INTERNAL_SERVER_ERROR, errors.InternalError),
133133
(NOT_FOUND, "NO_DATA_FOUND", NOT_FOUND, NotFoundError),
134-
(UNPROCESSABLE_ENTITY, "VOLUNTARY_CLASS2_CANNOT_BE_CHANGED", BAD_REQUEST, RuleVoluntaryClass2CannotBeChangedError),
135134
(UNPROCESSABLE_ENTITY, "OUTSIDE_AMENDMENT_WINDOW", BAD_REQUEST, RuleOutsideAmendmentWindowError),
136135
(INTERNAL_SERVER_ERROR, "SERVER_ERROR", INTERNAL_SERVER_ERROR, errors.InternalError),
137136
(SERVICE_UNAVAILABLE, "SERVICE_UNAVAILABLE", INTERNAL_SERVER_ERROR, errors.InternalError)

resources/public/api/conf/1.0/delete.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ description: |
88
99
| Header Value (Gov-Test-Scenario) | Scenario |
1010
|---------------------------------------|------------------------------------------------------------------------|
11-
| N/A - DEFAULT | Simulates success response. |
12-
| VOLUNTARY_CLASS2_CANNOT_BE_CHANGED | Simulates the scenario where Voluntary Class 2 NICs cannot be changed. |
11+
| N/A - DEFAULT | Simulates success response. |
1312
| NOT_FOUND | Simulates the scenario where no data is found. |
1413
| STATEFUL | Performs a stateful delete. |
1514
@@ -48,8 +47,6 @@ responses:
4847
$ref: './common/errors.yaml#/components/examples/ruleTaxYearNotSupported'
4948
RULE_TAX_YEAR_RANGE_INVALID:
5049
$ref: './common/errors.yaml#/components/examples/ruleTaxYearRangeInvalid'
51-
RULE_VOLUNTARY_CLASS2_CANNOT_BE_CHANGED:
52-
$ref: './common/errors.yaml#/components/examples/voluntaryClass2CannotBeChanged'
5350
RULE_INCORRECT_GOV_TEST_SCENARIO:
5451
$ref: './common/errors.yaml#/components/examples/ruleIncorrectGovTestScenario'
5552

resources/public/api/conf/2.0/delete.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ description: |
88
99
| Header Value (Gov-Test-Scenario) | Scenario |
1010
|---------------------------------------|-------------------------------------------------------------------------------------------------|
11-
| N/A - DEFAULT | Simulates success response. |
12-
| VOLUNTARY_CLASS2_CANNOT_BE_CHANGED | Simulates the scenario where Voluntary Class 2 NICs cannot be changed. |
11+
| N/A - DEFAULT | Simulates success response. |
1312
| NOT_FOUND | Simulates the scenario where no data is found. |
1413
| STATEFUL | Performs a stateful delete. |
1514
| OUTSIDE_AMENDMENT_WINDOW | Simulates the scenario where request cannot be completed as it is outside the amendment window. |
@@ -49,8 +48,6 @@ responses:
4948
$ref: './common/errors.yaml#/components/examples/ruleTaxYearNotSupported'
5049
RULE_TAX_YEAR_RANGE_INVALID:
5150
$ref: './common/errors.yaml#/components/examples/ruleTaxYearRangeInvalid'
52-
RULE_VOLUNTARY_CLASS2_CANNOT_BE_CHANGED:
53-
$ref: './common/errors.yaml#/components/examples/voluntaryClass2CannotBeChanged'
5451
RULE_OUTSIDE_AMENDMENT_WINDOW:
5552
$ref: './common/errors.yaml#/components/examples/ruleOutsideAmendmentWindow'
5653
RULE_INCORRECT_GOV_TEST_SCENARIO:

test/api/connectors/ConnectorSpec.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import com.google.common.base.Charsets
2020
import config.MockAppConfig
2121
import mocks.MockHttpClient
2222
import org.scalamock.handlers.CallHandler
23-
import play.api.Configuration
2423
import play.api.http.{HeaderNames, MimeTypes, Status}
2524
import play.api.libs.json.{Json, Writes}
2625
import support.UnitSpec
@@ -119,7 +118,6 @@ trait ConnectorSpec extends UnitSpec with Status with MimeTypes with HeaderNames
119118
"CorrelationId" -> correlationId,
120119
"Gov-Test-Scenario" -> "DEFAULT"
121120
)
122-
MockedAppConfig.featureSwitches returns Configuration("ifs_hip_migration_1640.enabled" -> false)
123121
MockedAppConfig.ifs1BaseUrl returns this.baseUrl
124122
MockedAppConfig.ifs1Token returns "ifs1-token"
125123
MockedAppConfig.ifs1Env returns "ifs1-environment"
@@ -157,7 +155,6 @@ trait ConnectorSpec extends UnitSpec with Status with MimeTypes with HeaderNames
157155
"CorrelationId" -> correlationId,
158156
"Gov-Test-Scenario" -> "DEFAULT"
159157
)
160-
MockedAppConfig.featureSwitches returns Configuration("ifs_hip_migration_1640.enabled" -> true)
161158
MockedAppConfig.hipBaseUrl returns this.baseUrl
162159
MockedAppConfig.hipEnv returns "hip-environment"
163160
MockedAppConfig.hipClientId returns clientId

test/v1/connectors/DeleteDisclosuresConnectorSpec.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import api.connectors.ConnectorSpec
2020
import api.models.domain.{Nino, TaxYear}
2121
import api.models.errors._
2222
import api.models.outcomes.ResponseWrapper
23+
import play.api.Configuration
2324
import uk.gov.hmrc.http.StringContextOps
2425
import v1.models.request.delete.DeleteDisclosuresRequestData
2526

@@ -32,13 +33,15 @@ class DeleteDisclosuresConnectorSpec extends ConnectorSpec {
3233
"DeleteDisclosuresConnector" when {
3334
"a valid request is supplied" should {
3435
"return a successful response with the correct correlationId using IFS" in new Ifs1Test with Test {
36+
MockedAppConfig.featureSwitches returns Configuration("ifs_hip_migration_1640.enabled" -> false)
3537
val expected: Right[Nothing, ResponseWrapper[Unit]] = Right(ResponseWrapper(correlationId, ()))
3638

3739
willDelete(url"$baseUrl/income-tax/disclosures/$nino/$taxYear").returns(Future.successful(expected))
3840

3941
await(connector.deleteDisclosures(request)) shouldBe expected
4042
}
4143
"return a successful response with the correct correlationId using HIP" in new HipTest with Test {
44+
MockedAppConfig.featureSwitches returns Configuration("ifs_hip_migration_1640.enabled" -> true)
4245
val expected: Right[Nothing, ResponseWrapper[Unit]] = Right(ResponseWrapper(correlationId, ()))
4346

4447
willDelete(url"$baseUrl/itsd/disclosures/$nino/$taxYear").returns(Future.successful(expected))
@@ -49,13 +52,15 @@ class DeleteDisclosuresConnectorSpec extends ConnectorSpec {
4952

5053
"a request returning a single error" should {
5154
"return an unsuccessful response with the correct correlationId and a single error using IFS" in new Ifs1Test with Test {
55+
MockedAppConfig.featureSwitches returns Configuration("ifs_hip_migration_1640.enabled" -> false)
5256
val expected: Left[ResponseWrapper[NinoFormatError.type], Nothing] = Left(ResponseWrapper(correlationId, NinoFormatError))
5357

5458
willDelete(url"$baseUrl/income-tax/disclosures/$nino/$taxYear").returns(Future.successful(expected))
5559

5660
await(connector.deleteDisclosures(request)) shouldBe expected
5761
}
5862
"return an unsuccessful response with the correct correlationId and a single error using HIP" in new HipTest with Test {
63+
MockedAppConfig.featureSwitches returns Configuration("ifs_hip_migration_1640.enabled" -> true)
5964
val expected: Left[ResponseWrapper[NinoFormatError.type], Nothing] = Left(ResponseWrapper(correlationId, NinoFormatError))
6065

6166
willDelete(url"$baseUrl/itsd/disclosures/$nino/$taxYear").returns(Future.successful(expected))
@@ -66,6 +71,7 @@ class DeleteDisclosuresConnectorSpec extends ConnectorSpec {
6671

6772
"a request returning multiple errors" should {
6873
"return an unsuccessful response with the correct correlationId and multiple errors using IFS" in new Ifs1Test with Test {
74+
MockedAppConfig.featureSwitches returns Configuration("ifs_hip_migration_1640.enabled" -> false)
6975
val expected: Left[ResponseWrapper[Seq[MtdError]], Nothing] =
7076
Left(ResponseWrapper(correlationId, Seq(NinoFormatError, InternalError, TaxYearFormatError)))
7177

@@ -74,6 +80,7 @@ class DeleteDisclosuresConnectorSpec extends ConnectorSpec {
7480
await(connector.deleteDisclosures(request)) shouldBe expected
7581
}
7682
"return an unsuccessful response with the correct correlationId and multiple errors using HIP" in new HipTest with Test {
83+
MockedAppConfig.featureSwitches returns Configuration("ifs_hip_migration_1640.enabled" -> true)
7784
val expected: Left[ResponseWrapper[Seq[MtdError]], Nothing] =
7885
Left(ResponseWrapper(correlationId, Seq(NinoFormatError, InternalError, TaxYearFormatError)))
7986

test/v1/services/DeleteDisclosuresServiceSpec.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,23 @@ class DeleteDisclosuresServiceSpec extends ServiceSpec {
6464
await(service.delete(request)) shouldBe Left(ErrorWrapper(correlationId, error))
6565
}
6666

67-
val input = Seq(
67+
val ifsInput = Seq(
6868
("INVALID_TAXABLE_ENTITY_ID", NinoFormatError),
6969
("INVALID_TAX_YEAR", TaxYearFormatError),
7070
("INVALID_CORRELATIONID", InternalError),
7171
("NO_DATA_FOUND", NotFoundError),
72-
("VOLUNTARY_CLASS2_CANNOT_BE_CHANGED", RuleVoluntaryClass2CannotBeChangedError),
7372
("SERVER_ERROR", InternalError),
7473
("SERVICE_UNAVAILABLE", InternalError)
7574
)
7675

77-
input.foreach(args => (serviceError _).tupled(args))
76+
val hipInput = Seq(
77+
("1215", NinoFormatError),
78+
("1117", TaxYearFormatError),
79+
("5010", NotFoundError),
80+
("5000", RuleTaxYearNotSupportedError)
81+
)
82+
83+
(ifsInput ++ hipInput).foreach(args => (serviceError _).tupled(args))
7884
}
7985
}
8086

0 commit comments

Comments
 (0)