in src/main/scala/com/gu/invoicing/refund/Impl.scala [69:82]
def getRefundStatus(refundId: String): String =
get[Refund](s"$zuoraApiHost/v1/object/refund/$refundId").Status
def netAdjustmentsByInvoiceItemId(
adjustments: List[InvoiceItemAdjustment],
): Map[String, BigDecimal] = {
adjustments
.groupBy(_.SourceId)
.map { case (invoiceItemId, adjustments) =>
val netCredits = adjustments.filter(_.Type == "Credit").map(_.Amount).sum
val netCharges = adjustments.filter(_.Type == "Charge").map(_.Amount).sum
(invoiceItemId, netCredits - netCharges)
}
}