Skip to content

DTR-3713: CIS MRF Business Functions F18d,18f,18g#68

Open
yanshengzhangHMRC wants to merge 6 commits intomainfrom
DTR-3713
Open

DTR-3713: CIS MRF Business Functions F18d,18f,18g#68
yanshengzhangHMRC wants to merge 6 commits intomainfrom
DTR-3713

Conversation

@yanshengzhangHMRC
Copy link
Contributor

No description provided.

@platops-pr-bot
Copy link

@platops-pr-bot
Copy link

def createMonthlyNilReturnRequestJson(payload: BuiltSubmissionPayload): JsValue =
XmlToJsonConvertor.convertXmlToJson(payload.envelope.toString) match {
case XmlConversionResult(true, Some(json), _) => json
case XmlConversionResult(false, _, Some(error)) => Json.obj("error" -> error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit test for case XmlConversionResult(false, _, Some(error))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jassalrichy , I think it's already covered in unit test below, but kindly let me know if concern persists

"return error JSON when XML conversion fails"

XmlToJsonConvertor.convertXmlToJson(payload.envelope.toString) match {
case XmlConversionResult(true, Some(json), _) => json
case XmlConversionResult(false, _, Some(error)) => Json.obj("error" -> error)
case _ => Json.obj("error" -> "unexpected conversion failure")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit test for case _

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jassalrichy , I think it's already covered in unit test below, but kindly let me know if concern persists

"return unexpected conversion failure when neither json nor error provided"

res: SubmissionResult
)(implicit hc: HeaderCarrier): Future[Result] =
validateCorrelationId(correlationId, res.meta.correlationId) match {
case Left(reason) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit test for case Left(reason)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added now

)
}
}
.recover { case ex =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit test for recover

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added now

val sent = sentRaw.trim
val ack = ackRaw.trim

if (sent.isEmpty || ack.isEmpty) Left("empty correlationId")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit test for if (sent.isEmpty || ack.isEmpty)
unit test for if (sent != ack)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We point to stubs by default in application.conf
These ports are overridden by using appplication.no.stubs.conf

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forget to deselect them in the last commit, updated now

@platops-pr-bot
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants