Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MISUV-8829 Refactor FinancialDetailsConnector to use HttpClientV2 #2671

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
277 changes: 142 additions & 135 deletions app/connectors/FinancialDetailsConnector.scala

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions app/models/financialDetails/PaymentsResponse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ case class Payments(payments: Seq[Payment]) extends PaymentsResponse

case class PaymentsError(status: Int, error: String) extends PaymentsResponse

object Payments {
implicit val format: Format[Payments] = Json.format[Payments]
}

sealed trait PaymentAllocationStatus

case object FullyAllocatedPaymentStatus extends PaymentAllocationStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@
package models.paymentAllocationCharges

import models.financialDetails.{DocumentDetail, FinancialDetail}
import models.{readNullableList}
import play.api.libs.json.{Json, OWrites, Reads, __}
import models.readNullableList
import play.api.libs.functional.syntax._
import play.api.libs.json.{Json, OWrites, Reads, __}

sealed trait FinancialDetailsWithDocumentDetailsResponse


case class FinancialDetailsWithDocumentDetailsModel(documentDetails: List[DocumentDetail],
financialDetails: List[FinancialDetail]) extends FinancialDetailsWithDocumentDetailsResponse {
case class FinancialDetailsWithDocumentDetailsModel(
documentDetails: List[DocumentDetail],
financialDetails: List[FinancialDetail]
) extends FinancialDetailsWithDocumentDetailsResponse {

val filteredDocumentDetails = documentDetails.filter(_.paymentLot == financialDetails.head.items.get.head.paymentLot)
.filter(_.paymentLotItem == financialDetails.head.items.get.head.paymentLotItem)
Expand All @@ -39,7 +41,7 @@ object FinancialDetailsWithDocumentDetailsModel {
implicit val reads: Reads[FinancialDetailsWithDocumentDetailsModel] = (
readNullableList[DocumentDetail](__ \ "documentDetails") and
readNullableList[FinancialDetail](__ \ "financialDetails")
) (FinancialDetailsWithDocumentDetailsModel.apply _)
)(FinancialDetailsWithDocumentDetailsModel.apply _)
}

case class FinancialDetailsWithDocumentDetailsErrorModel(code: Int, message: String) extends FinancialDetailsWithDocumentDetailsResponse
13 changes: 8 additions & 5 deletions app/models/paymentAllocations/PaymentAllocationsResponse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@
package models.paymentAllocations

import play.api.libs.json.{Format, Json}

import java.time.LocalDate

sealed trait PaymentAllocationsResponse

case class PaymentAllocations(amount: Option[BigDecimal],
method: Option[String],
transactionDate: Option[LocalDate],
reference: Option[String],
allocations: Seq[AllocationDetail]) extends PaymentAllocationsResponse
case class PaymentAllocations(
amount: Option[BigDecimal],
method: Option[String],
transactionDate: Option[LocalDate],
reference: Option[String],
allocations: Seq[AllocationDetail]
) extends PaymentAllocationsResponse


object PaymentAllocations {
Expand Down
2 changes: 1 addition & 1 deletion app/utils/Headers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object Headers {
kv.map(k => (k, suffix)).toMap
).getOrElse(Map[String, String]())
val urlPathArray = requestPath.split('/')
val actionPath = if(urlPathArray.isEmpty) "" else urlPathArray.last
val actionPath = if (urlPathArray.isEmpty) "" else urlPathArray.last
val updatedHeader = page.get(actionPath) match {
case Some(data) => "Gov-Test-Scenario" -> data
case _ => "Gov-Test-Scenario" -> ""
Expand Down
Loading