All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gu.zuora.soap.models.PaymentSummary.scala Maven / Gradle / Ivy

There is a newer version: 0.605
Show newest version
package com.gu.zuora.soap.models

import com.gu.i18n.Currency
import com.gu.memsub.Price
import com.gu.stripe.Stripe
import com.gu.zuora.soap.models.Queries.{InvoiceItem, PreviewInvoiceItem, Subscription}

case class PaymentSummary(current: InvoiceItem, previous: Seq[InvoiceItem], currency: Currency) {
  val totalPrice = current.price + previous.map(_.price).sum
}

object PaymentSummary {
  def apply(items: Seq[InvoiceItem], currency: Currency): PaymentSummary = {
    val sortedInvoiceItems = items.sortBy(_.chargeNumber)
    PaymentSummary(sortedInvoiceItems.last, sortedInvoiceItems.dropRight(1), currency)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy