-
-
Save timperrett/9df3baee3793b750e42e to your computer and use it in GitHub Desktop.
This file contains 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
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