Skip to content

Commit

Permalink
YTA-3164 - Retrieve Write Off Information
Browse files Browse the repository at this point in the history
  • Loading branch information
jose-puente-digital-hmrc-gov-uk committed Jan 11, 2018
1 parent 12ea7b3 commit af90612
Show file tree
Hide file tree
Showing 70 changed files with 228 additions and 113 deletions.
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/MicroserviceHelloWorld.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/config/AppContext.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/config/EpayeApiAppLoader.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/config/microserviceGlobal.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/config/microserviceWiring.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/connectors/ConnectorBase.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/connectors/EpayeConnector.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/controllers/ApiController.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/models/Formats.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/models/TaxMonth.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/models/TaxYear.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,6 +25,7 @@ case class LineItem(
charges: BigDecimal,
payments: BigDecimal,
credits: BigDecimal,
writeOffs: BigDecimal,
balance: BigDecimal,
dueDate: LocalDate,
isSpecified: Boolean = false,
Expand All @@ -36,6 +37,7 @@ case class AnnualTotal(
charges: BigDecimal,
payments: BigDecimal,
credits: BigDecimal,
writeOffs: BigDecimal,
balance: BigDecimal
)

Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/models/in/EpayeCode.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,6 +22,7 @@ case class EpayeMonthlyStatement(
charges: EpayeMonthlyCharges,
credits: EpayeMonthlyCredits,
payments: EpayeMonthlyPaymentDetails,
writeOffs: EpayeMonthlyChargesDetails,
hasSpecifiedCharges: Boolean,
balance: EpayeMonthlyBalance
)
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/models/in/EpayeReads.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/models/in/EpayeResponse.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/models/in/EpayeTaxMonth.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
23 changes: 12 additions & 11 deletions app/uk/gov/hmrc/epayeapi/models/out/AnnualStatementJson.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,6 +28,7 @@ case class NonRtiChargesJson(
amount: BigDecimal,
clearedByCredits: BigDecimal,
clearedByPayments: BigDecimal,
clearedByWriteOffs: BigDecimal,
balance: BigDecimal,
dueDate: LocalDate
)
Expand All @@ -41,21 +42,18 @@ object NonRtiChargesJson {
amount = lineItem.charges,
clearedByCredits = lineItem.credits,
clearedByPayments = lineItem.payments,
clearedByWriteOffs = lineItem.writeOffs,
balance = lineItem.balance,
dueDate = lineItem.dueDate
)
}
}

case class PaymentsAndCreditsJson(
payments: BigDecimal,
credits: BigDecimal
)

case class EarlierYearUpdateJson(
amount: BigDecimal,
clearedByCredits: BigDecimal,
clearedByPayments: BigDecimal,
clearedByWriteOffs: BigDecimal,
balance: BigDecimal,
dueDate: LocalDate
)
Expand All @@ -66,11 +64,12 @@ object EarlierYearUpdateJson {
.find(_.itemType.contains("eyu"))
.map { lineItem =>
EarlierYearUpdateJson(
lineItem.charges,
lineItem.credits,
lineItem.payments,
lineItem.balance,
lineItem.dueDate
amount = lineItem.charges,
clearedByCredits = lineItem.credits,
clearedByPayments = lineItem.payments,
clearedByWriteOffs = lineItem.writeOffs,
balance = lineItem.balance,
dueDate = lineItem.dueDate
)
}
}
Expand All @@ -86,6 +85,7 @@ case class MonthlyChargesJson(
amount: BigDecimal,
clearedByCredits: BigDecimal,
clearedByPayments: BigDecimal,
clearedByWriteOffs: BigDecimal,
balance: BigDecimal,
dueDate: LocalDate,
isSpecified: Boolean,
Expand All @@ -103,6 +103,7 @@ object MonthlyChargesJson {
amount = lineItem.charges,
clearedByCredits = lineItem.credits,
clearedByPayments = lineItem.payments,
clearedByWriteOffs = lineItem.writeOffs,
balance = lineItem.balance,
dueDate = lineItem.dueDate,
isSpecified = lineItem.isSpecified,
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/models/out/ApiErrorJson.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/models/out/EmpRefsJson.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
3 changes: 1 addition & 2 deletions app/uk/gov/hmrc/epayeapi/models/out/JsonWrites.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -58,7 +58,6 @@ trait JsonWrites {
implicit lazy val selfLinkWrites: Writes[SelfLink] = writes[SelfLink]
implicit lazy val monthlyChargesJsonWrites: Writes[MonthlyChargesJson] = writes[MonthlyChargesJson]
implicit lazy val embeddedRtiChargesJsonWrites: Writes[EmbeddedRtiChargesJson] = writes[EmbeddedRtiChargesJson]
implicit lazy val paymentsAndCreditsJsonWrites: Writes[PaymentsAndCreditsJson] = writes[PaymentsAndCreditsJson]
implicit lazy val earlierYearUpdateJsonWrites: Writes[EarlierYearUpdateJson] = writes[EarlierYearUpdateJson]
implicit lazy val periodJsonWrites: Writes[PeriodJson] = writes[PeriodJson]
implicit lazy val nonRtiChargesJsonWrites: Writes[NonRtiChargesJson] = writes[NonRtiChargesJson]
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/models/out/Link.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
18 changes: 11 additions & 7 deletions app/uk/gov/hmrc/epayeapi/models/out/MonthlyStatementJson.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,7 +30,8 @@ case class MonthlyStatementJson(
interest: Seq[ChargeJson],
allocatedCredits: Seq[ChargeJson],
allocatedPayments: Seq[PaymentJson],
dueDate: LocalDate,
writeOffs: Seq[ChargeJson],
dueDate: LocalDate,
summary: MonthlySummaryJson,
_links: MonthlyStatementLinksJson
)
Expand All @@ -50,6 +51,7 @@ case class MonthlySummaryJson(
interest: BigDecimal,
clearedByCredits: BigDecimal,
clearedByPayments: BigDecimal,
clearedByWriteOffs: BigDecimal,
balance: BigDecimal
)

Expand All @@ -73,6 +75,7 @@ object MonthlyStatementJson {
interest = if (json.charges.others == 0) Seq.empty else Seq(ChargeJson("INTEREST", json.charges.others)),
allocatedCredits = Charges(json.credits.fps) ++ Charges(json.credits.cis) ++ Charges(json.credits.eps),
allocatedPayments = Payments(json.payments),
writeOffs = Charges(json.writeOffs),
dueDate = json.balance.dueDate,
summary = MonthlySummaryJson(json),
_links = MonthlyStatementLinksJson(apiBaseUrl, empRef, taxYear, taxMonth)
Expand Down Expand Up @@ -102,11 +105,12 @@ object PaymentJson {
object MonthlySummaryJson {
def apply(json: EpayeMonthlyStatement): MonthlySummaryJson =
MonthlySummaryJson(
json.charges.total - json.charges.others,
json.charges.others,
json.credits.total,
json.payments.total,
json.balance.total
amount = json.charges.total - json.charges.others,
interest = json.charges.others,
clearedByCredits = json.credits.total,
clearedByPayments = json.payments.total,
clearedByWriteOffs = json.writeOffs.total,
balance = json.balance.total
)
}

Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/models/out/SummaryJson.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/modules/AppModule.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/router/ApiRouter.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/router/RoutesProvider.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app/uk/gov/hmrc/epayeapi/syntax/JsonOps.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 HM Revenue & Customs
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion conf/application.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017 HM Revenue & Customs
# Copyright 2018 HM Revenue & Customs
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit af90612

Please sign in to comment.