Skip to content

Commit

Permalink
Merge pull request #66 from hmrc/MTDSA-1418
Browse files Browse the repository at this point in the history
MTDSA-1418 Unexpected http status code (201) when sending VAT submission
  • Loading branch information
yenkee-hmrc authored Mar 1, 2018
2 parents ecb0f15 + df6f15f commit 9c0f6f8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/uk/gov/hmrc/vatapi/resources/VatReturnsResource.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ object VatReturnsResource extends BaseController {
_ <- audit(SubmitVatReturnEvent(vrn, response))
} yield response
} onSuccess { response =>
response.filter { case 200 => Created(Json.toJson(response.vatReturnOrError.toOption)) }
response.filter { case 200 => response.jsonOrError match {
case Right(vatReturn) => Created(Json.toJson(vatReturn))} }
}
}

Expand Down
8 changes: 7 additions & 1 deletion func/uk/gov/hmrc/support/BaseFunctionalSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,13 @@ trait BaseFunctionalSpec extends TestApplication {
.willReturn(
aResponse()
.withStatus(200)
.withBody("[]")
.withBody(s"""
|{
| "processingDate": "2018-03-01T11:43:43.195Z",
| "paymentIndicator": "BANK",
| "formBundleNumber": "891713832155"
|}
""".stripMargin)
)
)
givens
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class ValueAddedTaxReturnsSpec extends BaseFunctionalSpec {
.post(s"/$vrn/returns", Some(Json.parse(body())))
.thenAssertThat()
.statusIs(201)
.bodyHasPath("\\paymentIndicator", "BANK")
.bodyHasPath("\\processingDate", "2018-03-01T11:43:43.195Z")
.bodyHasPath("\\formBundleNumber", "891713832155")
}

"not allow users to submit undeclared VAT returns" in {
Expand Down
2 changes: 1 addition & 1 deletion public/api/conf/1.0/application.raml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ traits:
type: !include schemas/VatReturnDeclaration.json
example: !include examples/VatReturnDeclaration.json
responses:
200:
201:
headers:
X-CorrelationId:
example: 5968c22d620000620096db5f
Expand Down

0 comments on commit 9c0f6f8

Please sign in to comment.