Hey Chas,

> Nice work, Dave and Tim.

Thanks :-)

> Here's a question that just popped into my head: How do you test this
> code without moving money around? How will I know my installation will
> work? Is there a way to fake it?

But of course - paypal provide a sandbox. Dont be fooled, this is a
live system, and can take money from your card so paypal provide a
bunch of dummy card numbers to use whilst testing. I recently read an
article where a guy had put in his real card on paypal sandbox and it
took like 1000 bucks from his account (so you've been warned!)

To use the sandbox, do something like:

// USING PDT
// YourSnippet.scala
PaypalDataTransfer(at, tx, PaypalSandbox, PaypalSSL) // => use the
sandbox over SSL

PaypalDataTransfer(at, tx, PaypalLive, PaypalSSL) // => use the live
system over SSL

PaypalDataTransfer(at, tx, PaypalSandbox, PaypalHTTP) => use the live
system over HTTP


// USING IPN
// Boot.scala

object Boot {
  def boot {
  ...
  // paypal stuff:

  LiftRules.statelessDispatchTable = MyPayPalHandler orElse
LiftRules.statelessDispatchTable

  }
}


object MyPayPalHandler extends PayPal {
  import PaypalTransactionStatus._

  override val mode = PaypalLive
  override val connection = PaypalHTTP

  def actions = {
     case (ClearedPayment, info, _) => // write the payment to the
database
     case (RefundedPayment, info, _) => // process refund
  }
}


So, to answer your question, the key to all this are the sealed types
PaypalMode, and PaypalConnection - then its just down to you to make
sure that you dont use your actual credit card in the sandbox ;-)

Make sense?

Cheers

Tim


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to