Skip to content

Instantly share code, notes, and snippets.

@ryandavidhartman
Created June 4, 2015 03:11
Show Gist options
  • Save ryandavidhartman/3099c64896e5d486f99e to your computer and use it in GitHub Desktop.
Save ryandavidhartman/3099c64896e5d486f99e to your computer and use it in GitHub Desktop.
Scala Question
case class StoreViewSummaryResponse(
invoiceData: Iterable[(Invoice, ServiceProvider, Address, ContactInformationData, Sku, Option[String])],
orderTotal: org.joda.money.Money)
lazy val viewSummary: Service[StoreViewSummaryRequest, StoreViewSummaryResponse] = monitored {
//get data from db as Iterables[T]
invoice, serviceProviders primaryAddresses, transactionIds
// get from remote server (returns a list of Future[Sku] )
val shopSkus = skuIds map shopSkuAdapter.getSkuFromShop
val orderTotal = Money.of(CurrencyUnit.USD, 12.99)
Future.sequence(shopSkus) map (skus => StoreViewSummaryResponse(
ZipHelpers.zipped6(
invoices,
seerviceProviders,
primaryAddresses,
primaryContactInformations.map(_.get.contactInformationData),
skus,
transactionIds),
orderTotal))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment