Skip to content

Instantly share code, notes, and snippets.

@mattrobertsky
Created September 12, 2018 09:45
Show Gist options
  • Save mattrobertsky/c383731007bdf51218488f67ad88830c to your computer and use it in GitHub Desktop.
Save mattrobertsky/c383731007bdf51218488f67ad88830c to your computer and use it in GitHub Desktop.
epiphany pdf check hack
def varyReturn(sdilRef: String): Action[JsValue] =
Action.async(parse.json) { implicit request =>
withJsonBody[ReturnVariationData] { data =>
Logger.info("SDIL return variation sent to DMS queue")
val page = views.html.return_variation_pdf(data, sdilRef).toString
// TODO gist this..
import sys.process._
import java.io.PrintWriter
val temp = java.io.File.createTempFile("variations", ".html")
new PrintWriter(temp) { write(page); close }
s"epiphany $temp".!
concurrent.Future.successful(NoContent)
// TODO - implement lines below
// for {
// _ <- gforms.submitToDms(page, sdilRef)
// _ <- returnSubmission.save(data, sdilRef)
// } yield NoContent
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment