in src/main/scala/com/gu/invoicing/refundErroneousPayment/Program.scala [31:41]
def processRefund(comment: String)(payment: Payment): RefundData = {
payment.paidInvoices match {
case paidInvoice :: Nil =>
val refundId = createRefundObject(payment.amount, payment.id, comment)
assert(getRefundStatus(refundId) == "Processed", "Refund hasn't been processed")
applyCreditBalance(paidInvoice.invoiceNumber, payment.amount, comment)
RefundData(paidInvoice.invoiceNumber, payment.amount, payment.id, refundId)
case _ =>
throw new AssertionError("assertion failed: Payment is for multiple invoices")
}
}