Skip to content

Instantly share code, notes, and snippets.

@timperrett
Created October 18, 2008 18:00
Show Gist options
  • Save timperrett/9df3baee3793b750e42e to your computer and use it in GitHub Desktop.
Save timperrett/9df3baee3793b750e42e to your computer and use it in GitHub Desktop.
sealed abstract class PaypalTransactionStatus
case object CanceledPayment extends PaypalTransactionStatus {
override def toString = "Canceled"
}
case object ClearedPayment extends PaypalTransactionStatus {
override def toString = "Cleared"
}
case object CompletedPayment extends PaypalTransactionStatus {
override def toString = "Completed"
}
case object DeniedPayment extends PaypalTransactionStatus {
override def toString = "Denied"
}
case object ExpiredPayment extends PaypalTransactionStatus {
override def toString = "Expired"
}
case object FailedPayment extends PaypalTransactionStatus {
override def toString = "Failed"
}
case object PendingPayment extends PaypalTransactionStatus {
override def toString = "Pending"
}
case object RefundedPayment extends PaypalTransactionStatus {
override def toString = "Refunded"
}
case object ReturnedPayment extends PaypalTransactionStatus {
override def toString = "Returned"
}
case object ReversedPayment extends PaypalTransactionStatus {
override def toString = "Reversed"
}
case object UnclaimedPayment extends PaypalTransactionStatus {
override def toString = "Unclaimed"
}
case object UnclearedPayment extends PaypalTransactionStatus {
override def toString = "Uncleared"
}
case class PaypalResponse(response: List[String])
case class PaypalEventAction(status: PaypalTransactionStatus, functions: List[() => Any])
case class PaypalIPN(actions: List[PaypalEventAction]){
actions.map(_.functions.map(_()))
}
val pending: PaypalEventAction = PaypalEventAction(PendingPayment, List(
() => println("Love badgers, love life"),
() => println(100/2)
))
val completed: PaypalEventAction = PaypalEventAction(RefundedPayment, List(
() => println("Refunded example")
))
PaypalIPN(List(pending,completed))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment