Skip to content

Commit

Permalink
SASS-11099 - Added logging to annual submissions
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-oppong-beduh committed Feb 14, 2025
1 parent 4c22fed commit 8c10be3
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/services/PropertyService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,22 @@ class PropertyService @Inject() (
}

def getPropertyAnnualSubmission(taxYear: TaxYear, taxableEntityId: Nino, incomeSourceId: IncomeSourceId)(implicit
hc: HeaderCarrier
hc: HeaderCarrier
): ITPEnvelope[PropertyAnnualSubmission] =
EitherT(connector.getPropertyAnnualSubmission(taxYear, taxableEntityId, incomeSourceId))
.leftMap(error => ApiServiceError(error.status))
.map(pas => {
logger.debug(s"[getAnnualSubmission] Annual submission details: $pas")
pas
})
.leftMap(error => {
logger.debug(s"[getAnnualSubmission] Annual submission details error")
ApiServiceError(error.status)
})
.subflatMap { annualSubmission =>
annualSubmission.fold[Either[ServiceError, PropertyAnnualSubmission]](
annualSubmission.fold[Either[ServiceError, PropertyAnnualSubmission]]{
logger.debug(s"[getAnnualSubmission] Annual submission details not found")
DataNotFoundError.asLeft[PropertyAnnualSubmission]
)(_.asRight[ServiceError])
}(_.asRight[ServiceError])
}

def deletePropertyAnnualSubmission(incomeSourceId: IncomeSourceId, taxableEntityId: Nino, taxYear: TaxYear)(implicit
Expand Down

0 comments on commit 8c10be3

Please sign in to comment.