This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| S.functionLifespan(true) { | |
| pf(toMatch)() match { | |
| case Full(v) => | |
| (true, Full(LiftRules.convertResponse((liftSession.checkRedirect(v), Nil, | |
| S.responseCookies, req)))) | |
| case Empty => | |
| (true, LiftRules.notFoundOrIgnore(req, Full(liftSession))) | |
| case f: Failure => | |
| (true, Full(liftSession.checkRedirect(req.createNotFound(f)))) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override def processPDT(r: Req)(): Box[LiftResponse] = { | |
| val ret = for (tx <- r.param("tx").or(Failure("parameter tx missing in PayPal PDT call")); | |
| val y = logger.debug("calling PaypalDataTransfer with paypayAuthToken: " + paypalAuthToken + | |
| ",tx: " + tx + ", mode: " + mode + ", connection: " + connection); | |
| val resp = PaypalDataTransfer(paypalAuthToken, tx, mode, connection); | |
| info <- resp.paypalInfo.or(Failure("Paypal Info not available. PaypalDataTransfer returned: " + | |
| resp)); | |
| redir <- tryo(pdtResponse(info, r))) yield { | |
| redir | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override def processPDT(r: Req)(): Box[LiftResponse] = { | |
| for (tx <- r.param("tx").or(Failure("parameter tx missing in PayPal PDT call")); | |
| val resp = PaypalDataTransfer(paypalAuthToken, tx, mode, connection); | |
| info <- resp.paypalInfo.or(Failure("Paypal Info not available. PaypalDataTransfer returned: " + | |
| resp)); | |
| redir <- tryo(pdtResponse(info, r))) yield { | |
| redir | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| S.functionLifespan(true) { | |
| pf(toMatch)() match { | |
| ... | |
| case f: Failure => | |
| (true, Full(liftSession.checkRedirect(req.createNotFound(f)))) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def createNotFound(f: Failure): LiftResponse = | |
| NamedPF((this, Full(f)), LiftRules.uriNotFound.toList) match { | |
| case DefaultNotFound => Req.defaultCreateNotFound(this) | |
| case NotFoundAsTemplate(path) => notFoundViaTemplate(path) | |
| case NotFoundAsResponse(resp) => resp | |
| case NotFoundAsNode(node) => LiftRules.convertResponse((node, 404), | |
| S.getHeaders(LiftRules.defaultHeaders((node, this))), | |
| S.responseCookies, | |
| this) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object PaypalTransactionStatus extends Enumeration { | |
| val CancelledReversalPayment = Value(1, "Cancelled_Reversal") | |
| val ClearedPayment = Value(2, "Cleared") | |
| val CompletedPayment = Value(3, "Completed") | |
| val DeniedPayment = Value(4, "Denied") | |
| val ExpiredPayment = Value(5, "Expired") | |
| val FailedPayment = Value(6, "Failed") | |
| val PendingPayment = Value(7, "Pending") | |
| val RefundedPayment = Value(8, "Refunded") | |
| val ReturnedPayment = Value(9, "Returned") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def buynow(xhtml: NodeSeq): NodeSeq = | |
| <form name="_xclick" | |
| action={PaypalRules.connection.vend().protocol+"://"+PaypalRules.mode.vend().domain+"/cgi-bin/webscr"} | |
| method="post"> | |
| <input type="hidden" name="cmd" value="_xclick" /> | |
| <input type="hidden" name="amount" value={amount.toString} /> | |
| <input type="hidden" name="currency_code" value={PaypalRules.currency.vend()} /> | |
| { values.-("amount","currency_code","cmd","submit") | |
| .map(x => <input type="hidden" name={x._1} value={x._2} />) } | |
| <input type="image" src={PaypalRules.button.vend()} name="submit" alt="" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val contextPath = LiftRules.context match { | |
| case c: HTTPServletContext => Full(c.path) | |
| case _ => Empty | |
| } | |
| info("Context Path is: " + contextPath ) | |
| val jettyResourceDir = Box.!!(System.getProperty("jetty.resource.dir")) | |
| info("got jetty.resource.dir from system properties: " + jettyResourceDir) | |
| val whereToLook = jettyResourceDir.flatMap( dir => { | |
| contextPath.map( cp => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val contextPath = LiftRules.context match { | |
| case c: HTTPServletContext => Full(c.path) | |
| case _ => Empty | |
| } | |
| info("Context Path is: " + contextPath ) | |
| val jettyResourceDir = Box.!!(System.getProperty("jetty.resource.dir")) | |
| info("got jetty.resource.dir from system properties: " + jettyResourceDir) | |
| val whereToLook = jettyResourceDir.flatMap( dir => { | |
| contextPath.map( cp => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def signupMailBody(user: User, validationLink: String): Elem = { | |
| val templatePath = List("user", "signupmailbody") | |
| val template = Templates.findRawTemplate(templatePath, S.locale) | |
| template.map(t => { | |
| val out = ("#dear" #> user.shortName & | |
| "#validationLink [href]" #> validationLink)(t) | |
| out.head.asInstanceOf[Elem] | |
| }).openOr { | |
| val msg = "template: " + templatePath + " not found" |